2 Spacing fonts
(require sfont/space) | package: sfont |
This module define functions and macros for spacing fonts.
syntax
(space font-expr maybe-groups spacing-form ...)
maybe-groups =
| [groups (group-name group) ...] spacing-form = glyph-name : side side | @ group-name : side side | (glyph-name ...) : side side side = -- | (/--/ advance-width) | (<-> adjustment) | (^ sidebearing height) | sidebearing
(space font-to-be-spaced [groups (group1 '(h i l m n)) (group2 '(o e c d))] v : 10 10 f : 80 (^ 200 100) a : -- (/--/ 400) k : (/--/ 400) -- (s z) : (<-> 20) (<-> 20) @ group1 : (^ 80 200) (^ 80 100) @ group2 : 40 --)
Two groups are defined (group1 and group2) and they are added to the font groups field.
v : 10 10: means set both sidebearings of v to 10
f : 80 (200 100): means set the left sidebearings of f to 80 while the right sidebearing is set to 200 at height 100
a : -- (/--/ 400): means leave the left sidebearings of a untouched and set its advance width to 400
k : (/--/ 400) --: means leave the right sidebearings of k untouched and set its advance width to 400
(s z) : (<-> 20) (<-> 20): defines an inline group (s and z) that won’t be added to the font groups. and adjust the left and right sidebearings of both glyphs by 20 units.
@ group1 : (80 200) (80 100): applies the spacing rules to every glyph in group1, The left sidebearing is set to 80 at height 200, while the right sidebearing is set to 80 at height 100
@ group2 : 40 --: sets the left sidebearing of every glyph in group2 to 40.
The various forms can be combined freely.
syntax
(space-glyph glyph-expr side side)
(space-glyph (glyph-expr font-expr) side side)
syntax
(kern font expr maybe-groups kern-form ...)
maybe-groups =
|
[groups (side1 [group-name group] ...) (side2 [group-name group] ...)] kern-form = glyph1 glyph2 : kern | @ group-name glyph2 : kern | glyph1 @ group-name : kern | @ group-name @ group-name : kern
(kern font-to-be-kerned [groups (side1 [curved '(d e c o)]) (side2 [diag '(v w y)])] @ roundR @ diagL : -20 k o : -16)
procedure
(lowercase-tracy f xh n o min [c-adj] l-adj) → font?
f : font? xh : real? n : real? o : real? min : real? c-adj : real? = 0.8 l-adj : 1.05
procedure
(uppercase-tracy f caps h o min) → font?
f : font? caps : real? h : real? o : real? min : real?
syntax
(define-spacing-rule name (arg ...) (locals ...) maybe-groups spacing-form ...)
(define-spacing-rule lowercase-tracy [xh n o min [c-adj 0.8] [l-adj 1.05]] ([mid (/ xh 2)] [a n] [b (floor (* 0.9 n))] [c (floor (* l-adj n))] [d min] [e o] [f (floor (* c-adj o))]) a : -- (b mid) b : (a mid) e c : e f d : e (a mid) e : e f f : -- -- g : -- -- h : (c mid) (b mid) ...)