- Online Community Forums » Allegro Development » rendering font border in ttf addon

This thread is locked; no one can reply to it. rss feed Print
rendering font border in ttf addon
Petr Kratochvil
Member #14,680
November 2012


I need the text border (outline) to be highlighted, like in tv subtitles, to achieve higher contrast with arbitrary background. I have tried to edit the ttf addon, and it works for me. But I'm not really sure what I am doing, could please somebody wise have a look at the diff? I think that this functionality would be welcome by many others, and it'll be good to make it work in Allegro.

I have defined a new flag ALLEGRO_TTF_RENDER_BORDER. When set, the font is rendered with a one-pixel black border by default. Or you can set the parameters using the new function al_set_ttf_border(ALLEGRO_FONT *font, float width, ALLEGRO_COLOR color).


Trent Gamblin
Member #261
April 2000

Nice! The patch looked good up until cache_glyph and then it started using stuff I've never seen. I wouldn't apply it until I gave it a good read and some testing... which I may be able to do tomorrow. Unless someone else with Freetype experience wants to look at it.

This is a great feature though and one I've wanted (and also wondered how it is achieved!)

Go to: