Removed getScale() parameter from osgText::Font
This commit is contained in:
@@ -104,9 +104,6 @@ public:
|
||||
/** Return true if this font provides vertical alignments and spacing or glyphs.*/
|
||||
virtual bool hasVertical() const;
|
||||
|
||||
/** Return the scale to apply on the glyph to have a charactere size equal to 1 */
|
||||
virtual float getScale() const { return _implementation->getScale(); };
|
||||
|
||||
/** Set the margin around each glyph,
|
||||
* to ensure that texture filtering doesn't bleed adjacent glyph's into each other.
|
||||
* Default margin is 1 texels.*/
|
||||
@@ -229,9 +226,6 @@ public:
|
||||
/** Return true if this font provides vertical alignments and spacing or glyphs.*/
|
||||
virtual bool hasVertical() const = 0;
|
||||
|
||||
/** Return scale of font, used by 3D text.*/
|
||||
virtual float getScale() const = 0;
|
||||
|
||||
void addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph* glyph)
|
||||
{
|
||||
_facade->addGlyph(fontRes, charcode, glyph);
|
||||
|
||||
@@ -206,7 +206,6 @@ FreeTypeFont::FreeTypeFont(const std::string& filename, FT_Face face, unsigned i
|
||||
_buffer(0),
|
||||
_face(face),
|
||||
_flags(flags),
|
||||
_scale(1.0f),
|
||||
_freetype_scale(1.0f)
|
||||
{
|
||||
init();
|
||||
@@ -218,7 +217,6 @@ FreeTypeFont::FreeTypeFont(FT_Byte* buffer, FT_Face face, unsigned int flags):
|
||||
_buffer(buffer),
|
||||
_face(face),
|
||||
_flags(flags),
|
||||
_scale(1.0f),
|
||||
_freetype_scale(1.0f)
|
||||
{
|
||||
init();
|
||||
@@ -303,14 +301,7 @@ void FreeTypeFont::init()
|
||||
// long xmin = ft_floor( bb.xMin );
|
||||
// long xmax = ft_ceiling( bb.xMax );
|
||||
// double width = (xmax - xmin)/64.0;
|
||||
|
||||
#if 1
|
||||
_freetype_scale = 1.0f/height;
|
||||
_scale = 1.0f;
|
||||
#else
|
||||
_freetype_scale = 1.0f;
|
||||
_scale = 1.0f/height;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,6 @@ public:
|
||||
|
||||
virtual bool hasVertical() const;
|
||||
|
||||
virtual float getScale() const { return _scale; }
|
||||
|
||||
protected:
|
||||
|
||||
void init();
|
||||
@@ -57,7 +55,6 @@ protected:
|
||||
FT_Byte* _buffer;
|
||||
FT_Face _face;
|
||||
unsigned int _flags;
|
||||
float _scale;
|
||||
float _freetype_scale;
|
||||
};
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ String::iterator Text3D::computeLastCharacterOnLine(osg::Vec2& cursor, String::i
|
||||
|
||||
String::iterator lastChar = first;
|
||||
|
||||
float maximumHeight = _maximumHeight / _font->getScale();
|
||||
float maximumWidth = _maximumWidth / _font->getScale();
|
||||
float maximumHeight = _maximumHeight;
|
||||
float maximumWidth = _maximumWidth;
|
||||
|
||||
for(bool outOfSpace=false;lastChar!=last;++lastChar)
|
||||
{
|
||||
@@ -443,13 +443,13 @@ void Text3D::computeGlyphRepresentation()
|
||||
case LEFT_TO_RIGHT:
|
||||
case RIGHT_TO_LEFT:
|
||||
{
|
||||
startOfLine_coords.y() -= (1.0 + _lineSpacing) / _font->getScale();
|
||||
startOfLine_coords.y() -= (1.0 + _lineSpacing);
|
||||
++_lineCount;
|
||||
break;
|
||||
}
|
||||
case VERTICAL:
|
||||
{
|
||||
startOfLine_coords.x() += _characterHeight / _font->getScale() / _characterAspectRatio * (1.0 + _lineSpacing);
|
||||
startOfLine_coords.x() += _characterHeight / _characterAspectRatio * (1.0 + _lineSpacing);
|
||||
// because _lineCount is the max vertical no. of characters....
|
||||
_lineCount = (_lineCount >linelength)?_lineCount:linelength;
|
||||
break;
|
||||
@@ -518,8 +518,7 @@ void Text3D::computePositions(unsigned int contextID) const
|
||||
osg::Matrix& matrix = atc._matrix;
|
||||
|
||||
|
||||
float scale = _font->getScale();
|
||||
osg::Vec3 scaleVec(scale * _characterHeight, scale * _characterHeight / _characterAspectRatio, scale * _characterHeight);
|
||||
osg::Vec3 scaleVec(_characterHeight, _characterHeight / _characterAspectRatio, _characterHeight);
|
||||
|
||||
matrix.makeTranslate(-_offset);
|
||||
matrix.postMultScale(scaleVec);
|
||||
|
||||
@@ -80,12 +80,7 @@ void Layout::layout(TextNode& text) const
|
||||
float characterHeightScale = 1.0f;
|
||||
|
||||
bool textIs3D = (style && style->getThicknessRatio()!=0.0);
|
||||
if (textIs3D)
|
||||
{
|
||||
characterWidthScale = font->getScale();
|
||||
characterHeightScale = font->getScale();
|
||||
}
|
||||
else
|
||||
if (!textIs3D)
|
||||
{
|
||||
characterWidthScale = 1.0f/static_cast<float>(resolution.first);
|
||||
characterHeightScale = 1.0f/static_cast<float>(resolution.second);
|
||||
@@ -116,10 +111,8 @@ void Layout::layout(TextNode& text) const
|
||||
if (glyph)
|
||||
{
|
||||
osg::Vec3 local_scale( size );
|
||||
local_scale *= (1.0f/font->getScale());
|
||||
|
||||
technique->addCharacter(pos, local_scale, glyph, style);
|
||||
pos += osg::Vec3(size.x()*(glyph->getHorizontalWidth()/font->getScale()), 0.0f ,0.0f);
|
||||
pos += osg::Vec3(size.x()*glyph->getHorizontalWidth(), 0.0f ,0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user