Hi

I totally agree with you, it should. But FT does already something similar
to what you have mentioned. In the background FT probably
callsFT_Outline_Get_BBoxwhich expands the outer Bézier arcs in the
outline. The difference is only a
few pixel from what I get when I render the glyph, and I think some fix can
be implemented for this. But I didn't want to reply yet because I'm trying
to free up some tome to explore the code of FT more deeply, so I can suggest
some fix to Werner.


On Fri, Feb 26, 2010 at 8:17 PM, Michiel Kamermans <
[email protected]> wrote:

>  Apparently I only sent this to Werner, rather than the list. So for his
> reply to make sense, here's the preceding message:
>
> ---
>
> Hi Werner,
>
>
>  if it's not please give me some advice how can I get accurate
> bounding boxes without actually rendering the glyphs.
>
>
> This is not possible.
>
>
>
> But perhaps it should be, since there is nothing preventing FreeType from
> accurately reporting on the "real" bounding box for a character shape. You
> don't have to actually render a glyph (in the sense that it is rasterised to
> a pixel map) to analyse the vector coordinates.
>
> Just run through the 'glyf' table at the correct index, and resolve the
> coordinate list. For consideration, something like a new function
> FT_GET_GLYPH_COORDINATES returning a compound struct such as
>
> typedef struct FT_Glyph_Shape {
>   FT_Vector* coordinates;
>   FT_Vector* controlpoints;
> } FT_Glyph_Shape;
>
> could be used to finding the vector coordinates and bezier control points.
> Determining the bounds could then be done in FT_Get_Glyph_CBox by walking
> the (compound) glyph's bezier curve(s) and tracking the min/max x/y
> coordinates as the curve is travelled (without remembering the curve
> itself).
>
> - Mike "Pomax" Kamermans
> nihongoresources.com
>
> _______________________________________________
> Freetype mailing list
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/freetype
>
>
_______________________________________________
Freetype mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/freetype

Reply via email to