4 ms·
Texture-Less Text Rendering
- bazzargh 2y agoKeith Packard made a very small font, Twin, based on the Hershey fonts, that could be easily embedded in other code. The paper describing it is here: https://keithp.com/~keithp/talks/twin-ols2005/twin_ols2005.pdf https://keithp.com/~keithp/talks/twin-ols2005/twin_ols2005.p... It's embedded in the Cairo graphics library for debug/test text, just like the one in the article. The data table is here: https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src/cairo-font-face-twin-data.c?ref_type=heads https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src... and the code that renders the characters is here: https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src/cairo-font-face-twin.c?ref_type=heads#L633 https://gitlab.freedesktop.org/cairo/cairo/-/blob/master/src... If implementing Keith's curved version is too much, you can always just use the straight lines of the original Hershey fonts https://emergent.unpythonic.net/software/hershey https://emergent.unpythonic.net/software/hershey ... which are also pretty tiny