freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] Contours and scaling


From: David Turner
Subject: Re: [Freetype] Contours and scaling
Date: Tue, 11 Jun 2002 01:18:21 +0200

Hello John,

Jon Harrop a écrit :
> 
> Hi!
> 
> I would like to use FreeType to render TrueType and MetaFont text in my
> vector graphics engine.
> 
> To do this I either need adaptively subdivided contours which are
> continuously scalable (i.e. no pixel hinting or integer round-off) or I need
> to get hold of the contours as lists of implicit curves (Bezier's, I assume)
> so that I can feed them into my own code.
> 
> However, I haven't been able to do either of these and, while everything else
> is smooth in my test scene, the text currently jerks about all over the place
> as you zoom in.
> 
> I don't want to use the FreeType rasterizer as I need to apply my own fill
> types and stroke and fill the contours.
> 
> Is it theoretically possible to do this using FreeType?
>
Yes, of course :-)

1. Load glyph outlines from the font files. I suggest to do that with
   one of the following values for the "load_flags" parameter of FT_Load_Glyph
   or FT_Load_Char:

       FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING
            to get scaled outlines (in 1/64th of pixels)

       FT_LOAD_NO_BITMAP | FT_LOAD_NO_SCALE
            to get outlines in original integer font units. Scaling
            them to device pixels is explained in the "FreeType Glyph 
Conventions"
            document

2. Use FT_Outline_Decompose to decompose the outline into a Postscript-like
   path.

3. Use your favorite graphics library to transform/strike/fill/texture/wathever
   the glyph outlines.

I'd also suggest you to use the cache to stored unscaled glyph outlines to
achieve better performance. But you can do entirely without it...

FreeType will not decompose bezier arcs for you. Even if it does it internally
within its rasterizers, this is done under controlled conditions to avoid
numerical errors since everything is performed with fixed-points.

I do not envision providing this feature to client applications, since if you
need to decompose a glyph outlines into segments, you'd better control the
algorithm its various parameters (e.g. the "flatness" threshold) yourself.


Hope this helps..

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


 
> Cheers,
> Jon.
> 
> _______________________________________________
> Freetype mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/freetype



reply via email to

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