mkfont documentation
A⟩ CLI Invocation
mkfont -i ⟨input file⟩ [-o ⟨output file⟩] [-f]where:
⟨input file⟩is the path to the font spec file written in themkfontlanguage;⟨output file⟩is the path to the folder in which the UFO font will be written (if it is not specified, a reasonable name is computed from the input file name)- the
-fflag letsmkfontoverwrite an existing font folder.
B⟩ The mkfont language
mkfont uses a stack based language to build a font specification. there are a number of commands available in all scopes (maths, variables, macros) and some commands available only in specific scopes
B.I⟩ Literals
String literal any character except
" enclosed in ". It is a known limitation in mkfont 0.2.0.0 that " cannot be escaped in string literalsCharacter literal
# followed by any single individual character.Integer literal A sequence of decimal digit (
[0-9]) optionally preceded by -, or a sequence of hexadecimal digits ([0-9a-fA-F]) preceeded by 0x.Symbol
' followed by a valid identifier name (raw(“[a-zA-Z._]+”))Token list literal any number of valid tokens enclosed in a balanced pair of square brackets (
[ ]).B.II⟩ General commands
B.II.1⟩ Maths
+ b : int, a : int → a + b : int- b : int, a : int → a - b : int* b : int, a : int → a × b : int/ b : int, a : int → floor(a / b) : int~ b : int, a : int → floor((a + b) / 2) : intB.II.2⟩ Variables
: n : symbol, a : any → (), stores the value of a in variable n@ n : symbol → a: any, fetches the value of variable n, errors out if n is undefined.! m: symbol | tokenlist → (), if m is a symbol it is dereferenced ('sym ! is syntax sugar for 'sym @ !). If after desugaring, the value isn’t a tokenlist, the interpreter errors out. otherwise, the tokenlist is prepended to the list of tokens to evaluateB.II.3⟩ Stack manipulation
swp b: any, a: any → a: any, b: anydup a: any → a: any, a: anykil a: any → ()