Re: [AD] slow fonts

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


On Tue, 2009-07-28 at 22:57 -0700, Paul Suntsov wrote:

> I've traced down the problem (at least on my machine) to the
> invocation of FT_Load_Glyph. According to the FreeType documentation
> this function is very slow, and removing its call from the addon sped
> up ex_ttf 3-4 times for me. The only thing we use FT_Load_Glyph during
> normal operation (i.e. after we cached the glyph) is to get the new
> advance values. I figured that there should be no problem in caching
> these advance values, so that FT_Load_Glyph call can be eliminated. In
> my testing I did not see any apparent difference between cached and
> non-cached versions of the code, while seeing significant speedup:
> ex_ttf went from 150 FPS to 550 FPS for me. The diff is attached.
> 

Really nice.

You must have better documentation than me. All the Freetype examples
have a call to FT_Load_Glyph for each glyph (and all it does according
to the docs is fill in the FT_Face->face slot, which would not take any
time). So I'd never have looked at this for speed improvement, with
http://freetype.sourceforge.net/freetype2/docs/reference/ft2-base_interface.html#FT_Load_Glyph not mention anything. Seems this function actually did a lot more though.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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