SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SmTextureFont::FontImage Class Reference
Inheritance diagram for SmTextureFont::FontImage:
SbImage

Public Member Functions

 FontImage (const SbVec2s glyphsize, const int leading, const int ascent, const int descent, const int numcomponents)
 
void addGlyph (unsigned char c, const SbImage &image, const int width, const int gfxwidth=-1, const int xoffset=0)
 
int getAscent () const
 
int getDescent () const
 
SoGLImagegetGLImage (void) const
 
SbImage getGlyphImage (const unsigned char c) const
 
SbVec2f getGlyphPosition (unsigned char c) const
 
SbVec2s getGlyphPositionPixels (unsigned char c) const
 
SbVec2f getGlyphSize (unsigned char c) const
 
const SbVec2s & getGlyphSizePixels () const
 
int getGlyphWidth (unsigned char c) const
 
int getKerning (unsigned char glyph, unsigned char next) const
 
int getLeading () const
 
int getXOffset (unsigned char glyph) const
 
int height () const
 
void renderString (const SbString &s, const SbVec3f &pos, const bool needglbeginend=true) const
 
void setKerning (unsigned char glyph, unsigned char next, int kerning)
 
int stringWidth (const SbString &s) const
 

Member Function Documentation

◆ addGlyph()

void SmTextureFont::FontImage::addGlyph ( unsigned char c,
const SbImage & image,
const int glyphwidth,
const int gfxglyphwidth = -1,
const int xoffset = 0 )

Adds the image for a glyph to the texture image. The size of the image must be smaller than the glyphsize provided in the constructor. glyphwidth is the number of pixels to advance before rendering the next character. gfxglyphwidth is the width of the glyph in the bitmap. If you supply a negative number in gfxglyphwidth, the width of the glyphs supplied in the constructor will be used instead.

xoffset is the offset used when rendering the glyph. This is useful for specifying glyphs that extend to the left of the glyph position.

◆ getGLImage()

SoGLImage * SmTextureFont::FontImage::getGLImage ( void ) const

Returns the SoGLImage instance for this font.

◆ getGlyphImage()

SbImage SmTextureFont::FontImage::getGlyphImage ( const unsigned char c) const

Returns the glyph image for c.

◆ getGlyphPosition()

SbVec2f SmTextureFont::FontImage::getGlyphPosition ( unsigned char c) const

Returns the lower left corner position of the glyph in texture coordinates.

◆ getGlyphSize()

SbVec2f SmTextureFont::FontImage::getGlyphSize ( unsigned char c) const

Returns the size of the glyph, in texture coordinates.

◆ getGlyphWidth()

int SmTextureFont::FontImage::getGlyphWidth ( unsigned char c) const

Returns the width of the glyph in the texture.

◆ getKerning()

int SmTextureFont::FontImage::getKerning ( unsigned char glyph,
unsigned char next ) const

Returns the kerning for glyph/next. If no kerning info exists for the pair, the width of the glyph is returned.

◆ getXOffset()

int SmTextureFont::FontImage::getXOffset ( unsigned char glyph) const

Returns the x offset for glyph.

◆ height()

int SmTextureFont::FontImage::height ( ) const

Returns the height of the font (ascent + descent + 1).

◆ renderString()

void SmTextureFont::FontImage::renderString ( const SbString & s,
const SbVec3f & pos,
const bool needglbeginend = true ) const

Convenience method to render s at position pos. This function assumed a coordinate system with 1 pixel == 1 unit is set up.

◆ setKerning()

void SmTextureFont::FontImage::setKerning ( unsigned char glyph,
unsigned char next,
int kerning )

Sets kerning for the glyph/next pair.

◆ stringWidth()

int SmTextureFont::FontImage::stringWidth ( const SbString & s) const

Convenience method that calculates the width (in pixels) for s.


The documentation for this class was generated from the following files: