bitmap-font-maker: fontc - .font glyph grids -> atlas PNG + metrics JSON + text rendering

- .font format: glyph sections with #/. grids, proportional widths,
  literal unicode glyph names, spacing/space-width/line-height/baseline
- build (atlas white-on-transparent + JSON metrics), render (text -> PNG
  with \n, scale, color), info, preview (terminal half-blocks)
- example tiny5 font: A-Z, ÅÄÖ, 0-9, punctuation (47 glyphs, 3x5)
- go tests: parsing, errors, atlas metrics, text rendering

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmdG9GqfSWCzts7AkDwRDh
This commit is contained in:
2026-07-14 07:03:04 +02:00
parent a5b8a249ed
commit 6b10c4a57c
10 changed files with 1557 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 405 B

View File

@@ -0,0 +1,340 @@
{
"name": "tiny5",
"atlas": "tiny5.png",
"height": 5,
"lineHeight": 6,
"baseline": 5,
"spacing": 1,
"spaceWidth": 3,
"glyphs": {
"!": {
"x": 36,
"y": 30,
"w": 1,
"h": 5,
"advance": 2
},
"'": {
"x": 24,
"y": 36,
"w": 1,
"h": 5,
"advance": 2
},
"+": {
"x": 18,
"y": 36,
"w": 3,
"h": 5,
"advance": 4
},
",": {
"x": 30,
"y": 30,
"w": 2,
"h": 5,
"advance": 3
},
"-": {
"x": 12,
"y": 36,
"w": 3,
"h": 5,
"advance": 4
},
".": {
"x": 24,
"y": 30,
"w": 1,
"h": 5,
"advance": 2
},
"0": {
"x": 6,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"1": {
"x": 12,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"2": {
"x": 18,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"3": {
"x": 24,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"4": {
"x": 30,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"5": {
"x": 36,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
},
"6": {
"x": 0,
"y": 30,
"w": 3,
"h": 5,
"advance": 4
},
"7": {
"x": 6,
"y": 30,
"w": 3,
"h": 5,
"advance": 4
},
"8": {
"x": 12,
"y": 30,
"w": 3,
"h": 5,
"advance": 4
},
"9": {
"x": 18,
"y": 30,
"w": 3,
"h": 5,
"advance": 4
},
":": {
"x": 6,
"y": 36,
"w": 1,
"h": 5,
"advance": 2
},
"?": {
"x": 0,
"y": 36,
"w": 3,
"h": 5,
"advance": 4
},
"A": {
"x": 0,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"B": {
"x": 6,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"C": {
"x": 12,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"D": {
"x": 18,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"E": {
"x": 24,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"F": {
"x": 30,
"y": 0,
"w": 3,
"h": 5,
"advance": 4
},
"G": {
"x": 36,
"y": 0,
"w": 4,
"h": 5,
"advance": 5
},
"H": {
"x": 0,
"y": 6,
"w": 3,
"h": 5,
"advance": 4
},
"I": {
"x": 6,
"y": 6,
"w": 3,
"h": 5,
"advance": 4
},
"J": {
"x": 12,
"y": 6,
"w": 3,
"h": 5,
"advance": 4
},
"K": {
"x": 18,
"y": 6,
"w": 3,
"h": 5,
"advance": 4
},
"L": {
"x": 24,
"y": 6,
"w": 3,
"h": 5,
"advance": 4
},
"M": {
"x": 30,
"y": 6,
"w": 5,
"h": 5,
"advance": 6
},
"N": {
"x": 36,
"y": 6,
"w": 4,
"h": 5,
"advance": 5
},
"O": {
"x": 0,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"P": {
"x": 6,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"Q": {
"x": 12,
"y": 12,
"w": 4,
"h": 5,
"advance": 5
},
"R": {
"x": 18,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"S": {
"x": 24,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"T": {
"x": 30,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"U": {
"x": 36,
"y": 12,
"w": 3,
"h": 5,
"advance": 4
},
"V": {
"x": 0,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"W": {
"x": 6,
"y": 18,
"w": 5,
"h": 5,
"advance": 6
},
"X": {
"x": 12,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"Y": {
"x": 18,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"Z": {
"x": 24,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"Ä": {
"x": 36,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"Å": {
"x": 30,
"y": 18,
"w": 3,
"h": 5,
"advance": 4
},
"Ö": {
"x": 0,
"y": 24,
"w": 3,
"h": 5,
"advance": 4
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

View File

@@ -0,0 +1,334 @@
# tiny5 - a 3x5 pixel font (uppercase + digits + Swedish ÅÄÖ).
# Widths vary: M/W are 5 px, punctuation as narrow as 1 px.
font: tiny5
spacing: 1
space-width: 3
glyph A:
.#.
#.#
###
#.#
#.#
glyph B:
##.
#.#
##.
#.#
##.
glyph C:
.##
#..
#..
#..
.##
glyph D:
##.
#.#
#.#
#.#
##.
glyph E:
###
#..
##.
#..
###
glyph F:
###
#..
##.
#..
#..
glyph G:
.###
#...
#.##
#..#
.##.
glyph H:
#.#
#.#
###
#.#
#.#
glyph I:
###
.#.
.#.
.#.
###
glyph J:
..#
..#
..#
#.#
.#.
glyph K:
#.#
#.#
##.
#.#
#.#
glyph L:
#..
#..
#..
#..
###
glyph M:
#...#
##.##
#.#.#
#...#
#...#
glyph N:
#..#
##.#
#.##
#..#
#..#
glyph O:
.#.
#.#
#.#
#.#
.#.
glyph P:
##.
#.#
##.
#..
#..
glyph Q:
.##.
#..#
#..#
#.#.
.#.#
glyph R:
##.
#.#
##.
#.#
#.#
glyph S:
.##
#..
.#.
..#
##.
glyph T:
###
.#.
.#.
.#.
.#.
glyph U:
#.#
#.#
#.#
#.#
###
glyph V:
#.#
#.#
#.#
#.#
.#.
glyph W:
#...#
#...#
#.#.#
##.##
#...#
glyph X:
#.#
#.#
.#.
#.#
#.#
glyph Y:
#.#
#.#
.#.
.#.
.#.
glyph Z:
###
..#
.#.
#..
###
glyph Å:
.#.
.#.
#.#
###
#.#
glyph Ä:
#.#
.#.
#.#
###
#.#
glyph Ö:
#.#
.#.
#.#
#.#
.#.
glyph 0:
###
#.#
#.#
#.#
###
glyph 1:
.#.
##.
.#.
.#.
###
glyph 2:
##.
..#
.#.
#..
###
glyph 3:
###
..#
.##
..#
###
glyph 4:
#.#
#.#
###
..#
..#
glyph 5:
###
#..
##.
..#
##.
glyph 6:
.##
#..
###
#.#
###
glyph 7:
###
..#
.#.
.#.
.#.
glyph 8:
###
#.#
###
#.#
###
glyph 9:
###
#.#
###
..#
##.
glyph .:
.
.
.
.
#
glyph ,:
..
..
..
.#
#.
glyph !:
#
#
#
.
#
glyph ?:
###
..#
.#.
...
.#.
glyph ::
.
#
.
#
.
glyph -:
...
...
###
...
...
glyph +:
...
.#.
###
.#.
...
glyph ':
#
#
.
.
.