- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/freetype/FreeTypeFont.cpp
r12827 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 231 231 // not dangling pointers remain 232 232 freeTypeLibrary->removeFontImplmentation(this); 233 233 234 234 // free the freetype font face itself 235 235 FT_Done_Face(_face); … … 272 272 { 273 273 OSG_WARN<<"Warning: FreeTypeFont::setSize("<<width<<","<<height<<") sizes too large,"<<std::endl; 274 274 275 275 width = _facade->getTextureWidthHint()-2*margin; 276 276 height = _facade->getTextureHeightHint()-2*margin; … … 303 303 304 304 // 305 // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being 306 // returned, for symbol fonts in windows (FT_ENCONDING_MS_SYMBOL in freetype) the correct 307 // values are from 0xF000 to 0xF0FF not from 0x000 to 0x00FF (0 to 255) as you would expect. 305 // GT: fix for symbol fonts (i.e. the Webdings font) as the wrong character are being 306 // returned, for symbol fonts in windows (FT_ENCONDING_MS_SYMBOL in freetype) the correct 307 // values are from 0xF000 to 0xF0FF not from 0x000 to 0x00FF (0 to 255) as you would expect. 308 308 // Microsoft uses a private field for its symbol fonts 309 309 // … … 332 332 unsigned int sourceWidth = glyphslot->bitmap.width;; 333 333 unsigned int sourceHeight = glyphslot->bitmap.rows; 334 334 335 335 unsigned int width = sourceWidth; 336 336 unsigned int height = sourceHeight; 337 337 338 338 osg::ref_ptr<osgText::Glyph> glyph = new osgText::Glyph(_facade, charcode); 339 339 340 340 unsigned int dataSize = width*height; 341 341 unsigned char* data = new unsigned char[dataSize]; 342 342 343 343 344 344 // clear the image to zeros. … … 354 354 glyph->setInternalTextureFormat(GL_ALPHA); 355 355 356 // copy image across to osgText::Glyph image. 356 // copy image across to osgText::Glyph image. 357 357 switch(glyphslot->bitmap.pixel_mode) 358 358 { … … 368 368 break; 369 369 370 370 371 371 case FT_PIXEL_MODE_GRAY: 372 372 for(int r=sourceHeight-1;r>=0;--r) … … 379 379 } 380 380 break; 381 381 382 382 default: 383 383 OSG_WARN << "FT_Load_Char(...) returned bitmap with unknown pixel_mode " << glyphslot->bitmap.pixel_mode << std::endl; … … 405 405 OSG_NOTICE<<" _face->units_per_EM = "<<_face->units_per_EM<<", scale="<<1.0f/float(_face->units_per_EM)<<std::endl; 406 406 #endif 407 407 408 408 // cout << " in getGlyph() implementation="<<this<<" "<<_filename<<" facade="<<_facade<<endl; 409 409 … … 525 525 FT_UInt left = FT_Get_Char_Index( _face, leftcharcode ); 526 526 FT_UInt right = FT_Get_Char_Index( _face, rightcharcode ); 527 528 // get the kerning distances. 527 528 // get the kerning distances. 529 529 FT_Vector kerning; 530 530 … … 573 573 return true; 574 574 #endif 575 } 575 } 576 576 577 577 float FreeTypeFont::getCoordScale() const
