Package: ftgl-dev Version: 2.1.2-3 Severity: normal Tags: patch Note: I'm sending this mail both to the FTGL developers as listed in the README and to the Debian bug tracking system. The patch below applies to version 2.1.2 (Debian etch), but AFAICS it should also work with minor adjustments (files moved etc.) to 2.1.3~rc5.
FTGL cannot use bitmap fonts as textures (FTGLTextureFont), only as FTGLBitmapFont. This is a problem, since unlike textures, bitmaps cannot be rotated, scaled, etc. in OpenGL. This applies in particular to 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.) OpenGL textures cannot be bitmaps AFAICS, but we can convert the bitmap to a pixmap, which is what the main part of this patch does (FTTextureGlyph.cpp). Also I had to adjust the bounding box computation, otherwise we have a 0-sized bbox since FTBBox.h uses FT_Outline_Get_CBox and we have no outline here; as a consequence, the various glyphs would overlap and overwrite each other in the texture. With my patch, it works OK now. Furthermore, when trying to use a bitmap font as an FTGLPixmapFont, it draws garbage. Of course, we could similarly convert the bitmap to a pixmap here, but a quicker solution is to just use an FTBitmapGlyph in FTPixmapFont. (Maybe this mixing will be considered dirty, but at least it seems to work -- patch for FTPixmapGlyph.h, FTPixmapGlyph.cpp, FTGLPixmapFont.cpp.) BTW, I note that the font objects (all fonts) seem to lack some error checking for glyphs. The glyph constructors may return with "err" set, but the font objects do not check this. I suppose this is the reason for the garbage drawn. I did not attempt to fix this in other cases except as necessary for the previous item, though. Finally, for FTGLBitmapFont objects, I would suggest to remove the "glDisable( GL_BLEND)" call (patch to FTGLBitmapFont.cpp). Blending bitmap fonts works well in OpenGL (when a color with alpha < 1 was set), but this call prevents it. Removing this call leaves the choice to the caller (who can enable or disable GL_BLEND as preferred).
ftgl-bitmap.patch
Description: Binary data