Refactored to use a typedef of Font to Font3D rather than have a separate Font3D class
This commit is contained in:
@@ -27,7 +27,6 @@ ADD_LIBRARY(${LIB_NAME}
|
||||
DefaultFont.cpp
|
||||
DefaultFont.h
|
||||
Font.cpp
|
||||
Font3D.cpp
|
||||
String.cpp
|
||||
FadeText.cpp
|
||||
TextBase.cpp
|
||||
|
||||
@@ -74,7 +74,7 @@ osgText::Glyph* DefaultFont::getGlyph(const FontResolution& fontRes, unsigned in
|
||||
}
|
||||
|
||||
|
||||
osg::Vec2 DefaultFont::getKerning(const FontResolution&, unsigned int,unsigned int, KerningType)
|
||||
osg::Vec2 DefaultFont::getKerning(unsigned int,unsigned int, KerningType)
|
||||
{
|
||||
// no kerning on default font.
|
||||
return osg::Vec2(0.0f,0.0f);
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
virtual osgText::Glyph3D* getGlyph3D(unsigned int charcode) { return 0; }
|
||||
|
||||
virtual osg::Vec2 getKerning(const FontResolution&, unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType);
|
||||
virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType);
|
||||
|
||||
virtual bool hasVertical() const;
|
||||
|
||||
|
||||
@@ -422,9 +422,9 @@ void Font::releaseGLObjects(osg::State* state) const
|
||||
// const_cast<Font*>(this)->_sizeGlyphMap.clear();
|
||||
}
|
||||
|
||||
osg::Vec2 Font::getKerning(const FontResolution& fontRes, unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType)
|
||||
osg::Vec2 Font::getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType)
|
||||
{
|
||||
if (_implementation.valid()) return _implementation->getKerning(fontRes, leftcharcode,rightcharcode,kerningType);
|
||||
if (_implementation.valid()) return _implementation->getKerning(leftcharcode,rightcharcode,kerningType);
|
||||
else return osg::Vec2(0.0f,0.0f);
|
||||
}
|
||||
|
||||
@@ -943,3 +943,9 @@ void Glyph::subload() const
|
||||
"\t 0x"<<(unsigned long)data()<<");"<<dec<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void Glyph3D::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
if (_vertexArray.valid()) _vertexArray->setThreadSafeRefUnref(threadSafe);
|
||||
if (_normalArray.valid()) _normalArray->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
|
||||
@@ -312,9 +312,4 @@ bool Font3D::hasVertical() const
|
||||
else return false;
|
||||
}
|
||||
|
||||
void Glyph3D::setThreadSafeRefUnref(bool threadSafe)
|
||||
{
|
||||
if (_vertexArray.valid()) _vertexArray->setThreadSafeRefUnref(threadSafe);
|
||||
if (_normalArray.valid()) _normalArray->setThreadSafeRefUnref(threadSafe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -149,14 +149,14 @@ String::iterator Text::computeLastCharacterOnLine(osg::Vec2& cursor, String::ite
|
||||
{
|
||||
case LEFT_TO_RIGHT:
|
||||
{
|
||||
osg::Vec2 delta(activefont->getKerning(_fontSize, previous_charcode,charcode,_kerningType));
|
||||
osg::Vec2 delta(activefont->getKerning(previous_charcode,charcode,_kerningType));
|
||||
cursor.x() += delta.x() * wr;
|
||||
cursor.y() += delta.y() * hr;
|
||||
break;
|
||||
}
|
||||
case RIGHT_TO_LEFT:
|
||||
{
|
||||
osg::Vec2 delta(activefont->getKerning(_fontSize, charcode,previous_charcode,_kerningType));
|
||||
osg::Vec2 delta(activefont->getKerning(charcode,previous_charcode,_kerningType));
|
||||
cursor.x() -= delta.x() * wr;
|
||||
cursor.y() -= delta.y() * hr;
|
||||
break;
|
||||
@@ -418,14 +418,14 @@ void Text::computeGlyphRepresentation()
|
||||
{
|
||||
case LEFT_TO_RIGHT:
|
||||
{
|
||||
osg::Vec2 delta(activefont->getKerning(_fontSize, previous_charcode,charcode,_kerningType));
|
||||
osg::Vec2 delta(activefont->getKerning(previous_charcode,charcode,_kerningType));
|
||||
cursor.x() += delta.x() * wr;
|
||||
cursor.y() += delta.y() * hr;
|
||||
break;
|
||||
}
|
||||
case RIGHT_TO_LEFT:
|
||||
{
|
||||
osg::Vec2 delta(activefont->getKerning(_fontSize, charcode,previous_charcode,_kerningType));
|
||||
osg::Vec2 delta(activefont->getKerning(charcode,previous_charcode,_kerningType));
|
||||
cursor.x() -= delta.x() * wr;
|
||||
cursor.y() -= delta.y() * hr;
|
||||
break;
|
||||
|
||||
@@ -135,7 +135,7 @@ String::iterator Text3D::computeLastCharacterOnLine(osg::Vec2& cursor, String::i
|
||||
return lastChar;
|
||||
}
|
||||
|
||||
Glyph3D* glyph = _font->getGlyph(charcode);
|
||||
Glyph3D* glyph = _font->getGlyph3D(charcode);
|
||||
if (glyph)
|
||||
{
|
||||
const osg::BoundingBox & bb = glyph->getBoundingBox();
|
||||
@@ -245,7 +245,7 @@ String::iterator Text3D::computeLastCharacterOnLine(osg::Vec2& cursor, String::i
|
||||
// Subtract off glyphs from the cursor position (to correctly center text)
|
||||
if(*prevChar != '-')
|
||||
{
|
||||
Glyph3D* glyph = _font->getGlyph(*prevChar);
|
||||
Glyph3D* glyph = _font->getGlyph3D(*prevChar);
|
||||
if (glyph)
|
||||
{
|
||||
switch(_layout)
|
||||
@@ -316,7 +316,7 @@ void Text3D::computeGlyphRepresentation()
|
||||
{
|
||||
unsigned int charcode = *itr;
|
||||
|
||||
Glyph3D* glyph = _font->getGlyph(charcode);
|
||||
Glyph3D* glyph = _font->getGlyph3D(charcode);
|
||||
if (glyph)
|
||||
{
|
||||
const osg::BoundingBox & bb = glyph->getBoundingBox();
|
||||
|
||||
Reference in New Issue
Block a user