PNMTextMaker¶
-
class PNMTextMaker¶
Bases:
FreetypeFontThis 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 Acron render traversal.
Inheritance diagram
digraph inheritanced09c178447 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "FreetypeFont" [URL="acron.core.FreetypeFont.html#acron.core.FreetypeFont",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "Namable" -> "FreetypeFont" [arrowsize=0.75,style=""]; "Namable" [URL="acron.core.Namable.html#acron.core.Namable",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "Namable" [arrowsize=0.75,style=""]; "PNMTextMaker" [URL="acron.core.PNMTextMaker.html#acron.core.PNMTextMaker",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "FreetypeFont" -> "PNMTextMaker" [arrowsize=0.75,style=""]; }- PNMTextMaker.__init__()¶
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).
This constructor works as above, but it takes the font data from an in- memory buffer instead of from a named file.
- PNMTextMaker.calc_width()¶
Returns the width in pixels of the indicated line of text.
Returns the width in pixels of the indicated line of text.
- PNMTextMaker.generate_into()¶
Generates a single line of text into the indicated image at the indicated position; the return value is the total width in pixels.
Generates a single line of text into the indicated image at the indicated position; the return value is the total width in pixels.
- PNMTextMaker.get_align()¶
- PNMTextMaker.get_distance_field_radius()¶
Returns the radius previously set with
set_distance_field_radius, or 0 otherwise.
- PNMTextMaker.get_fg()¶
Returns the foreground color of text that will be generated by future calls to
generate_into().
- PNMTextMaker.get_glyph()¶
Returns the glyph for the indicated index, or NULL if it is not defined in the font.
- PNMTextMaker.get_interior()¶
Returns the color that will be used to render the interior portions of hollow fonts.
- PNMTextMaker.get_interior_flag()¶
- PNMTextMaker.is_valid()¶
Returns true if the
PNMTextMakeris valid and ready to generate text, false otherwise.
- PNMTextMaker.set_align()¶
- PNMTextMaker.set_distance_field_radius()¶
If this is set to something other than 0, Acron will generate a signed distance field with the given radius.
- PNMTextMaker.set_fg()¶
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.
- PNMTextMaker.set_interior()¶
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.
- PNMTextMaker.set_interior_flag()¶
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.