panda3d.core.TextFont

class TextFont

Bases: TypedReferenceCount, Namable

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.

Inheritance diagram

Inheritance diagram of TextFont

makeCopy() → TextFont
Return type

TextFont

isValid() → bool

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

getLineHeight() → float

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

setLineHeight(line_height: float) → None

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

getSpaceAdvance() → float

Returns the number of units wide a space is.

setSpaceAdvance(space_advance: float) → None

Changes the number of units wide a space is.

getGlyph(character: int) → TextGlyph

Gets the glyph associated with the given character code, as well as an optional scaling parameter that should be applied to the glyph’s geometry and advance parameters. Returns the glyph on success. On failure, it may still return a printable glyph, or it may return NULL.

Return type

TextGlyph

getKerning(first: int, second: int) → float

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.

write(out: ostream, indent_level: int) → None
static getClassType() → TypeHandle
Return type

TypeHandle

property valid

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

Return type

bool

property line_height
Getter

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

Setter

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

Return type

float

property space_advance
Getter

Returns the number of units wide a space is.

Setter

Changes the number of units wide a space is.

Return type

float

enum RenderMode
enumerator RM_texture = 0

Each glyph is a single textured rectangle

enumerator RM_wireframe = 1

Each glyph is a lot of line segments

enumerator RM_polygon = 2

Each glyph is a lot of triangles

enumerator RM_extruded = 3

a 3-D outline, like a cookie cutter

enumerator RM_solid = 4

combination of RM_extruded and RM_polygon

enumerator RM_distance_field = 5
enumerator RM_invalid = 6

Returned by string_render_mode() for an invalid match.