Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SmTextureFont::FontImage Class Reference

#include <SmTextureFont.h>

Inherits SbImage.

Public Member Functions

 FontImage (const SbVec2s glyphsize, const int leading, const int ascent, const int descent, const int numcomponents)
 
 ~FontImage ()
 
void addGlyph (unsigned char c, const SbImage &image, const int width, const int gfxwidth=-1, const int xoffset=0)
 
int getGlyphWidth (unsigned char c) const
 
void setKerning (unsigned char glyph, unsigned char next, int kerning)
 
int getKerning (unsigned char glyph, unsigned char next) const
 
int getXOffset (unsigned char glyph) const
 
SoGLImagegetGLImage (void) const
 
SbVec2s getGlyphPositionPixels (unsigned char c) const
 
const SbVec2sgetGlyphSizePixels () const
 
SbVec2f getGlyphPosition (unsigned char c) const
 
SbVec2f getGlyphSize (unsigned char c) const
 
int getLeading () const
 
int getAscent () const
 
int getDescent () const
 
int height () const
 
SbImage getGlyphImage (const unsigned char c) const
 
int stringWidth (const SbString &s) const
 
void renderString (const SbString &s, const SbVec3f &pos, const bool needglbeginend=true) const
 
- Public Member Functions inherited from SbImage
 SbImage (void)
 
 SbImage (const unsigned char *bytes, const SbVec2s &size, const int bytesperpixel)
 
 SbImage (const unsigned char *bytes, const SbVec3s &size, const int bytesperpixel)
 
 SbImage (const SbImage &image)
 
 ~SbImage ()
 
void setValue (const SbVec2s &size, const int bytesperpixel, const unsigned char *bytes)
 
void setValue (const SbVec3s &size, const int bytesperpixel, const unsigned char *bytes)
 
void setValuePtr (const SbVec2s &size, const int bytesperpixel, const unsigned char *bytes)
 
void setValuePtr (const SbVec3s &size, const int bytesperpixel, const unsigned char *bytes)
 
unsigned char * getValue (SbVec2s &size, int &bytesperpixel) const
 
unsigned char * getValue (SbVec3s &size, int &bytesperpixel) const
 
SbVec3s getSize (void) const
 
SbBool readFile (const SbString &filename, const SbString *const *searchdirectories=NULL, const int numdirectories=0)
 
int operator== (const SbImage &image) const
 
int operator!= (const SbImage &image) const
 
SbImageoperator= (const SbImage &image)
 
SbBool hasData (void) const
 
void readLock (void) const
 
void readUnlock (void) const
 
SbBool scheduleReadFile (SbImageScheduleReadCB *cb, void *closure, const SbString &filename, const SbString *const *searchdirectories=NULL, const int numdirectories=0)
 

Additional Inherited Members

- Static Public Member Functions inherited from SbImage
static void addReadImageCB (SbImageReadImageCB *cb, void *closure)
 
static void removeReadImageCB (SbImageReadImageCB *cb, void *closure)
 
static SbString searchForFile (const SbString &basename, const SbString *const *dirlist, const int numdirs)
 

Constructor & Destructor Documentation

◆ FontImage()

SmTextureFont::FontImage::FontImage ( const SbVec2s  glyphsize,
const int  leading,
const int  ascent,
const int  descent,
const int  numcomponents 
)

◆ ~FontImage()

SmTextureFont::FontImage::~FontImage ( )

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.

◆ getAscent()

int SmTextureFont::FontImage::getAscent ( ) const

◆ getDescent()

int SmTextureFont::FontImage::getDescent ( ) const

◆ 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.

◆ getGlyphPositionPixels()

SbVec2s SmTextureFont::FontImage::getGlyphPositionPixels ( unsigned char  c) const

◆ getGlyphSize()

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

Returns the size of the glyph, in texture coordinates.

◆ getGlyphSizePixels()

const SbVec2s & SmTextureFont::FontImage::getGlyphSizePixels ( ) const

◆ 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.

◆ getLeading()

int SmTextureFont::FontImage::getLeading ( ) const

◆ 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 postion 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: