15 #define OSGTEXT_FONT 1
21 #include <osgText/Glyph>
22 #include <osgDB/Options>
24 #include <OpenThreads/Mutex>
78 virtual const char*
className()
const {
return "Font"; }
81 virtual std::string getFileName()
const;
95 virtual osg::Vec2 getKerning(
unsigned int leftcharcode,
unsigned int rightcharcode,
KerningType kerningType);
102 virtual Glyph3D* getGlyph3D(
unsigned int charcode);
105 virtual bool hasVertical()
const;
109 virtual bool getVerticalSize(
float& ascender,
float& descender)
const {
return _implementation ? _implementation->getVerticalSize(ascender, descender) :
false; }
114 void setGlyphImageMargin(
unsigned int margin);
115 unsigned int getGlyphImageMargin()
const;
120 void setGlyphImageMarginRatio(
float margin);
121 float getGlyphImageMarginRatio()
const;
126 void setTextureSizeHint(
unsigned int width,
unsigned int height);
128 unsigned int getTextureWidthHint()
const;
129 unsigned int getTextureHeightHint()
const;
156 virtual void setThreadSafeRefUnref(
bool threadSafe);
159 virtual void resizeGLObjectBuffers(
unsigned int maxSize);
164 virtual void releaseGLObjects(
osg::State* state=0)
const;
178 typedef std::map< unsigned int, osg::ref_ptr<Glyph> >
GlyphMap;
179 typedef std::map< unsigned int, osg::ref_ptr<Glyph3D> >
Glyph3DMap;
218 osg::Referenced(true),
221 virtual std::string getFileName()
const = 0;
223 virtual bool supportsMultipleFontResolutions()
const = 0;
229 virtual Glyph3D* getGlyph3D(
unsigned int charcode) = 0;
232 virtual osg::Vec2 getKerning(
unsigned int leftcharcode,
unsigned int rightcharcode,
KerningType kerningType) = 0;
235 virtual bool hasVertical()
const = 0;
239 _facade->addGlyph(fontRes, charcode, glyph);
virtual bool isSameKindAs(const osg::Object *obj) const
std::pair< unsigned int, unsigned int > FontResolution
osg::Texture::FilterMode _minFilterHint
unsigned int getNumberCurveSamples() const
GlyphTextureList & getGlyphTextureList()
This class provides an object-oriented thread mutex interface.
osg::TexEnv * getTexEnv()
OSGTEXT_EXPORT osg::ref_ptr< Font > readRefFontStream(std::istream &stream, const osgDB::Options *userOptions=0)
osg::ref_ptr< osg::TexEnv > _texenv
virtual const char * className() const
std::vector< osg::ref_ptr< GlyphTexture > > GlyphTextureList
osg::StateSet * getStateSet()
osg::ref_ptr< osg::StateSet > _stateset
unsigned int _textureWidthHint
FontSizeGlyphMap _sizeGlyphMap
virtual const char * libraryName() const
unsigned int getFontDepth() const
GLint GLenum GLsizei width
virtual osg::Object * cloneType() const
const osg::StateSet * getStateSet() const
OSGTEXT_EXPORT Font * readFontFile(const std::string &filename, const osgDB::Options *userOptions=0)
void setTexEnv(osg::TexEnv *texenv)
const osg::TexEnv * getTexEnv() const
unsigned int _textureHeightHint
void setStateSet(osg::StateSet *stateset)
unsigned int _numCurveSamples
virtual bool getVerticalSize(float &ascender, float &descender) const
GLint GLenum GLsizei GLsizei height
std::map< unsigned int, osg::ref_ptr< Glyph3D > > Glyph3DMap
std::vector< osg::ref_ptr< osg::StateSet > > StateSetList
GlyphTextureList _glyphTextureList
OpenThreads::Mutex _glyphMapMutex
void addGlyph(const FontResolution &fontRes, unsigned int charcode, Glyph *glyph)
virtual osg::Object * clone(const osg::CopyOp &) const
OSGTEXT_EXPORT Font * readFontStream(std::istream &stream, const osgDB::Options *userOptions=0)
void setNumberCurveSamples(unsigned int numSamples)
OpenThreads::Mutex FontMutex
std::map< unsigned int, osg::ref_ptr< Glyph > > GlyphMap
OSGTEXT_EXPORT osg::ref_ptr< Font > readRefFontFile(const std::string &filename, const osgDB::Options *userOptions=0)
osg::ref_ptr< FontImplementation > _implementation
osg::Texture::FilterMode _magFilterHint
std::map< FontResolution, GlyphMap > FontSizeGlyphMap
virtual bool getVerticalSize(float &, float &) const
OSGTEXT_EXPORT std::string findFontFile(const std::string &str)