Added setting of the charcode during construction of osgText::Font::Glyph()

This commit is contained in:
Robert Osfield 2010-01-14 15:15:42 +00:00
parent f53c3c1036
commit 8f6db66e59
6 changed files with 11 additions and 14 deletions

View File

@ -278,9 +278,9 @@ public:
{ {
public: public:
Glyph(); Glyph(unsigned int glyphCode);
unsigned int getGlyphCode() const; unsigned int getGlyphCode() const { return _glyphCode; }
void setHorizontalBearing(const osg::Vec2& bearing); void setHorizontalBearing(const osg::Vec2& bearing);
const osg::Vec2& getHorizontalBearing() const; const osg::Vec2& getHorizontalBearing() const;

View File

@ -135,7 +135,7 @@ osgText::Font::Glyph* FreeTypeFont::getGlyph(const osgText::FontResolution& font
unsigned int width = sourceWidth; unsigned int width = sourceWidth;
unsigned int height = sourceHeight; unsigned int height = sourceHeight;
osg::ref_ptr<osgText::Font::Glyph> glyph = new osgText::Font::Glyph; osg::ref_ptr<osgText::Font::Glyph> glyph = new osgText::Font::Glyph(charcode);
unsigned int dataSize = width*height; unsigned int dataSize = width*height;
unsigned char* data = new unsigned char[dataSize]; unsigned char* data = new unsigned char[dataSize];

View File

@ -230,7 +230,7 @@ TXFFont::loadFont(std::istream& stream)
continue; continue;
// add the characters ... // add the characters ...
osgText::Font::Glyph* glyph = new osgText::Font::Glyph; osgText::Font::Glyph* glyph = new osgText::Font::Glyph(glyphs[i].ch);
unsigned sourceWidth = glyphs[i].width; unsigned sourceWidth = glyphs[i].width;
unsigned sourceHeight = glyphs[i].height; unsigned sourceHeight = glyphs[i].height;
@ -271,7 +271,7 @@ TXFFont::loadFont(std::istream& stream)
} }
// insert a trivial blank character // insert a trivial blank character
osgText::Font::Glyph* glyph = new osgText::Font::Glyph; osgText::Font::Glyph* glyph = new osgText::Font::Glyph(' ');
unsigned width = 1; unsigned width = 1;
unsigned height = 1; unsigned height = 1;

View File

@ -205,7 +205,7 @@ void DefaultFont::constructGlyphs()
// populate the glyph mp // populate the glyph mp
for(unsigned int i=32;i<127;i++) for(unsigned int i=32;i<127;i++)
{ {
osg::ref_ptr<Glyph> glyph = new Glyph; osg::ref_ptr<Glyph> glyph = new Glyph(i);
unsigned int dataSize = sourceWidth*sourceHeight; unsigned int dataSize = sourceWidth*sourceHeight;
unsigned char* data = new unsigned char[dataSize]; unsigned char* data = new unsigned char[dataSize];

View File

@ -804,9 +804,9 @@ void Font::GlyphTexture::resizeGLObjectBuffers(unsigned int maxSize)
// all the methods in Font::Glyph have been made non inline because VisualStudio6.0 is STUPID, STUPID, STUPID PILE OF JUNK. // all the methods in Font::Glyph have been made non inline because VisualStudio6.0 is STUPID, STUPID, STUPID PILE OF JUNK.
Font::Glyph::Glyph(): Font::Glyph::Glyph(unsigned int glyphCode):
_font(0), _font(0),
_glyphCode(0), _glyphCode(glyphCode),
_horizontalBearing(0.0f,0.f), _horizontalBearing(0.0f,0.f),
_horizontalAdvance(0.f), _horizontalAdvance(0.f),
_verticalBearing(0.0f,0.f), _verticalBearing(0.0f,0.f),
@ -824,11 +824,6 @@ Font::Glyph::~Glyph()
{ {
} }
unsigned int Font::Glyph::getGlyphCode() const { return _glyphCode; }
// void Font::Glyph::setFont(Font* font) { _font = font; }
// Font* Font::Glyph::getFont() const { return _font; }
void Font::Glyph::setHorizontalBearing(const osg::Vec2& bearing) { _horizontalBearing=bearing; } void Font::Glyph::setHorizontalBearing(const osg::Vec2& bearing) { _horizontalBearing=bearing; }
const osg::Vec2& Font::Glyph::getHorizontalBearing() const { return _horizontalBearing; } const osg::Vec2& Font::Glyph::getHorizontalBearing() const { return _horizontalBearing; }

View File

@ -280,7 +280,9 @@ END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgText::Font::Glyph) BEGIN_OBJECT_REFLECTOR(osgText::Font::Glyph)
I_DeclaringFile("osgText/Font"); I_DeclaringFile("osgText/Font");
I_BaseType(osg::Image); I_BaseType(osg::Image);
I_Constructor0(____Glyph, I_Constructor1(IN, unsigned int, glyphCode,
Properties::NON_EXPLICIT,
____Glyph__unsigned_int,
"", "",
""); "");
I_Method0(unsigned int, getGlyphCode, I_Method0(unsigned int, getGlyphCode,