Loading large fonts cause Raspberry Pi glitchy display

I noticed this bug on a project I was porting to the Raspberry Pi, but you can see it in action on the fonts example. Just edit fontsExample/src/ofApp.cpp:

  • Add ofToggleFullscreen(); at the top of setup()
  • Change the font load calls on lines 18 and 22 to have font sizes of 100, or any size above 76

If you do that, you get a screen like this:

It has ghosting and the top half is glitchy.

For reference, if I change one of the font declarations back to it’s default 14, things render nicely. (The other font here is still 100 so you can’t read it properly, but it does render as expected).

I’m using Raspberry Pi 3 and Arch Linux, using this guide to set up.

Anyone had a similar experience or thoughts on what’s causing it?

ofTTF internally allocates a texture to hold all the characters of the loaded font that then uses to render texts. it might be that after some character size it’s trying to allocate a texture that it’s too big for the rpi graphics card. you can check the texture size using font.getFontTexture().getWidth()/getHeight()

there’s plans for creating more than one texture internally if this happens but it’s not implemented yet. meanwhile if you are using the nightly builds or OF from github you can use font.getStringTexture(str) which creates a texture for a specific text on the fly without using the internal texture atlas. it’s slightly more dificult to place cause instead of the baseline of the text you have to position it using the top left corner of the generated texture but can be more flexible for cases like this or multialphabet texts

Good to know - thanks arturo