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