TTFlib font rendering colors w/transparency

Hello all,

I’m using the older version of TTFlib.

I render the font string with black foreground, blue background. Then I
use the blue as my transparent color for the blit.

But it looks like the TTF rendering step is doing some smoothing between
the background and foreground colors of the font. So when I do the
transparent blit, there is a blue outline around the font characters where
the pixel color isn’t exactly the transparent color anymore.

Does anyone know how to get around this?
I’m tired of staring at the freetype documentation and wondered if someone
had a quick answer to save me a little time… :slight_smile:

thanks!–
Brian Hayward

hayward at slothmud.org wrote:

Hello all,

I’m using the older version of TTFlib.

I render the font string with black foreground, blue background. Then I
use the blue as my transparent color for the blit.

But it looks like the TTF rendering step is doing some smoothing between
the background and foreground colors of the font. So when I do the
transparent blit, there is a blue outline around the font characters where
the pixel color isn’t exactly the transparent color anymore.

Does anyone know how to get around this?
I’m tired of staring at the freetype documentation and wondered if someone
had a quick answer to save me a little time… :slight_smile:

You can take a look at PowerPak. There’s a lot of different freetype
code including a function for blitting non-antialiased fonts.

Bye, Karl

hayward at slothmud.org wrote:

I’m using the older version of TTFlib.

I render the font string with black foreground, blue background. Then I
use the blue as my transparent color for the blit.

But it looks like the TTF rendering step is doing some smoothing between
the background and foreground colors of the font. So when I do the
transparent blit, there is a blue outline around the font characters where
the pixel color isn’t exactly the transparent color anymore.

The anti-aliasing rendering color palette is what’s causing the problem.

You need to look at the function “TTF_RenderUNICODE()”, starting at line
259.
It sets up the color table for the font rendering using the background
and foreground colors as a scale.

You could also use “TT_Get_Glyph_Bitmap()” instead of
"TT_Get_Glyph_Pixmap()", which doesn’t do anti-aliasing or use the color
palettes.