TextGlyph

class TextGlyph

Bases: TypedReferenceCount

A representation of a single glyph (character) from a font. This is a piece of renderable geometry of some kind.

Inheritance diagram

Inheritance diagram of TextGlyph

PN_stdfloat get_advance(void) const

Returns the distance by which the character pointer should be advanced after placing this character; i.e. the approximate width the character takes up on the line.

int get_character(void) const

Returns the Unicode value that corresponds to the character this glyph represents.

static TypeHandle get_class_type(void)
PointerTo<Geom> get_geom(GeomEnums::UsageHint usage_hint) const

Returns a Geom that renders the particular glyph. It will be generated if necessary.

This method will always return a copy of the Geom, so the caller is free to modify it.

bool get_quad(LVecBase4 &dimensions, LVecBase4 &texcoords) const

Assuming that this glyph is representable as a textured quad, returns its dimensions and UV range. Returns false if it is not representable as a quad, or if it is whitespace.

The order of the components is left, bottom, right, top.

RenderState const *get_state(void) const

Returns the state in which the glyph should be rendered.

bool has_quad(void) const

Returns true if this glyph contains the definition for a simple quad, rather than a more complex piece of geometry.

You may still call get_geom() even if this returns true, which will synthesize a Geom for this quad.

virtual bool is_whitespace(void) const

Returns true if this glyph represents invisible whitespace, or false if it corresponds to some visible character.