Changeset 13041 for OpenSceneGraph/trunk/src/osgText/Font.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/src/osgText/Font.cpp (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgText/Font.cpp
r12407 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 */ … … 76 76 s_FontFilePath.push_back(winFontPath); 77 77 } 78 #elif defined(__APPLE__) 79 osgDB::convertStringPathIntoFilePathList( 78 #elif defined(__APPLE__) 79 osgDB::convertStringPathIntoFilePathList( 80 80 ".:/usr/share/fonts/ttf:/usr/share/fonts/ttf/western:/usr/share/fonts/ttf/decoratives:/Library/Fonts:/System/Library/Fonts", 81 81 s_FontFilePath); … … 104 104 105 105 // Not found, return empty string 106 OSG_INFO<<"Warning: font file \""<<str<<"\" not found."<<std::endl; 106 OSG_INFO<<"Warning: font file \""<<str<<"\" not found."<<std::endl; 107 107 return std::string(); 108 108 } … … 115 115 if (foundFile.empty()) 116 116 foundFile = filename; 117 117 118 118 OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getFontFileMutex()); 119 119 … … 157 157 } 158 158 if (!rr.validObject()) return 0; 159 159 160 160 osg::Object *object = rr.takeObject(); 161 161 … … 176 176 if (foundFile.empty()) 177 177 foundFile = filename; 178 178 179 179 OpenThreads::ScopedLock<OpenThreads::Mutex> lock(getFontFileMutex()); 180 180 … … 216 216 } 217 217 if (!rr.validObject()) return 0; 218 218 219 219 // if the object is a font then return it. 220 220 osgText::Font* font = dynamic_cast<osgText::Font*>(rr.getObject()); … … 323 323 { 324 324 return _textureHeightHint; 325 } 325 } 326 326 327 327 … … 355 355 FontResolution fontResUsed(0,0); 356 356 if (_implementation->supportsMultipleFontResolutions()) fontResUsed = fontRes; 357 357 358 358 { 359 359 OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_glyphMapMutex); … … 397 397 { 398 398 osg::Object::setThreadSafeRefUnref(threadSafe); 399 399 400 400 if (_texenv.valid()) _texenv->setThreadSafeRefUnref(threadSafe); 401 401 if (_stateset.valid()) _stateset->setThreadSafeRefUnref(threadSafe); … … 406 406 { 407 407 (*itr)->setThreadSafeRefUnref(threadSafe); 408 } 408 } 409 409 } 410 410 … … 418 418 { 419 419 (*itr)->resizeGLObjectBuffers(maxSize); 420 } 420 } 421 421 } 422 422 … … 431 431 (*itr)->releaseGLObjects(state); 432 432 } 433 433 434 434 // const_cast<Font*>(this)->_glyphTextureList.clear(); 435 435 // const_cast<Font*>(this)->_sizeGlyphMap.clear(); … … 455 455 456 456 _sizeGlyphMap[fontRes][charcode]=glyph; 457 457 458 458 int posX=0,posY=0; 459 459 460 460 GlyphTexture* glyphTexture = 0; 461 461 for(GlyphTextureList::iterator itr=_glyphTextureList.begin(); … … 465 465 if ((*itr)->getSpaceForGlyph(glyph,posX,posY)) glyphTexture = itr->get(); 466 466 } 467 467 468 468 if (glyphTexture) 469 469 { 470 470 //cout << " found space for texture "<<glyphTexture<<" posX="<<posX<<" posY="<<posY<<endl; 471 471 } 472 472 473 473 if (!glyphTexture) 474 474 { 475 475 476 476 glyphTexture = new GlyphTexture; 477 477 478 478 static int numberOfTexturesAllocated = 0; 479 479 ++numberOfTexturesAllocated; … … 488 488 glyphTexture->setFilter(osg::Texture::MAG_FILTER,_magFilterHint); 489 489 glyphTexture->setMaxAnisotropy(8); 490 490 491 491 _glyphTextureList.push_back(glyphTexture); 492 492 493 493 if (!glyphTexture->getSpaceForGlyph(glyph,posX,posY)) 494 494 { … … 497 497 } 498 498 499 } 500 499 } 500 501 501 // add the glyph into the texture. 502 502 glyphTexture->addGlyph(glyph,posX,posY); 503 504 } 503 504 }
