Re: [AD] TTF addon workabout patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sun, 2008-10-26 at 19:54 -0700, Paul Suntsov wrote:
> Attached is a patch to fix the bug I described in an earlier message.
> Before, font height was defined by the size you passed to the
> al_ttf_load_font. This is wrong for most cases, as the screen DPI is
> undefined. A more useful value is the maximum ascent of font's
> characters. This value will correspond to the height, in pixels, above
> the baseline of the font.
> 
> The patch achieves that by measuring the ascent of the capital 'M'
> character, which I guess is the highest letter in most character sets.
> This is a workabout right now, as I couldn't stick this check inside
> that loop which checks through the characters. Someone with a greater
> knowledge of the Free Type library can make that change.
> 
> The examples naturally have their texts moved a bit, but without major
> issue from what I could see.
> 

Is this in addition to the previous patch, or does it replace it? I only
looked at ex_ttf, it doesn't look a lot different here. My understanding
of Freetype was that I can use either:

http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Set_Char_Size

or

http://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#FT_Set_Pixel_Sizes

to set the size of the font. The former one tries to scale the TTF so
given the monitors resolution, the glyphs get a certain size in points.
But we don't use that.

The second one I hoped is to simply set the size in pixels, regardless
of any monitor resolution. Probably my interpretion there is not quite
right though - but I'm not really sure this patch is the proper way to
fix it..

Maybe before applying it we should ask on allegro.cc if someone knows
what the right way is, e.g. Thomas Harte there seems to know a lot about
freetype.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/