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

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

#include "textGlyph.h"

Inheritance diagram for TextGlyph:
TypedReferenceCount TypedObject ReferenceCount MemoryBase MemoryBase

Public Member Functions

 TextGlyph (int character, PN_stdfloat advance=0)
 This constructor makes an empty glyph. More...
 
 TextGlyph (int character, const Geom *geom, const RenderState *state, PN_stdfloat advance)
 
 TextGlyph (const TextGlyph &copy)
 
void calc_tight_bounds (LPoint3 &min_point, LPoint3 &max_point, bool &found_any, Thread *current_thread) const
 
virtual TypeHandle force_init_type ()
 
PN_stdfloat get_advance () const
 
int get_character () const
 
bool get_quad (LVecBase4 &dimensions, LVecBase4 &texcoords) const
 Assuming that this glyph is representable as a textured quad, returns its dimensions and UV range. More...
 
const RenderStateget_state () const
 
virtual TypeHandle get_type () const
 
bool has_quad () const
 Returns true if this glyph contains the definition for a simple quad, rather than a more complex piece of geometry. More...
 
virtual bool is_whitespace () const
 Returns true if this glyph represents invisible whitespace, or false if it corresponds to some visible character. More...
 
void operator= (const TextGlyph &copy)
 
void set_geom (GeomVertexData *vdata, GeomPrimitive *prim, const RenderState *state)
 Sets the geom from a pre-built Geom object. More...
 
void set_quad (const LVecBase4 &dimensions, const LVecBase4 &texcoords, const RenderState *state)
 
- Public Member Functions inherited from TypedReferenceCount
 TypedReferenceCount (const TypedReferenceCount &copy)
 
void operator= (const TypedReferenceCount &copy)
 
- Public Member Functions inherited from TypedObject
 TypedObject (const TypedObject &copy)=default
 
TypedObjectas_typed_object ()
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
const TypedObjectas_typed_object () const
 Returns the object, upcast (if necessary) to a TypedObject pointer. More...
 
int get_best_parent_from_Set (const std::set< int > &) const
 
int get_type_index () const
 Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More...
 
bool is_exact_type (TypeHandle handle) const
 Returns true if the current object is the indicated type exactly. More...
 
bool is_of_type (TypeHandle handle) const
 Returns true if the current object is or derives from the indicated type. More...
 
TypedObjectoperator= (const TypedObject &copy)=default
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 

Static Public Member Functions

static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from TypedObject
static TypeHandle get_class_type ()
 
static void init_type ()
 This function is declared non-inline to work around a compiler bug in g++ 2.96. More...
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 

Public Attributes

 get_advance
 Returns the distance by which the character pointer should be advanced after placing this character; i.e. More...
 
 get_character
 Returns the Unicode value that corresponds to the character this glyph represents. More...
 
 get_state
 Returns the state in which the glyph should be rendered. More...
 
- Public Attributes inherited from TypedObject
 get_type
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Friends

class GeomTextGlyph
 

Detailed Description

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

This is a piece of renderable geometry of some kind.

Definition at line 28 of file textGlyph.h.

Constructor & Destructor Documentation

◆ TextGlyph()

TextGlyph::TextGlyph ( int  character,
PN_stdfloat  advance = 0 
)
inline

This constructor makes an empty glyph.

Definition at line 18 of file textGlyph.I.

Member Function Documentation

◆ get_quad()

bool TextGlyph::get_quad ( LVecBase4 &  dimensions,
LVecBase4 &  texcoords 
) const
inline

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.

Definition at line 104 of file textGlyph.I.

◆ has_quad()

bool TextGlyph::has_quad ( ) const
inline

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.

Definition at line 92 of file textGlyph.I.

◆ is_whitespace()

bool TextGlyph::is_whitespace ( ) const
virtual

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

Definition at line 37 of file textGlyph.cxx.

◆ set_geom()

void TextGlyph::set_geom ( GeomVertexData vdata,
GeomPrimitive prim,
const RenderState state 
)

Sets the geom from a pre-built Geom object.

Any quad parameters assigned will be cleared.

Definition at line 119 of file textGlyph.cxx.

References PT().

Member Data Documentation

◆ get_advance

PN_stdfloat TextGlyph::get_advance
inline

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.

Definition at line 46 of file textGlyph.h.

◆ get_character

int TextGlyph::get_character
inline

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

Definition at line 44 of file textGlyph.h.

◆ get_state

const RenderState * TextGlyph::get_state
inline

Returns the state in which the glyph should be rendered.

Definition at line 45 of file textGlyph.h.


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