Western stroke-based font format
The .lettering format defines Western fonts as sequences of pen strokes. Unlike outline fonts (TrueType, OpenType) which store filled contours, lettering fonts store the tool paths — the motion of a pen creating each glyph.
.font-begin MyFont
units-per-em 1000
ascender 800
descender -200
.circular-pen-begin mono
diameter 40
.circular-pen-end
.glyph-begin A U+0041
advance-width 650
stroke mono 50,0 ⏤ 325,750 ⏤ 600,0
stroke mono 150,250 ⏤ 500,250
.glyph-end
.font-end
| Property | Description |
|---|---|
units-per-em | Design units per em (typically 1000) |
ascender | Height above baseline |
descender | Depth below baseline (negative) |
cap-height | Height of capital letters |
x-height | Height of lowercase x |
Define pens before using them in glyphs. Three pen shapes supported:
.circular-pen-begin mono
diameter 40
.circular-pen-end
.elliptical-pen-begin broad
width 60
height 20
angle 30
.elliptical-pen-end
.rectangular-pen-begin chisel
width 50
height 10
angle 45
.rectangular-pen-end
.glyph-begin A U+0041
advance-width 650
left-bearing 50
stroke mono 50,0 ⏤ 325,750 ⏤ 600,0
stroke mono 150,250 ⏤ 500,250
.glyph-end
| Property | Description |
|---|---|
advance-width | Horizontal advance after glyph |
left-bearing | Space before glyph starts |
stroke | Pen stroke path |
fill | Filled path (for enclosed shapes) |
| Symbol | Unicode | Meaning |
|---|---|---|
⏤ | U+23E4 | Straight line segment |
⌒ | U+2312 | Smooth curve (Hobby's algorithm) |
∠ | U+2220 | Corner / inflection point |
↻ | U+21BB | Close path to start |
⌀ | U+2300 | Diameter at point (variable width) |
∡ | U+2221 | Direction constraint |
⊙ | U+2299 | Tension modifier |
.glyph-begin I U+0049
advance-width 300
stroke main 150,100 ⏤ 150,700
.glyph-end
.glyph-begin O U+004F
advance-width 700
stroke main 350,0 ⌒ 700,350 ⌒ 350,700 ⌒ 0,350 ↻
.glyph-end
.glyph-begin n U+006E
advance-width 550
stroke main 100,0⌀40 ⏤ 100,500⌀40 ⌒ 250,500⌀30 ⌒ 400,350⌀40 ⏤ 400,0⌀40
.glyph-end
.kerning-begin
AV -80
VA -80
To -40
Ty -40
.kerning-end
The lettering format builds on the pen-path crate which provides:
Curves use Hobby's algorithm for smooth splines through points.