Fixed handling of Font implementations that don't handle multiple font resolutions.

This commit is contained in:
Robert Osfield
2011-05-13 19:08:04 +00:00
parent 460f433ca7
commit fe1c75aa8a
10 changed files with 59 additions and 32 deletions

View File

@@ -30,16 +30,19 @@ public:
virtual std::string getFileName() const;
void setFontResolution(const osgText::FontResolution& fontSize);
virtual bool supportsMultipleFontResolutions() const { return true; }
virtual osgText::Glyph* getGlyph(const osgText::FontResolution& fontRes, unsigned int charcode);
virtual osgText::Glyph3D* getGlyph3D(unsigned int charcode) { return 0; }
virtual osg::Vec2 getKerning(unsigned int leftcharcode, unsigned int rightcharcode, osgText::KerningType kerningType);
virtual bool hasVertical() const;
protected:
std::string _filename;
osgText::FontResolution _currentRes;
QFont _font;
};

View File

@@ -161,13 +161,15 @@ public:
typedef OpenThreads::Mutex FontMutex;
typedef std::vector< osg::ref_ptr<GlyphTexture> > GlyphTextureList;
GlyphTextureList& getGlyphTextureList() { return _glyphTextureList; }
protected:
virtual ~Font();
void addGlyph(const FontResolution& fontRes, unsigned int charcode, Glyph* glyph);
typedef std::vector< osg::ref_ptr<GlyphTexture> > GlyphTextureList;
typedef std::vector< osg::ref_ptr<osg::StateSet> > StateSetList;
typedef std::map< unsigned int, osg::ref_ptr<Glyph> > GlyphMap;
typedef std::map< unsigned int, osg::ref_ptr<Glyph3D> > Glyph3DMap;
@@ -214,6 +216,8 @@ public:
virtual std::string getFileName() const = 0;
virtual bool supportsMultipleFontResolutions() const = 0;
/** Get a Glyph for specified charcode, and the font size nearest to the current font size hint.*/
virtual Glyph* getGlyph(const FontResolution& fontRes, unsigned int charcode) = 0;

View File

@@ -263,6 +263,9 @@ public:
/** Resize any per context GLObject buffers to specified size. */
virtual void resizeGLObjectBuffers(unsigned int maxSize);
/** create an image that maps all the associated Glyph's onto a single image, that is equivilant to what will be downloaded to the texture.*/
osg::Image* createImage();
protected:
virtual ~GlyphTexture();