TrueType debug glyphs

This small project is inspired by the dynamic 7-segment glyphs by Ben Laenen, which are part of the DejaVu fonts. My goal was to expand on this idea, and to create similar glyphs that are as correct, robust, and efficient as possible.

The complicated

I came up with two alternative versions, to display any value between 00 and 99. The "Strokes" implementation produces high quality output, while the "Stacks" implementation is reasonably lightweight. They are available on GitLab, under the terms of the CC0.

UnhintedIntermediateFinal
Instructing the digit 9 with the Strokes implementation

Both implementations follow a two-step approach. They first instruct the outlines to an intermediate configuration, which is chosen to minimize the number of instructions required afterwards. The second step consists of a loop that is iterated once for each digit. In the loop, the rectangles are aligned with established points, to create their final form.

Displaying MPPEM, MPS, and GETINFO values

These debug glyphs will push any TrueType interpreter to its limits, with a healthy dose of math, stack manipulation, and inline functions. Some might even say they are a bit silly. I would agree with them. Hence...

The simple

While working on the Oxanium fonts, I realized that I only use the debug glyph to check if the instructions are executed at all. Therefore, I implemented a much more lightweight boolean marker, in the form of a simple triangle. In its unhinted configuration, it points downward. When the instructions are executed, they turn the triangle upside down.

012012012012
Alignment steps to flip the triangle
PUSHB[101]
1 0 2 1 0 2
SVTCA[0]
MDAP[1]
ALIGNRP
MDAP[1]
ALIGNRP
SRP0
ALIGNRP
The 14-byte glyph program