Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TextGlyph Class Reference

A representation of a single glyph (character) from a font. More...

Inheritance diagram for TextGlyph:
TypedReferenceCount TypedObject ReferenceCount DynamicTextGlyph

Public Member Functions

float getAdvance ()
 Returns the distance by which the character pointer should be advanced after placing this character; i.e. More...
 
int getCharacter ()
 Returns the Unicode value that corresponds to the character this glyph represents. More...
 
Geom getGeom (GeomEnums::UsageHint usage_hint)
 Returns a Geom that renders the particular glyph. More...
 
bool getQuad (LVecBase4 dimensions, LVecBase4 texcoords)
 Assuming that this glyph is representable as a textured quad, returns its dimensions and UV range. More...
 
const RenderState getState ()
 Returns the state in which the glyph should be rendered. More...
 
bool hasQuad ()
 Returns true if this glyph contains the definition for a simple quad, rather than a more complex piece of geometry. More...
 
bool isWhitespace ()
 Returns true if this glyph represents invisible whitespace, or false if it corresponds to some visible character. More...
 
- Public Member Functions inherited from TypedObject
TypeHandle getType ()
 
int getTypeIndex ()
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool isExactType (TypeHandle handle)
 Returns true if the current object is the indicated type exactly. More...
 
bool isOfType (TypeHandle handle)
 Returns true if the current object is or derives from the indicated type. More...
 
- Public Member Functions inherited from ReferenceCount
int getRefCount ()
 Returns the current reference count. More...
 
 ref ()
 Explicitly increments the reference count. More...
 
bool testRefCountIntegrity ()
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool testRefCountNonzero ()
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
bool unref ()
 Explicitly decrements the reference count. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle getClassType ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle getClassType ()
 

Public Attributes

float advance
 Returns the distance by which the character pointer should be advanced after placing this character; i.e. More...
 
int character
 Returns the Unicode value that corresponds to the character this glyph represents. More...
 
const RenderState state
 Returns the state in which the glyph should be rendered. More...
 
- Public Attributes inherited from TypedObject
TypeHandle type
 Returns the TypeHandle representing this object's type. More...
 
- Public Attributes inherited from ReferenceCount
int ref_count
 The current reference count. More...
 

Detailed Description

A representation of a single glyph (character) from a font.

This is a piece of renderable geometry of some kind.

Member Function Documentation

◆ getAdvance()

float getAdvance ( )

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.

◆ getCharacter()

int getCharacter ( )

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

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getGeom()

Geom getGeom ( GeomEnums::UsageHint  usage_hint)

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.

◆ getQuad()

bool getQuad ( LVecBase4  dimensions,
LVecBase4  texcoords 
)

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.

◆ getState()

const RenderState getState ( )

Returns the state in which the glyph should be rendered.

◆ hasQuad()

bool hasQuad ( )

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.

◆ isWhitespace()

bool isWhitespace ( )

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

Member Data Documentation

◆ advance

float advance

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.

◆ character

int character

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

◆ state

const RenderState state

Returns the state in which the glyph should be rendered.