Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » truetype font addon

This thread is locked; no one can reply to it. rss feed Print
truetype font addon
William Labbett
Member #4,486
March 2004
avatar

Hi,

I've been using a font with the truetype addon.

Inspection of this image :

612181

will show that since the leftmost number was drawn at location (8, 0), and the font
was loaded with fontsize equal to 16, there are 3 white pixels above the first pixel that makes the number. There is also one below. So the font size was 16 but the actual character size is 16 - 3 - 1 = 12.

Does anyone know if the actual character size is determined in a predictable way?

something like

character size = f(fontsize) ?

Edgar Reynaldo
Member #8,592
May 2007
avatar

Fonts have an 'ascent', a 'descent' and a 'line height'. You probably want a font with no descent.

You may have better luck with a bitmap font, or a fixed width font, which may or may not still have descent.

EDIT
You're probably looking for al_get_font_line_height.

Go to: