…rinse and repeat for several thousand lines.
The “sub” sequence of characters matches greedily, which is why this list starts with 4-digit numbers; if it started from 1 to 9, then we’d just get a bunch of single-digit replacements. That also means that for 5+ digit numbers like 123456, the font will match 4 digits at a time and produce the glyph for “1234”, then “56”.
The glyph appearance itself is defined using the SVG paths from Chris Heilmann’s Cistercian numeral generator. Thanks Chris!
For the full code I used to generate the Cistercian font, see the GitHub repo: bobbiec/cistercian-font. Note that the code is largely AI-generated - though I reviewed it, I also wouldn’t have the expertise to notice if something is very wrong.
Something I noticed when playing around with the demo is that the quadrants are ordered in a rather unusual way. If you count from the least significant digit (ones) to the most significant digit (thousands), you get this backwards-Z shape: