From a5b83edc7617d3b2cf8eb4a6ad4fcb62c19670e1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 18 Nov 2010 17:18:31 +0000 Subject: [PATCH] Added resetting of the freetype size when getting Glyph3D glyph's as otherwise use of 2D and 3D Text would cause incorrect text sizing. --- src/osgPlugins/freetype/FreeTypeFont.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/osgPlugins/freetype/FreeTypeFont.cpp b/src/osgPlugins/freetype/FreeTypeFont.cpp index 7eb87904f..9975eb058 100644 --- a/src/osgPlugins/freetype/FreeTypeFont.cpp +++ b/src/osgPlugins/freetype/FreeTypeFont.cpp @@ -78,7 +78,7 @@ struct Char3DInfo } if (!(_currentPrimitiveSet->empty()) && - (*_verts)[(*_currentPrimitiveSet)[0]] == pos) + (*_verts)[(*+_currentPrimitiveSet)[0]] == pos) { _currentPrimitiveSet->push_back( (*_currentPrimitiveSet)[0] ); } @@ -249,14 +249,15 @@ FreeTypeFont::~FreeTypeFont() void FreeTypeFont::init() { - - FT_Error _error = FT_Set_Pixel_Sizes(_face, 32, 32); + FT_Error _error; +#if 0 + _error = FT_Set_Pixel_Sizes(_face, 32, 32); if (_error) { OSG_NOTICE << "FreeTypeFont3D: set pixel sizes failed ..." << std::endl; return; } - +#endif FT_Set_Char_Size( _face, 64*64, 64*64, 600, 600); int glyphIndex = FT_Get_Char_Index( _face, 'M' ); @@ -452,6 +453,9 @@ osgText::Glyph3D * FreeTypeFont::getGlyph3D(unsigned int charcode) { OpenThreads::ScopedLock lock(FreeTypeLibrary::instance()->getMutex()); + FT_Set_Char_Size( _face, 64*64, 64*64, 600, 600); + _currentRes = osgText::FontResolution(0,0); + // // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being // returned, for symbol fonts in windows (FT_ENCONDING_MS_SYMBOL in freetype) the correct