PNMTextMaker
from panda3d.core import PNMTextMaker
- class PNMTextMaker
Bases:
Bases:
FreetypeFont
This object uses the Freetype library to generate text directly into an image. It is different from the TextNode/DynamicTextFont interface, which use the Freetype library to generate text in the scene graph, to be rendered onscreen via the Panda render traversal.
Inheritance diagram
- __init__(font_filename: Filename, face_index: int)
The constructor expects the name of some font file that FreeType can read, along with face_index, indicating which font within the file to load (usually 0).
- __init__(copy: FreetypeFont)
- __init__(copy: PNMTextMaker)
- __init__(font_data: str, data_length: int, face_index: int)
This constructor works as above, but it takes the font data from an in- memory buffer instead of from a named file.
- generate_into(text: str, dest_image: PNMImage, x: int, y: int) int
Generates a single line of text into the indicated image at the indicated position; the return value is the total width in pixels.
- generate_into(text: str, dest_image: PNMImage, x: int, y: int) int
Generates a single line of text into the indicated image at the indicated position; the return value is the total width in pixels.
- get_align() Alignment
- get_distance_field_radius() int
Returns the radius previously set with
set_distance_field_radius()
, or 0 otherwise.
- get_fg() LColor
Returns the foreground color of text that will be generated by future calls to
generate_into()
.
- get_glyph(character: int) PNMTextGlyph
Returns the glyph for the indicated index, or NULL if it is not defined in the font.
- get_interior() LColor
Returns the color that will be used to render the interior portions of hollow fonts.
- is_valid() bool
Returns true if the
PNMTextMaker
is valid and ready to generate text, false otherwise.
- set_align(align_type: Alignment)
- set_distance_field_radius(radius: int)
If this is set to something other than 0, Panda will generate a signed distance field with the given radius.
- set_fg(fg: LColor)
Sets the foreground color of text that will be generated by future calls to
generate_into()
. This is the color that all of the “on” pixels in the font will show as.
- set_interior(interior: LColor)
Sets the color that will be used to render the interior portions of hollow fonts in future calls to
generate_into()
. This is respected only if interior_flag is true.
- set_interior_flag(interior_flag: bool)
Sets the flag that indicates whether the interior of hollow fonts is identified as a preprocess as each glyph is loaded. If this flag is true, you may specify an interior color along with a fg and bg color when you place text; if the flag is false, the interior color is ignored.
It is generally best to set_native_antialias(0) when using this feature. Also, this works best when the pixel size is not very small.