Package: libftgl2
Version: 2.1.3~rc5-3
Severity: normal
Tags: patch

*** Please type your report below this line ***

Most of this report corresponds to Debian bug #531489, with my
patches updated to the current FTGL version in Debian testing.

1. FTPolygonGlyph and FTOutlineGlyph segfault when given a font of a
   wrong type, e.g. a bitmap type. This is because vectorizer is
   uninitialized, and the constructor in this case returns before
   setting it.

   My patch (FTPolygonGlyph.cpp, FTOutlineGlyph.cpp) adds the
   initialization (copied from FTExtrudeGlyph) and prevents the
   crashing.

2. FTPixmapGlyph also doesn't check whether its impl is valid, which
   it would not be, again, in case of a bitmap type. In this case,
   it doesn't crash (in my tests), but draws garbage.

   The patch (FTBitmapGlyphImpl.h, FTPixmapGlyph.h,
   FTPixmapGlyph.cpp) adds this check, and in this case just creates
   an FTBitmapGlyphImpl and delegates the work to it.

   Also I add a check in FTPixmapGlyphImpl for the case of
   "num_grays == 1" which is valid according to the specification,
   though it might occur rarely. In this case, the font is
   effectively a bitmap, and is treated as such.

3. FTBitmapFontImpl disables GL_BLEND. While, of course, it does not
   need to enable it, unlike e.g. pixmap fonts, I don't think it's
   useful to disable it unconditionally, instead of leaving the
   choice to the caller.

   The patch (FTBitmapFont.cpp) removes the disabling. If the caller
   doesn't explicitly set GL_BLEND, nothing changes, but if they set
   it, and set a color with alpha < 1, bitmap fonts can now be drawn
   with transparency.

4. Bitmap fonts cannot be used as FTGLTextureFont, which is a
   serious disadvantage, since unlike textures, bitmaps cannot be
   rotated, scaled, etc. in OpenGL. This in particular affects X11
   .pcf fonts. It might also apply to TrueType fonts with embedded
   bitmaps: When googling for the problem, I found this message on
   the FreeType list:
   http://osdir.com/ml/fonts.freetype.devel/2005-03/msg00091.html
   It might refer to the same problem, so the diagnosis offered in
   the reply might apply to FTGL which was used there as well.

   The patch (FTTextureGlyph.cpp) converts bitmaps to pixmaps in
   FTTextureGlyphImpl, so they can be used now.

5. (New issue, not in #531489)

   FTContour::ComputeOutsetPoint computes an invalid point
   (-nan, -nan), when two edges form an angle of nearly 180°.
   (I'm not sure if this is somehow invalid according to the spec,
   but it actually occurs, e.g., with the "F" character in the font
   "El Abogado Loco" as installed in squeeze.) This is because
   norm + tmp.X() goes to 0, and therefore the fraction to infinity,
   when the angle approaches 180°. It is not merely a numeric
   problem, but the intersection point actually goes to infinity.
   The visible effect is that drawing such glyphs creates some
   spurious lines to the edge of the visual (even if Outset is not
   used, because 0 * inf is nan, so it's a regression compared to
   previous versions that didn't have Outset).

   Since it's an actual geometric problem, there is no obvious
   numeric solution. In my patch (FTContour.cpp), I just limit the
   outset point's distance (which also avoids ugly results, when the
   angle is just somewhat close to 180°, where there is no numeric
   problem yet, but the outset point would be very far away from
   A, B and C). Another solution might be to insert two outset
   points instead of one, say when the angle is > 90° (or < -90°),
   but that would be a bigger change.

-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.34 (SMP w/1 CPU core)
Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/dash

Versions of packages libftgl2 depends on:
ii  libc6                   2.11.2-2         Embedded GNU C Library: Shared lib
ii  libfreetype6            2.4.0-1          FreeType 2 font engine, shared lib
ii  libgcc1                 1:4.4.4-6        GCC support library
ii  libgl1-mesa-glx [libgl1 7.7.1-3          A free implementation of the OpenG
ii  libglu1-mesa [libglu1]  7.7.1-3          The OpenGL utility library (GLU)
ii  libstdc++6              4.4.4-6          The GNU Standard C++ Library v3
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

libftgl2 recommends no packages.

libftgl2 suggests no packages.

-- no debconf information

Attachment: ftgl.patch
Description: Binary data

Reply via email to