{"id":16218108,"url":"https://github.com/quasilyte/bitfontier","last_synced_at":"2025-03-19T10:30:54.451Z","repository":{"id":232019508,"uuid":"782841415","full_name":"quasilyte/bitfontier","owner":"quasilyte","description":"A bitmap font maker for Go","archived":false,"fork":false,"pushed_at":"2024-05-06T11:34:27.000Z","size":46,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T17:57:24.557Z","etag":null,"topics":["bitmap","bitmap-font","command-line-tool","ebiten","ebitengine","font","font-generator","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quasilyte.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":"2024-04-06T07:26:01.000Z","updated_at":"2024-05-06T11:34:31.000Z","dependencies_parsed_at":"2024-04-07T13:26:19.644Z","dependency_job_id":"4e6fb339-53e3-4cdd-8cf3-688f61206bd4","html_url":"https://github.com/quasilyte/bitfontier","commit_stats":null,"previous_names":["quasilyte/bitfontier"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fbitfontier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fbitfontier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fbitfontier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quasilyte%2Fbitfontier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quasilyte","download_url":"https://codeload.github.com/quasilyte/bitfontier/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243982182,"owners_count":20378605,"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":["bitmap","bitmap-font","command-line-tool","ebiten","ebitengine","font","font-generator","go","golang"],"created_at":"2024-10-10T11:48:31.289Z","updated_at":"2025-03-19T10:30:54.057Z","avatar_url":"https://github.com/quasilyte.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bitfontier\n\n## Overview\n\n`bitfontier` is a tool to generate bitmap fonts for Go programs.\n\nTo be more specific:\n\n* it takes a set of images organized in a particular way for an input,\n* generates a Go package that can be used to create [font.Face](https://pkg.go.dev/golang.org/x/image/font#Face) objects\n\nThese `font.Face` objects can then be used to render text in your Go programs. One example would be using [Ebitengine](https://pkg.go.dev/golang.org/x/image/font#Face) - the fonts generated by this program are suitable for videogames!\n\nThis tool takes a lot of inspiration from [hajimehoshi/bitmapfont](https://github.com/hajimehoshi/bitmapfont).\n\nFeatures:\n\n* Efficient bitmap generation\n* Outputs a ready-to-use Go package\n* Produced Go packages (\"fonts\") can be bundled as Go modules\n* The generator has options to fine-tune the produced font behavior\n* Uses separate images for glyphs as input (easy to edit)\n\nYou can basically create a bitmap font for your Go app by using just this tool and some sprite editor (GIMP, Aseprite, etc).\n\n## Installation\n\n```bash\n$ go install github.com/quasilyte/bitfontier/cmd/bitfontier@latest\n```\n\n## Fonts\n\nReady-to-use fonts created by bitfontier:\n\n* [bitsweetfont](https://github.com/quasilyte/bitsweetfont)\n\n## Usage\n\nFirst, you need to create a set of images that would form a bitmap font. The font can have multiple base sizes and support multiple languages. We'll start with a single-size English set of images.\n\nThe general layout expected by this tool is:\n\n```\n$size/\n  $tag/\n    65.png\n    66.png\n    ...\n  ...\n...\n```\n\n\u003e The root of this folder structure is called `data-dir`.\n\n* `$size` is a base font size (e.g. `1`, `1.3`)\n* `$tag` is an arbitrary tag for the set of glyphs (e.g. `en`, `common`, `symbols`)\n\nThe image filename consist of an utf-8 code (in decimal form) and extension (it's advised to use PNGs).\n\nAll images inside the size folder should have identical bounds (e.g. `8x16`). Images can use any non-transparent color for the letter mask: this library only checks for alpha channel to build a bitmap.\n\nAfter you're ready, run the tool:\n\n```bash\n# Use --help to learn about the other flags!\n./bitfontier --data-dir ./_data --pkgname myfont\n```\n\nThis will produce a folder called `myfont` containing a Go package. Copy that package to your app's folder and use it as an ordinary package. Or push it as a Go module on GitHub and install it in a proper way.\n\n\u003e Hint: if you want to bundle a font as a module, make sure to install the dependencies like `golang.org/x/image/font` to the font module.\n\nAfter installing the generated font package, you can instantiate `font.Face` objects:\n\n```go\nfunc example() {\n    // ff is a font.Face, the \"1\" suffix comes from the\n    // data dir, there will be more constructors if your\n    // bitmap font defines them.\n    ff := myfont.New1()\n\n    // It's possible to create programmatically scaled versions\n    // of your base font sizes. It won't be blurry.\n    // Only whole scaling factors are available (2, 3, 4, ...)\n    ff2 := myfont.Scale(ff, 2)\n    ff3 := myfont.Scale(ff, 3)\n}\n```\n\nLet's assume your font has both `size=1` and `size=1.3` base variants. We can squeeze a wide range of font sizes out of it using `Scale`:\n\n* 1 (base size)\n* 1.3 (base size)\n* 2 (1*2)\n* 2.6 (1.3*2)\n* 3 (1*3)\n* 3.9 (1.3*3)\n* 4\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fbitfontier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquasilyte%2Fbitfontier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquasilyte%2Fbitfontier/lists"}