|
| 1 | +# tinyfontgen-ttf |
| 2 | + |
| 3 | +Generate a font file for tinyfont project. |
| 4 | + |
| 5 | +* https://tinygo.org/x/tinyfont |
| 6 | + |
| 7 | +## Description |
| 8 | + |
| 9 | +By default, all ASCII characters are included. |
| 10 | +To save font flash size, you can delete the output Glyph on a line-by-line basis. |
| 11 | +If you want to include non-ASCII characters, you can use one of the following methods |
| 12 | + |
| 13 | +* Specify the -all option to output all characters contained in the ttf font. |
| 14 | +* Outputs all characters contained in the string specified by -string |
| 15 | +* Output all characters in the file specified by -string-file. |
| 16 | +* Fonts generated by tinyfontgen-ttf are 2-bit-color, so they will not display well on non color LCDs. |
| 17 | + * In the current version, the background must be white |
| 18 | + |
| 19 | +``` |
| 20 | +usage: tinyfontgen-ttf [flags] [path ...] |
| 21 | + -all |
| 22 | + include all ascii glyphs (codepoint <= 255) in the font |
| 23 | + -ascii |
| 24 | + include all glyphs in the font (default true) |
| 25 | + -dpi int |
| 26 | + dpi for font (default 75) |
| 27 | + -fontname string |
| 28 | + font name (default "TinyFont") |
| 29 | + -output string |
| 30 | + output path |
| 31 | + -package string |
| 32 | + package name (default "main") |
| 33 | + -size int |
| 34 | + size for font (default 12) |
| 35 | + -string string |
| 36 | + strings for font |
| 37 | + -string-file value |
| 38 | + strings file for font (can be set multiple times) |
| 39 | + -verbose |
| 40 | + run verbosely |
| 41 | + -yadvance int |
| 42 | + new line distance |
| 43 | +``` |
| 44 | + |
| 45 | +## Examples |
| 46 | + |
| 47 | +### RubikMoonrocks |
| 48 | + |
| 49 | +https://fonts.google.com/specimen/Rubik+Moonrocks?query=rub |
| 50 | + |
| 51 | +``` |
| 52 | +$ go run ./cmd/tinyfontgen-ttf --size 32 --package rubikmoonrocks --fontname RubikMoonrocks ./RubikMoonrocks-Regular.ttf --output rubikmoonrocks/font.go |
| 53 | +``` |
| 54 | + |
| 55 | +## Installation |
| 56 | + |
| 57 | + go install tinygo.org/x/tinyfont/cmd/tinyfontgen-ttf@latest |
| 58 | + |
| 59 | +## License |
| 60 | + |
| 61 | +[This project is licensed](../../LICENSE) under the BSD 3-clause license, just like the [Go project](https://golang.org/LICENSE) itself. |
0 commit comments