Added support for controlling the number of curves samples to generate on Glyph3D's. Set via Font3D::setNumberCurveSamples(num).

This commit is contained in:
Robert Osfield 2010-08-25 11:06:10 +00:00
parent 6049f67a48
commit fd1493e14b
4 changed files with 11 additions and 6 deletions

View File

@ -87,6 +87,9 @@ public:
unsigned int getFontHeight() const { return _height; }
unsigned int getFontDepth() const { return _depth; }
void setNumberCurveSamples(unsigned int numSamples) { _numCurveSamples = numSamples; }
unsigned int getNumberCurveSamples() const { return _numCurveSamples; }
/** 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);
@ -123,6 +126,9 @@ protected:
unsigned int _depth;
unsigned int _width;
unsigned int _height;
unsigned int _numCurveSamples;
// unsigned int _margin;
// float _marginRatio;

View File

@ -39,7 +39,7 @@ namespace
struct Char3DInfo
{
Char3DInfo(int numSteps=50):
Char3DInfo(int numSteps):
_verts( new osg::Vec3Array ),
_geometry( new osg::Geometry ),
_idx(0),
@ -243,7 +243,7 @@ void FreeTypeFont3D::init()
}
{
Char3DInfo char3d;
Char3DInfo char3d(10);
FT_Outline outline = _face->glyph->outline;
FT_Outline_Funcs funcs;
@ -344,7 +344,7 @@ osgText::Font3D::Glyph3D * FreeTypeFont3D::getGlyph(unsigned int charcode)
}
// ** init FreeType to describe the glyph
Char3DInfo char3d;
Char3DInfo char3d(_facade->getNumberCurveSamples());
FT_Outline outline = _face->glyph->outline;
FT_Outline_Funcs funcs;

View File

@ -29,8 +29,6 @@ public:
virtual std::string getFileName() const { return _filename; }
// virtual void setFontResolution(unsigned int width, unsigned int height, unsigned int depth);
virtual osgText::Font3D::Glyph3D * getGlyph(unsigned int charcode);
virtual osg::Vec2 getKerning(unsigned int leftcharcode,unsigned int rightcharcode, osgText::KerningType _kerningType);

View File

@ -243,7 +243,8 @@ Font3D::Font3D(Font3DImplementation* implementation):
osg::Object(true),
_depth(1),
_width(64),
_height(64)
_height(64),
_numCurveSamples(10)
{
setImplementation(implementation);
}