{"id":17115032,"url":"https://github.com/tdewolff/font","last_synced_at":"2025-04-13T04:08:18.334Z","repository":{"id":225825238,"uuid":"766950312","full_name":"tdewolff/font","owner":"tdewolff","description":"Font parsing and manipulation","archived":false,"fork":false,"pushed_at":"2025-03-14T09:30:02.000Z","size":15214,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-13T04:07:54.796Z","etag":null,"topics":["font","otf","parse","ttf","woff"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tdewolff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-03-04T12:40:53.000Z","updated_at":"2025-04-01T03:50:36.000Z","dependencies_parsed_at":"2025-01-17T15:40:04.816Z","dependency_job_id":null,"html_url":"https://github.com/tdewolff/font","commit_stats":null,"previous_names":["tdewolff/font"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdewolff%2Ffont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdewolff%2Ffont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdewolff%2Ffont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdewolff%2Ffont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tdewolff","download_url":"https://codeload.github.com/tdewolff/font/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248661704,"owners_count":21141450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","otf","parse","ttf","woff"],"created_at":"2024-10-14T17:21:20.266Z","updated_at":"2025-04-13T04:08:18.309Z","avatar_url":"https://github.com/tdewolff.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Font [![API reference](https://img.shields.io/badge/godoc-reference-5272B4)](https://pkg.go.dev/github.com/tdewolff/font?tab=doc)\n\n**[fontcmd](https://github.com/tdewolff/font/tree/master/cmd/fontcmd)**: font toolkit that can select a subset of glyphs from a font, merge fonts, or show font information and display glyphs in the command line or as a raster image.\n\nThis library contains font parsers for WOFF, WOFF2, and EOT. It takes a byte-slice as input and converts it to SFNT formats (either TTF or OTF). As font formats for the web, WOFF, WOFF2, and EOT are really just containers for SFNT fonts (such as TTF and OTF) that have better compression.\n\nThe WOFF and WOFF2 converters have been testing using the validation tests from the W3C.\n\n## Usage\nImport using:\n\n``` go\nimport \"github.com/tdewolff/font\"\n```\n\nThen we can parse any byte-slice that is in the WOFF/WOFF2/EOT file format and extract its TTF/OTF content.\n\n``` go\nfont, err := ioutil.ReadFile(\"DejaVuSerif.woff\")\nif err != nil {\n    panic(err)\n}\n\nsfnt, err := font.ToSFNT(font)\nif err != nil {\n    panic(err)\n}\n```\n\nor using an `io.Reader`\n\n``` go\nfont, err := os.Open(\"DejaVuSerif.woff\")\nif err != nil {\n    panic(err)\n}\n\nfont, err = font.NewSFNTReader(font)\nif err != nil {\n    panic(err)\n}\n```\n\n### WOFF\n``` go\nwoff, err := ioutil.ReadFile(\"DejaVuSerif.woff\")\nif err != nil {\n    panic(err)\n}\n\nsfnt, err := font.ParseWOFF(woff)\nif err != nil {\n    panic(err)\n}\n\next := font.Extension(sfnt)\nif err = ioutil.WriteFile(\"DejaVuSerif\"+ext, sfnt, 0644); err != nil {\n    panic(err)\n}\n```\n\nTested using https://github.com/w3c/woff/tree/master/woff1/tests.\n\n### WOFF2\n``` go\nwoff2, err := ioutil.ReadFile(\"DejaVuSerif.woff2\")\nif err != nil {\n    panic(err)\n}\n\nsfnt, err := font.ParseWOFF2(woff2)\nif err != nil {\n    panic(err)\n}\n\next := font.Extension(sfnt)\nif err = ioutil.WriteFile(\"DejaVuSerif\"+ext, sfnt, 0644); err != nil {\n    panic(err)\n}\n```\n\nTested using https://github.com/w3c/woff2-tests.\n\n### EOT\n``` go\neof, err := ioutil.ReadFile(\"DejaVuSerif.eot\")\nif err != nil {\n    panic(err)\n}\n\nsfnt, err = font.ParseEOT(eot)\nif err != nil {\n    panic(err)\n}\n\next := font.Extension(sfnt)\nif err = ioutil.WriteFile(\"DejaVuSerif\"+ext, sfnt, 0644); err != nil {\n    panic(err)\n}\n```\n\n## License\nReleased under the [MIT license](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdewolff%2Ffont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdewolff%2Ffont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdewolff%2Ffont/lists"}