Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
TextFont Class Referenceabstract

An encapsulation of a font; i.e. More...

`#include "textFont.h"`

Inheritance diagram for TextFont:

## Public Types
enum | RenderMode { RM_texture , RM_wireframe , RM_polygon , RM_extruded , RM_solid , RM_distance_field , RM_invalid }

## Public Member Functions
| TextFont (const TextFont &copy)
| CPT (TextGlyph) get_glyph(int character)
virtual TypeHandle | force_init_type ()
virtual bool | get_glyph (int character, CPT(TextGlyph) &glyph)=0
TextGlyph * | get_invalid_glyph ()
| Returns a special glyph that can be used as a placeholder for any character not in the font.
virtual PN_stdfloat | get_kerning (int first, int second) const
| Returns the amount by which to offset the second glyph when it directly follows the first glyph.
PN_stdfloat | get_line_height () const
PN_stdfloat | get_space_advance () const
PN_stdfloat | get_total_poly_margin () const
| Returns the total margin between the edge of the glyph and the edge of the cards.
virtual TypeHandle | get_type () const
bool | is_valid () const
| operator bool () const
| Returns true if the font is valid and ready to use, false otherwise.
virtual | PT (TextFont) make_copy() const =0
void | set_line_height (PN_stdfloat line_height)
void | set_space_advance (PN_stdfloat space_advance)
virtual void | write (std::ostream &out, int indent_level) const
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
TypedObject * | as_typed_object ()
| Returns the object, upcast (if necessary) to a TypedObject pointer.
const TypedObject * | as_typed_object () const
| Returns the object, upcast (if necessary) to a TypedObject pointer.
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.
bool | is_exact_type (TypeHandle handle) const
| Returns true if the current object is the indicated type exactly.
bool | is_of_type (TypeHandle handle) const
| Returns true if the current object is or derives from the indicated type.
TypedObject & | operator= (const TypedObject &copy)=default
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from Namable
| Namable (const std::string &initial_name="")
void | clear_name ()
| Resets the Namable's name to empty.
const std::string & | get_name () const
bool | has_name () const
| Returns true if the Namable has a nonempty name set, false if the name is empty.
void | output (std::ostream &out) const
| Outputs the Namable.
void | set_name (const std::string &name)

## Static Public Member Functions
static TypeHandle | get_class_type ()
static void | init_type ()
static RenderMode | string_render_mode (const std::string &string)
| Returns the RenderMode value associated with the given string representation, or RM_invalid if the string does not match any known RenderMode value.
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.
Static Public Member Functions inherited from ReferenceCount
static TypeHandle | get_class_type ()
static void | init_type ()
Static Public Member Functions inherited from Namable
static TypeHandle | get_class_type ()
static void | init_type ()

## Public Attributes
| get_line_height
| Returns the number of units high each line of text is.
| get_space_advance
| Returns the number of units wide a space is.
| is_valid
| Returns true if the font is valid and ready to use, false otherwise.
| set_line_height
| Changes the number of units high each line of text is.
| set_space_advance
| Changes the number of units wide a space is.
Public Attributes inherited from TypedObject
| get_type
Public Attributes inherited from ReferenceCount
| get_ref_count
| Returns the current reference count.
Public Attributes inherited from Namable
| get_name
| set_name

## Detailed Description

An encapsulation of a font; i.e.

a set of glyphs that may be assembled together by a TextNode to represent a string of text.

This is just an abstract interface; see StaticTextFont or DynamicTextFont for an actual implementation.

Definition at line 32 of file textFont.h.

## Member Enumeration Documentation

## ◆ RenderMode

enum TextFont::RenderMode

Definition at line 40 of file textFont.h.

## Constructor & Destructor Documentation

## ◆ TextFont() [1/2]

TextFont::TextFont | ( |  | ) |

Definition at line 33 of file textFont.cxx.

## ◆ TextFont() [2/2]

TextFont::TextFont | ( | const TextFont & | copy | ) |

Definition at line 44 of file textFont.cxx.

## ◆ ~TextFont()

TextFont::~TextFont | ( |  | ) |
| virtual

Definition at line 57 of file textFont.cxx.

## Member Function Documentation

## ◆ force_init_type()

virtual TypeHandle TextFont::force_init_type | ( |  | ) |
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 111 of file textFont.h.

## ◆ get_class_type()

static TypeHandle TextFont::get_class_type | ( |  | ) |
| inline static

Definition at line 100 of file textFont.h.

## ◆ get_invalid_glyph()

TextGlyph * TextFont::get_invalid_glyph | ( |  | ) |

Returns a special glyph that can be used as a placeholder for any character not in the font.

Note that it is not guaranteed that a font will return this particular glyph for a missing character (it may return a glyph of its own devising instead).

Also note that even if a particular accented letter is missing from the font, Panda may still be able to render a suitable replacement by composing different glyphs together to simulate accent marks; this happens automatically behind the scenes.

Definition at line 91 of file textFont.cxx.

## ◆ get_kerning()

PN_stdfloat TextFont::get_kerning | ( | int | first,
|  | int | second ) const
| virtual

Returns the amount by which to offset the second glyph when it directly follows the first glyph.

This is an additional offset that is added on top of the advance.

Definition at line 66 of file textFont.cxx.

## ◆ get_total_poly_margin()

PN_stdfloat TextFont::get_total_poly_margin | ( |  | ) | const
| inline

Returns the total margin between the edge of the glyph and the edge of the cards.

This includes _poly_margin and any additional outline.

Definition at line 66 of file textFont.I.

## ◆ get_type()

virtual TypeHandle TextFont::get_type | ( |  | ) | const
| inline virtual

Reimplemented from TypedReferenceCount.

Definition at line 108 of file textFont.h.

## ◆ init_type()

static void TextFont::init_type | ( |  | ) |
| inline static

Definition at line 103 of file textFont.h.

## ◆ operator bool()

TextFont::operator bool | ( |  | ) | const
| inline

Returns true if the font is valid and ready to use, false otherwise.

Definition at line 25 of file textFont.I.

References is_valid.

## ◆ string_render_mode()

TextFont::RenderMode TextFont::string_render_mode | ( | const std::string & | string | ) |
| static

Returns the RenderMode value associated with the given string representation, or RM_invalid if the string does not match any known RenderMode value.

Definition at line 104 of file textFont.cxx.

## ◆ write()

void TextFont::write | ( | std::ostream & | out,
|  | int | indent_level ) const
| virtual

Definition at line 74 of file textFont.cxx.

## Member Data Documentation

## ◆ get_line_height

PN_stdfloat TextFont::get_line_height
| inline

Returns the number of units high each line of text is.

Definition at line 69 of file textFont.h.

Referenced by TextNode::get_line_height().

## ◆ get_space_advance

PN_stdfloat TextFont::get_space_advance
| inline

Returns the number of units wide a space is.

Definition at line 73 of file textFont.h.

Referenced by TextAssembler::calc_width().

## ◆ is_valid

bool TextFont::is_valid
| inline

Returns true if the font is valid and ready to use, false otherwise.

Definition at line 68 of file textFont.h.

Referenced by operator bool().

## ◆ set_line_height

void TextFont::set_line_height
| inline

Changes the number of units high each line of text is.

Definition at line 69 of file textFont.h.

## ◆ set_space_advance

void TextFont::set_space_advance
| inline

Changes the number of units wide a space is.

Definition at line 73 of file textFont.h.

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

- panda/src/text/textFont.h
- panda/src/text/textFont.cxx
- panda/src/text/textFont.I