freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] How to use subpixel hinting in FreeType


From: Werner LEMBERG
Subject: Re: [ft] How to use subpixel hinting in FreeType
Date: Sat, 20 Jun 2015 06:27:34 +0200 (CEST)

Sorry for the late response.

> I am a beginner at using FreeType and new to the concept of subpixel
> hinting.  I've read through most API references that seemed related,
> but I am still not sure how should I use the library to attain RGB
> (or RGBA?) bitmaps with glyphs hinted on the subpixel level.  If
> there are any examples on this I did not manage to find, please
> direct me to it.

I suggest that you look at the FreeType demo programs like `ftdiff' or
`ftview'.

> So here is what I tried doing so far: I built the library with both
> the FT_CONFIG_OPTION_SUBPIXEL_RENDERING and the
> TT_CONFIG_OPTION_SUBPIXEL_HINTING definitions. Here is my program,
> that runs without errors: http://pastebin.com/YNhgwwAN
> 
> With this method, I end up with a glyph bitmap which is three times
> wider than the intended size.

This looks OK to me.

> If this is the right approach, then my question is how should I use
> this information to get an RGB bitmap with the right size?  The code
> tries to directly map the values of the result bitmap to the RGB
> channels, but this doesn't seem right:
> http://postimg.org/image/gbfdyh0b9/ The colors are obviously too
> strong.

The color filter assumes that the background is white, not black, and
yes, the colour artifacts can be quite visible.

> I guess I am doing something really wrong here, because if I try different
> sizes (for example: 31) the result will be distorted:
> http://postimg.org/image/7s28scn9j/
> I am also getting distortions like that seemingly every time, if I don't
> turn on LCD filtering.

The bitmap size is not `width*rows' but rather `pitch*rows'.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]