OlivierSohn / hamazed

Monorepo for a multi-player game engine, and game examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate font size issue

OlivierSohn opened this issue · comments

The algorithm determining "the maximal font size such that all characters fit within a given block" (see createFont) was developped on OSX, with a particular graphic card driver.

On Linux, and using another graphic card driver, some characters are bigger than expected : their outer borders "leak" in the incremental rendering process.

I see 2 possible sources for this behaviour:

  • maybe font rasterizing, in ftgl, behaves differently on different platforms: to find out, we can compare FTGL.getFontBBox on different platforms (see testFont)
  • maybe different graphic openGL drivers perform different numerical roundings on the texture.

Note that if there are some roundings that we have no control over, and that we cannot know in advance, we could either use a bigger margin in createFont or let users adjust the margin so that "it looks good on their screen".

After looking into it more closely, it turns out a call to glViewport before rendering was missing : on OSX, it had no incidence but it did on linux.

It is fixed by this commit.