From Romain Ouabdelkader, "This is a fix for osgText to calculate kerning and to load glyph3D with the text's font resolution.
Font::getKerning(...), Font::getGlyph3D(...) doesn't ask for a font resolution so it uses the last font resolution requested by Font:: getGlyph(...). This can leads to different results depending of the precedent call to Font::getGlyph(...). See http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/2016-January/271952.html for more infos. This fix adds a font resolution parameter to Font::getKerning(...), Font::getGlyph3D(...) and to the font implementations. This was made under the base revision r15182."
This commit is contained in:
@@ -93,15 +93,15 @@ public:
|
||||
const osg::StateSet* getStateSet() const { return _stateset.get(); }
|
||||
|
||||
|
||||
/** Get a kerning (adjustment of spacing of two adjacent character) for specified charcodes, w.r.t the current font size hint.*/
|
||||
virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType);
|
||||
/** Get a kerning (adjustment of spacing of two adjacent character) for specified charcodes and a font resolution.*/
|
||||
virtual osg::Vec2 getKerning(const FontResolution& fontRes, unsigned int leftcharcode, unsigned int rightcharcode, KerningType kerningType);
|
||||
|
||||
/** Get a Glyph for specified charcode, and the font size nearest to the current font size hint.*/
|
||||
virtual Glyph* getGlyph(const FontResolution& fontSize, unsigned int charcode);
|
||||
|
||||
|
||||
/** Get a Glyph3D for specified charcode.*/
|
||||
virtual Glyph3D* getGlyph3D(unsigned int charcode);
|
||||
/** Get a Glyph3D for specified charcode and a font size.*/
|
||||
virtual Glyph3D* getGlyph3D(const FontResolution& fontSize, unsigned int charcode);
|
||||
|
||||
/** Return true if this font provides vertical alignments and spacing or glyphs.*/
|
||||
virtual bool hasVertical() const;
|
||||
@@ -181,6 +181,7 @@ protected:
|
||||
typedef std::map< unsigned int, osg::ref_ptr<Glyph3D> > Glyph3DMap;
|
||||
|
||||
typedef std::map< FontResolution, GlyphMap > FontSizeGlyphMap;
|
||||
typedef std::map< FontResolution, Glyph3DMap > FontSizeGlyph3DMap;
|
||||
|
||||
mutable OpenThreads::Mutex _glyphMapMutex;
|
||||
|
||||
@@ -190,7 +191,7 @@ protected:
|
||||
GlyphTextureList _glyphTextureList;
|
||||
|
||||
|
||||
Glyph3DMap _glyph3DMap;
|
||||
FontSizeGlyph3DMap _sizeGlyph3DMap;
|
||||
|
||||
// current active size of font
|
||||
FontResolution _fontSize;
|
||||
@@ -228,10 +229,10 @@ public:
|
||||
virtual Glyph* getGlyph(const FontResolution& fontRes, unsigned int charcode) = 0;
|
||||
|
||||
/** Get a Glyph3D for specified charcode.*/
|
||||
virtual Glyph3D* getGlyph3D(unsigned int charcode) = 0;
|
||||
virtual Glyph3D* getGlyph3D(const FontResolution& fontRes, unsigned int charcode) = 0;
|
||||
|
||||
/** Get a kerning (adjustment of spacing of two adjacent character) for specified charcodes, w.r.t the current font size hint.*/
|
||||
virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, KerningType kerningType) = 0;
|
||||
virtual osg::Vec2 getKerning(const FontResolution& fontRes, unsigned int leftcharcode, unsigned int rightcharcode, KerningType kerningType) = 0;
|
||||
|
||||
/** Return true if this font provides vertical alignments and spacing or glyphs.*/
|
||||
virtual bool hasVertical() const = 0;
|
||||
|
||||
Reference in New Issue
Block a user