Coin: SoGlyph Class Reference

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoGlyph Class Reference

The SoGlyph class is used to generate and reuse font glyph bitmaps and outlines. More...

`#include <Inventor/misc/SoGlyph.h>`

## Public Types
enum | Fonttype { FONT2D = 1 , FONT3D = 2 }

## Public Member Functions
void | unref (void) const
const SbVec2f * | getCoords (void) const
const int * | getFaceIndices (void) const
const int * | getEdgeIndices (void) const
const int * | getNextCWEdge (const int edgeidx) const
const int * | getNextCCWEdge (const int edgeidx) const
float | getWidth (void) const
const SbBox2f & | getBoundingBox (void) const
SbVec2s | getAdvance (void) const
SbVec2s | getKerning (const SoGlyph &rightglyph) const
unsigned char * | getBitmap (SbVec2s &size, SbVec2s &pos, const SbBool antialiased) const

## Static Public Member Functions
static const SoGlyph * | getGlyph (const char character, const SbName &font)
static const SoGlyph * | getGlyph (SoState *state, const unsigned int character, const SbVec2s &size, const float angle)

## Protected Member Functions
| SoGlyph (void)
| ~SoGlyph ()
void | setCoords (const SbVec2f *coords, int numcoords=-1)
void | setFaceIndices (const int *indices, int numindices=-1)
void | setEdgeIndices (const int *indices, int numindices=-1)

## Detailed Description

The SoGlyph class is used to generate and reuse font glyph bitmaps and outlines.

This class is now obsolete, and will be removed from a later version of Coin.

SoGlyph is the public interface all text nodes (both built-in and extensions) should use to generate bitmaps and outlines for font glyphs. It maintains an internal cache of previously requested glyphs to avoid needless calls into the font library.

Primer: a glyph is the graphical representation of a given character of a given font at a given size and orientation. It can be either a bitmap (pixel aligned with the viewport) or an outline (polygonal representation) that can be transformed or extruded like any other 3D geometry. Bitmaps are used by SoText2, while the other text nodes uses outlines.

Be aware that this class is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

Since
  Coin 2.0

See also
  SoText2, SoText3, SoAsciiText

## Constructor & Destructor Documentation

## ◆ SoGlyph()

SoGlyph::SoGlyph | ( | void |  | ) |
| protected

Constructor.

## ◆ ~SoGlyph()

SoGlyph::~SoGlyph | ( |  | ) |
| protected

Destructor.

## Member Function Documentation

## ◆ unref()

void SoGlyph::unref | ( | void |  | ) | const

Should be called when a node no longer will use a glyph. Will free memory used by this glyph when it is no longer used by any node.

## ◆ getGlyph() [1/2]

const SoGlyph * SoGlyph::getGlyph | ( | const char | character,
|  | const SbName & | font )
| static

Returns a character of the specified font, suitable for polygonal rendering.

## ◆ getCoords()

const SbVec2f * SoGlyph::getCoords | ( | void |  | ) | const

Returns coordinates for this glyph.

## ◆ getFaceIndices()

const int * SoGlyph::getFaceIndices | ( | void |  | ) | const

Returns face indices for this glyph.

## ◆ getEdgeIndices()

const int * SoGlyph::getEdgeIndices | ( | void |  | ) | const

Returns edge indices for this glyph.

## ◆ getNextCWEdge()

const int * SoGlyph::getNextCWEdge | ( | const int | edgeidx | ) | const

Returns a pointer to the next clockwise edge. Returns NULL if none could be found.

## ◆ getNextCCWEdge()

const int * SoGlyph::getNextCCWEdge | ( | const int | edgeidx | ) | const

Returns a pointer to the next counterclockwise edge. Returns NULL if none could be found.

## ◆ getWidth()

float SoGlyph::getWidth | ( | void |  | ) | const

Convenience method which returns the exact width of the glyph.

## ◆ getBoundingBox()

const SbBox2f & SoGlyph::getBoundingBox | ( | void |  | ) | const

Returns the bounding box of this glyph. This value is cached for performance.

## ◆ getGlyph() [2/2]

const SoGlyph * SoGlyph::getGlyph | ( | SoState * | state,
|  | const unsigned int | character,
|  | const SbVec2s & | size,
|  | const float | angle )
| static

Returns a character of the specified font, suitable for bitmap rendering. The size parameter overrides state's SoFontSizeElement (if != SbVec2s(0,0))

## ◆ getBitmap()

unsigned char * SoGlyph::getBitmap | ( | SbVec2s & | size,
|  | SbVec2s & | pos,
|  | const SbBool | antialiased ) const

Bitmap for glyph. size and pos are return parameters. Antialiased bitmap graphics are not yet supported.

Note that this function may return `NULL` if the glyph has no visible pixels (as for e.g. the space character).

The returned buffer should not be deallocated by the caller.

## ◆ setCoords()

void SoGlyph::setCoords | ( | const SbVec2f * | coords,
|  | int | numcoords = -1 )
| protected

Sets the coordinates for this glyph.

## ◆ setFaceIndices()

void SoGlyph::setFaceIndices | ( | const int * | indices,
|  | int | numindices = -1 )
| protected

Sets the face indices for this glyph.

## ◆ setEdgeIndices()

void SoGlyph::setEdgeIndices | ( | const int * | indices,
|  | int | numindices = -1 )
| protected

Sets the edge indices for this glyph.

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

- SoGlyph.h
- SoGlyph.cpp