{"id":17217836,"url":"https://github.com/fzipp/bmfont","last_synced_at":"2025-04-13T23:24:10.371Z","repository":{"id":57515230,"uuid":"244100574","full_name":"fzipp/bmfont","owner":"fzipp","description":"Load and render bitmap fonts in the format of AngelCode's bitmap font generator.","archived":false,"fork":false,"pushed_at":"2024-05-01T05:59:16.000Z","size":20,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T13:40:48.102Z","etag":null,"topics":["angelcode-bitmap-fonts","bitmap-font","bmfont","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fzipp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2020-03-01T06:41:46.000Z","updated_at":"2024-11-21T13:22:49.000Z","dependencies_parsed_at":"2024-06-20T11:12:20.011Z","dependency_job_id":"994b89cc-eead-4b4e-a666-154d5aa17a5e","html_url":"https://github.com/fzipp/bmfont","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzipp%2Fbmfont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzipp%2Fbmfont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzipp%2Fbmfont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fzipp%2Fbmfont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fzipp","download_url":"https://codeload.github.com/fzipp/bmfont/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795189,"owners_count":21162726,"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":["angelcode-bitmap-fonts","bitmap-font","bmfont","go","golang"],"created_at":"2024-10-15T03:44:48.974Z","updated_at":"2025-04-13T23:24:10.344Z","avatar_url":"https://github.com/fzipp.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bmfont\n\nA Go package to load and render bitmap fonts\ncreated with [AngelCode's bitmap font generator](https://www.angelcode.com/products/bmfont/)\nor other tools that generate output in the same format.\n\nThis package uses the [text format](ttp://www.angelcode.com/products/bmfont/doc/file_format.html)\nfor font descriptor files (.fnt), not the binary format.\n\n## Documentation\n\nPackage documentation is available [on pkg.go.dev](https://pkg.go.dev/github.com/fzipp/bmfont?tab=doc).\n\n## Example usage\n\nLoad a bitmap font and draw text to an image:\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/fzipp/bmfont\"\n)\n\nfunc main() {\n\tfont, err := bmfont.Load(\"ExampleFont.fnt\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\timg := image.NewRGBA(image.Rect(0, 0, 600, 300))\n\tfont.DrawText(img, image.Pt(10, 20), `hello, world\nThis is an example.\nabcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXYZ`)\n\t// ...\n}\n```\n\nMeasure the text before drawing in order to determine the size of the image:\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/fzipp/bmfont\"\n)\n\nfunc main() {\n\tfont, err := bmfont.Load(\"ExampleFont.fnt\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n    text := `hello, world\nThis is an example.\nabcdefghijklmnopqrstuvwxyz\nABCDEFGHIJKLMNOPQRSTUVWXYZ`\n\n\tbounds := font.MeasureText(text)\n\timg := image.NewRGBA(image.Rect(0, 0, bounds.Dx(), bounds.Dy()))\n\tfont.DrawText(img, image.Point{}.Sub(bounds.Min), text)\n\t// ...\n}\n```\n\n\nOnly load the descriptor of a bitmap font:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/fzipp/bmfont\"\n)\n\nfunc main() {\n\tdesc, err := bmfont.LoadDescriptor(\"ExampleFont.fnt\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Println(desc.Info.Face)\n\tfmt.Println(\"line height:\", desc.Common.LineHeight)\n\tfmt.Println(\"letter A width:\", desc.Chars['A'].Width)\n}\n```\n\n## License\n\nThis project is free and open source software licensed under the\n[BSD 3-Clause License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffzipp%2Fbmfont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffzipp%2Fbmfont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffzipp%2Fbmfont/lists"}