Unified more of the 2D and 3D text setup, fixed bugs in Text3D setup
which address the problems of black 3D text and the kerning causing problems with font positioning.
This commit is contained in:
@@ -49,6 +49,12 @@ public:
|
||||
|
||||
unsigned int getGlyphCode() const { return _glyphCode; }
|
||||
|
||||
void setWidth(float width) { _width = width; }
|
||||
float getWidth() const { return _width; }
|
||||
|
||||
void setHeight(float height) { _height = height; }
|
||||
float getHeight() const { return _height; }
|
||||
|
||||
void setHorizontalBearing(const osg::Vec2& bearing);
|
||||
const osg::Vec2& getHorizontalBearing() const;
|
||||
|
||||
@@ -84,6 +90,9 @@ protected:
|
||||
Font* _font;
|
||||
unsigned int _glyphCode;
|
||||
|
||||
float _width;
|
||||
float _height;
|
||||
|
||||
osg::Vec2 _horizontalBearing;
|
||||
float _horizontalAdvance;
|
||||
|
||||
@@ -159,6 +168,12 @@ public:
|
||||
|
||||
unsigned int getGlyphCode() const { return _glyphCode; }
|
||||
|
||||
void setWidth(float width) { _width = width; }
|
||||
float getWidth() const { return _width; }
|
||||
|
||||
void setHeight(float height) { _height = height; }
|
||||
float getHeight() const { return _height; }
|
||||
|
||||
void setHorizontalBearing(const osg::Vec2& bearing) { _horizontalBearing=bearing; }
|
||||
const osg::Vec2 & getHorizontalBearing() const { return _horizontalBearing; }
|
||||
|
||||
@@ -187,18 +202,6 @@ public:
|
||||
osg::Geometry::PrimitiveSetList & getRawFacePrimitiveSetList() { return _rawFacePrimitiveSetList; }
|
||||
const osg::Geometry::PrimitiveSetList & getRawFacePrimitiveSetList() const { return _rawFacePrimitiveSetList; }
|
||||
|
||||
|
||||
float getHorizontalWidth() const { return (-_horizontalBearing.x() + _horizontalAdvance); }
|
||||
float getHorizontalHeight() const { return (-_horizontalBearing.y() + _bb.yMax()); }
|
||||
float getVerticalWidth() const { return (-_verticalBearing.x() + _bb.xMax()); }
|
||||
float getVerticalHeight() const { return (-_verticalBearing.y() + _verticalAdvance); }
|
||||
|
||||
void setWidth(float width) { _width = width; }
|
||||
float getWidth() const { return _width; }
|
||||
|
||||
void setHeight(float height) { _height = height; }
|
||||
float getHeight() const { return _height; }
|
||||
|
||||
GlyphGeometry* getGlyphGeometry(const Style* style);
|
||||
|
||||
protected:
|
||||
@@ -208,6 +211,9 @@ protected:
|
||||
Font* _font;
|
||||
unsigned int _glyphCode;
|
||||
|
||||
float _width;
|
||||
float _height;
|
||||
|
||||
osg::Vec2 _horizontalBearing;
|
||||
float _horizontalAdvance;
|
||||
|
||||
@@ -217,8 +223,6 @@ protected:
|
||||
osg::BoundingBox _bb;
|
||||
// osg::Vec2 _advance;
|
||||
|
||||
float _width;
|
||||
float _height;
|
||||
|
||||
osg::ref_ptr<osg::Vec3Array> _rawVertexArray;
|
||||
osg::Geometry::PrimitiveSetList _rawFacePrimitiveSetList;
|
||||
|
||||
@@ -37,6 +37,15 @@ public:
|
||||
virtual const char* className() const { return "Text"; }
|
||||
virtual const char* libraryName() const { return "osgText"; }
|
||||
|
||||
virtual void setFont(Font* font=0) { setFont(osg::ref_ptr<Font>(font)); };
|
||||
|
||||
/** Set the Font to use to render the text.*/
|
||||
virtual void setFont(osg::ref_ptr<Font> font);
|
||||
|
||||
/** Set the font, loaded from the specified front file, to use to render the text,
|
||||
* setFont("") sets the use of the default font.
|
||||
* See the osgText::readFontFile function for how the font file will be located. */
|
||||
virtual void setFont(const std::string& fontfile) { TextBase::setFont(fontfile); }
|
||||
|
||||
/**
|
||||
* Turns off writing to the depth buffer when rendering text. This only affects text
|
||||
|
||||
@@ -41,15 +41,15 @@ public:
|
||||
|
||||
/** Set the Font to use to render the text.
|
||||
* setFont(0) sets the use of the default font.*/
|
||||
inline void setFont(Font* font=0) { setFont(osg::ref_ptr<Font>(font)); };
|
||||
virtual void setFont(Font* font=0) { setFont(osg::ref_ptr<Font>(font)); };
|
||||
|
||||
/** Set the Font to use to render the text.*/
|
||||
void setFont(osg::ref_ptr<Font> font);
|
||||
virtual void setFont(osg::ref_ptr<Font> font);
|
||||
|
||||
/** Set the font, loaded from the specified front file, to use to render the text,
|
||||
* setFont("") sets the use of the default font.
|
||||
* See the osgText::readFontFile function for how the font file will be located. */
|
||||
void setFont(const std::string& fontfile);
|
||||
virtual void setFont(const std::string& fontfile);
|
||||
|
||||
/** Get the font. Return 0 if default is being used.*/
|
||||
const Font* getFont() const { return _font.get(); }
|
||||
|
||||
Reference in New Issue
Block a user