freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] sub-pixel translations?


From: David Turner
Subject: Re: [Freetype] sub-pixel translations?
Date: Wed, 05 Jun 2002 09:09:19 +0200

Hello Dan,

Dan Maas a écrit :
> 
> Hi all - I'm using Freetype to render text titles in a video-editing system.
> It has been working great so far. However:
> 
> Is there a way to specify a sub-pixel x/y offset when rasterizing a TrueType
> character?
> 
> I need this capability for animating text whose size is changing over time.
> I can get individual characters to resize very smoothly, using a scaling
> transformation matrix. However, I must also maintain sub-pixel accuracy for
> the intervals between characters (obtained from the "advance" values). I
> need to be able to tell the rasterizer that the left edge of a character
> lies not on a pixel boundary, but on some fraction of a pixel.
> 
> I have been able to achieve good results by asking for a monochrome bitmap
> from FreeType, and then down-sampling to grayscale with my own code.
> However, I'd like to know if there is some way to achieve sub-pixel offsets
> with FreeType's own anti-aliasing rasterizer. (I have tried specifying an
> x/y offset to FT_Glyph_Transform and FT_Glyph_To_Bitmap, but it seems to
> have no effect on the rendered pixels).
>

You can do that with the following:

  - load glyph outline  (FT_Load_Glyph( face, gindex, FT_LOAD_NO_BITMAP ))
  - translate it with sub-pixel offsets (FT_Outline_Translate( 
face->glyph->outline, dx, dy ));
  - convert if to an anti-aliased glyph bitmap  (FT_Render_Glyph(...) or 
FT_Get_Glyph_Bitmap(...))

it should also be a _lot_ faster than generating a monochrome bitmap
and manually filtering it

hope this help..

Regards,

- David Turner
- The FreeType Project  (www.freetype.org)



reply via email to

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