Added osgText::Font::s/getGlyphInterval(int) and GlyphTexture::s/getGlyphInterval(int) and internal support for clmapping positions of glyph images an defined intervals, defaults to 1.

This commit is contained in:
Robert Osfield
2017-08-30 16:21:03 +01:00
parent 7323bb776b
commit 1289c4ee41
4 changed files with 27 additions and 9 deletions

View File

@@ -122,6 +122,11 @@ public:
void setGlyphImageMarginRatio(float margin);
float getGlyphImageMarginRatio() const;
/** Set the interval that glyph positions are clamped to.
* Default interval is 1 texels.*/
void setGlyphInterval(int interval);
int getGlyphInterval() const;
/** Set the size of texture to create to store the glyph images when rendering.
* Note, this doesn't affect already created Texture Glhph's.*/
@@ -197,6 +202,7 @@ protected:
FontResolution _fontSize;
unsigned int _margin;
float _marginRatio;
int _glyphInterval;
unsigned int _textureWidthHint;
unsigned int _textureHeightHint;

View File

@@ -260,6 +260,9 @@ public:
void setGlyphImageMarginRatio(float margin) { _marginRatio = margin; }
float getGlyphImageMarginRatio() const { return _marginRatio; }
void setGlyphInterval(int interval) { _interval = interval; }
int getGlyphInterval() const { return _interval; }
bool getSpaceForGlyph(Glyph* glyph, int& posX, int& posY);
void addGlyph(Glyph* glyph,int posX, int posY);
@@ -282,6 +285,8 @@ protected:
// in the texture which could accommodate new glyphs.
int _margin;
float _marginRatio;
int _interval;
int _usedY;
int _partUsedX;
int _partUsedY;