Crates.io | tfon |
lib.rs | tfon |
version | 0.1.3 |
source | src |
created_at | 2023-10-27 17:58:50.707376 |
updated_at | 2024-11-21 14:40:28.429367 |
description | Bitmap font parsing / conversion |
homepage | |
repository | https://github.com/DougLau/tfon/ |
max_upload_size | |
id | 1016286 |
size | 41,516 |
This is a bitmap font parsing / conversion library. It supports a few font formats:
Format | Import | Export |
---|---|---|
bdf | ✔️ | ❌ |
.tfon
| ✔️ | ✔️ |
.ifnt
| ✔️ | ✔️ |
.ifntx
| ✔️ | ❌ |
.tfon
FormatFonts in this format can be created with any text editor. There are two parts to the file: a header and a list of characters.
The header contains 4 key/value pairs:
font_name: Example font
font_number: 6
char_spacing: 1
line_spacing: 3
The character list can have between 1 and 255 values. Each character has a ch definition and a pixel grid:
ch: 52 4
...@.
..@@.
.@.@.
@..@.
@@@@@
...@.
...@.
X
| 0X
| 1X
| 2X
| 3X
| 4X
| 5X
| 6X
| 7X
----|------|------|------|------|------|------|------|-----
0
| NUL | DLE | SP | 0 | @ | P | ` | p
1
| SOH | DC1 | ! | 1 | A | Q | a | q
2
| STX | DC2 | " | 2 | B | R | b | r
3
| ETX | DC3 | # | 3 | C | S | c | s
4
| EOT | DC4 | $ | 4 | D | T | d | t
5
| ENQ | NAK | % | 5 | E | U | e | u
6
| ACK | SYN | & | 6 | F | V | f | v
7
| BEL | ETB | ' | 7 | G | W | g | w
8
| BS | CAN | ( | 8 | H | X | h | x
9
| HT | EM | ) | 9 | I | Y | i | y
A
| LF | SUB | * | : | J | Z | j | z
B
| VT | ESC | + | ; | K | [ | k | {
C
| FF | FS | , | < | L | \ | l | |
D
| CR | GS | - | = | M | ] | m | }
E
| SO | RS | . | > | N | ^ | n | ~
F
| SI | US | / | ? | O | _ | o | DEL
X
| 8X
| 9X
| AX
| BX
| CX
| DX
| EX
| FX
----|------|------|------|------|------|------|------|-----
0
| PAD | DCS | NBSP | ° | À | Ð | à | ð
1
| HOP | PU1 | ¡ | ± | Á | Ñ | á | ñ
2
| BPH | PU2 | ¢ | ² | Â | Ò | â | ò
3
| NBH | STS | £ | ³ | Ã | Ó | ã | ó
4
| IND | CCH | ¤ | ´ | Ä | Ô | ä | ô
5
| NEL | MW | ¥ | µ | Å | Õ | å | õ
6
| SSA | SPA | ¦ | ¶ | Æ | Ö | æ | ö
7
| ESA | EPA | § | · | Ç | × | ç | ÷
8
| HTS | SOS | ¨ | ¸ | È | Ø | è | ø
9
| HTJ | SGCI | © | ¹ | É | Ù | é | ù
A
| LTS | SCI | ª | º | Ê | Ú | ê | ú
B
| PLD | CSI | « | » | Ë | Û | ë | û
C
| PLU | ST | ¬ | ¼ | Ì | Ü | ì | ü
D
| RI | OSC | SHY | ½ | Í | Ý | í | ý
E
| SS2 | PM | ® | ¾ | Î | Þ | î | þ
F
| SS3 | APC | ¯ | ¿ | Ï | ß | ï | ÿ