[Bf-committers] [Patch] Add support for using (dynamically) system-wide FTGL libraries.

Sam Hocevar sam at zoy.org
Mon May 12 12:50:38 CEST 2008


On Sun, May 11, 2008, Joe Eagar wrote:
> You make some very good points.  However, I have to disagree that our 
> FTGL is pathologically buggy.  As far as I know, there's only 1 bug with 
> textured fonts (a small visual artifact).

   Oh, don't worry, it is. You are just lucky you do not use
FTGLExtrdFont or FTGLOutlineFont, because the most problematic part is
probably FTContour::FTContour(). First, tags are not sanitised through
FT_CURVE_TAG(), which means that some points in glyph curves may be
missed. Second, if the first loop iteration does not add a point to the
curve, it then crashes on line 86 (pointList[pointList.size() - 1]).
Also, on line 135, if pointIndex == numberOfPoints - 1, the routine
crashes on contour[pointIndex + 2].

   Other crash points that do hit Blender are src/FTGLTextureFont.cpp,
line 110, and src/FTTextureGlyph.cpp, line 44. Integer values are not
sanitised and will cause divisions by zero with very small glyphs and/or
at very small font sizes.

   There is also a potential problem in FTCharToGlyphIndexMap which I
haven't fully investigated yet, but using div() with an unsigned operand
does not seem right to me. Our unit tests do not cover Unicode very well
yet so that one will have to wait a bit (luckily it is not part of the
public API).

> The problem with shared libraries is that we have to trust someone
> else (and every single distributor) to not break the code. That's a
> lot of people to rely on.

   Fully agreed. That's why I took the liberty to show up here. We wish
to release a version of FTGL with a stable public API that we do not
have to change later and we are checking that all projects which use
FTGL or embed copies of it still work with only minor changes.

   While we are at it, are there any missing features in FTGL that you
would like to see? Vertical text and right-to-left text is the most
requested feature and even if we don't support it with the upcoming
release, we will add propers hooks so that it can be supported later
without changing the API.

Cheers,
-- 
Sam.


More information about the Bf-committers mailing list