Reorganised the managment of margins around glyphs so that is done entirely

with src/osgText/Font.cpp rather than the font plugins or Text.cpp
This commit is contained in:
Robert Osfield
2007-05-04 12:05:29 +00:00
parent 0ad6aae023
commit dadb92ea64
7 changed files with 176 additions and 45 deletions

View File

@@ -113,10 +113,17 @@ public:
/** Set the margin around each glyph,
* to ensure that texture filtering doesn't bleed adjacent glyph's into each other.
* Default margin is 2 texels.*/
* Default margin is 1 texels.*/
void setGlyphImageMargin(unsigned int margin);
unsigned int getGlyphImageMargin() const;
/** Set the margin ratio around each glyph, relative to the glyph's size.
* to ensure that texture filtering doesn't bleed adjacent glyph's into each other.
* Default margin is 0.05.*/
void setGlyphImageMarginRatio(float margin);
float getGlyphImageMarginRatio() 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.*/
void setTextureSizeHint(unsigned int width,unsigned int height);
@@ -176,6 +183,7 @@ protected:
unsigned int _width;
unsigned int _height;
unsigned int _margin;
float _marginRatio;
unsigned int _textureWidthHint;
unsigned int _textureHeightHint;
@@ -233,6 +241,9 @@ public:
void setGlyphImageMargin(unsigned int margin) { _margin = margin; }
unsigned int getGlyphImageMargin() const { return _margin; }
void setGlyphImageMarginRatio(float margin) { _marginRatio = margin; }
float getGlyphImageMarginRatio() const { return _marginRatio; }
bool getSpaceForGlyph(Glyph* glyph, int& posX, int& posY);
void addGlyph(Glyph* glyph,int posX, int posY);
@@ -252,6 +263,7 @@ public:
// parameter used to compute the size and position of empty space
// in the texture which could accomodate new glyphs.
int _margin;
float _marginRatio;
int _usedY;
int _partUsedX;
int _partUsedY;