chris roddy <[EMAIL PROTECTED]> writes: > Russ Allbery wrote: >> The doubling cube is fine after the first double. Note that the Debian >> package has been patched to load an external font file rather than use >> the non-free font file that comes with gnubg in CVS, if that might >> possibly affect this (I'm not sure what's used for the doubling cube). >> The bug doesn't affect the 3D board.
> I'm pretty sure this one is caused by the Debian package's use of > ttf-bitstream-vera to replace luxi.c. This change was introduced in > 0.14.3+20060520-1 according to the changelog. That seemed likely, but I couldn't tell why it would result in this behavior or how to fix it. Here's the relevant Debian patch. (Note that I'm doing this in Debian because the luxi.c font is non-free; this will probably be an issue for the FSF as well.) I suppose I could be using the API wrong, but it seemed rather straightforward and very similar to the regular gnubg code. Index: gnubg/Makefile.am =================================================================== --- gnubg.orig/Makefile.am 2006-08-25 21:01:37.000000000 -0700 +++ gnubg/Makefile.am 2006-08-25 21:01:37.000000000 -0700 @@ -32,11 +32,7 @@ else BR1_SOURCES = endif -if USE_FREETYPE -FONT_SOURCES = luxi.c -else FONT_SOURCES = -endif if EXTERNAL_BR1 BR1DATA = gnubg_os0.bd Index: gnubg/render.c =================================================================== --- gnubg.orig/render.c 2006-08-25 20:46:42.000000000 -0700 +++ gnubg/render.c 2006-08-25 21:01:37.000000000 -0700 @@ -125,8 +125,10 @@ FT_Library ftl; #define FT_PIXEL_MODE_GRAY ft_pixel_mode_grays #endif -extern unsigned char auchLuxiRB[], auchLuxiSB[], auchLuxiSR[]; -extern unsigned int cbLuxiRB, cbLuxiSB, cbLuxiSR; +#define FONT_PATH "/usr/share/fonts/truetype/ttf-bitstream-vera" +#define FONT_VERA FONT_PATH "/Vera.ttf" +#define FONT_VERA_BOLD FONT_PATH "/VeraBd.ttf" +#define FONT_VERA_SERIF_BOLD FONT_PATH "/VeraSeBd.ttf" #endif @@ -1518,7 +1520,7 @@ RenderLabels( renderdata *prd, unsigned int i; FT_Glyph aftg[ 10 ]; - if( FT_New_Memory_Face( ftl, auchLuxiSB, cbLuxiSB, 0, &ftf ) ) + if( FT_New_Face( ftl, FONT_VERA_BOLD, 0, &ftf ) ) { RenderBasicLabels( prd, puch, nStride, iStart, iEnd, iDelta ); return; @@ -1849,7 +1851,7 @@ extern void RenderChequerLabels( renderd FT_Glyph aftg[ 10 ]; int fFreetype = FALSE; - if( !FT_New_Memory_Face( ftl, auchLuxiSR, cbLuxiSR, 0, &ftf ) && + if( !FT_New_Face( ftl, FONT_VERA, 0, &ftf ) && !FT_Set_Pixel_Sizes( ftf, 0, 2 * prd->nSize ) ) { fFreetype = TRUE; for( i = 0; i < 10; i++ ) { @@ -2026,7 +2028,7 @@ extern void RenderCubeFaces( renderdata FT_Glyph aftg[ 10 ], aftgSmall[ 10 ]; int fFreetype = FALSE; - if( !FT_New_Memory_Face( ftl, auchLuxiRB, cbLuxiRB, 0, &ftf ) && + if( !FT_New_Face( ftl, FONT_VERA_SERIF_BOLD, 0, &ftf ) && !FT_Set_Pixel_Sizes( ftf, 0, 5 * prd->nSize ) ) { fFreetype = TRUE; @@ -2106,7 +2108,7 @@ extern void RenderResignFaces( renderdat FT_Glyph aftg[ 10 ], aftgSmall[ 10 ]; int fFreetype = FALSE; - if( !FT_New_Memory_Face( ftl, auchLuxiRB, cbLuxiRB, 0, &ftf ) && + if( !FT_New_Face( ftl, FONT_VERA_SERIF_BOLD, 0, &ftf ) && !FT_Set_Pixel_Sizes( ftf, 0, 5 * prd->nSize ) ) { fFreetype = TRUE; Index: gnubg/board3d/font3d.c =================================================================== --- gnubg.orig/board3d/font3d.c 2006-08-25 20:46:42.000000000 -0700 +++ gnubg/board3d/font3d.c 2006-08-25 21:02:45.000000000 -0700 @@ -30,6 +30,10 @@ #include <ft2build.h> #include FT_FREETYPE_H +#define FONT_PATH "/usr/share/fonts/truetype/ttf-bitstream-vera" +#define FONT_VERA FONT_PATH "/Vera.ttf" +#define FONT_VERA_SERIF_BOLD FONT_PATH "/VeraSeBd.ttf" + #define FONT_SIZE (base_unit / 20.0f) #define CUBE_FONT_SIZE (base_unit / 24.0f) @@ -65,7 +69,7 @@ typedef struct _Mesh GArray *tesselations; } Mesh; -int CreateOGLFont(FT_Library ftLib, OGLFont *pFont, unsigned char *pBufferBytes, unsigned int bufferSizeInBytes, int pointSize, float scale); +int CreateOGLFont(FT_Library ftLib, OGLFont *pFont, const char *pPath, int pointSize, float scale); void PopulateVectoriser(Vectoriser* pVect, FT_Outline* pOutline); void TidyMemory(Vectoriser* pVect, Mesh* pMesh); void PopulateContour(Contour* pContour, FT_Vector* points, char* pointTags, int numberOfPoints); @@ -78,15 +82,15 @@ int BuildFont3d(BoardData3d* bd3d) if (FT_Init_FreeType(&ftLib)) return 0; - if (!CreateOGLFont(ftLib, &bd3d->numberFont, auchLuxiSR, cbLuxiSR, 24, FONT_SIZE)) + if (!CreateOGLFont(ftLib, &bd3d->numberFont, FONT_VERA, 24, FONT_SIZE)) return 0; - if (!CreateOGLFont(ftLib, &bd3d->cubeFont, auchLuxiRB, cbLuxiRB, 44, CUBE_FONT_SIZE)) + if (!CreateOGLFont(ftLib, &bd3d->cubeFont, FONT_VERA_SERIF_BOLD, 44, CUBE_FONT_SIZE)) return 0; return !FT_Done_FreeType(ftLib); } -int CreateOGLFont(FT_Library ftLib, OGLFont *pFont, unsigned char *pBufferBytes, unsigned int bufferSizeInBytes, int pointSize, float scale) +int CreateOGLFont(FT_Library ftLib, OGLFont *pFont, const char *pPath, int pointSize, float scale) { int i, j; FT_Face face; @@ -94,7 +98,7 @@ int CreateOGLFont(FT_Library ftLib, OGLF memset(pFont, 0, sizeof(OGLFont)); pFont->scale = scale; - if (FT_New_Memory_Face(ftLib, (FT_Byte *)pBufferBytes, bufferSizeInBytes, 0, &face)) + if (FT_New_Face(ftLib, pPath, 0, &face)) return 0; if (FT_Set_Char_Size(face, 0, pointSize * 64 /* 26.6 fractional points */, 0, 0)) -- Russ Allbery ([EMAIL PROTECTED]) <http://www.eyrie.org/~eagle/> -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]