FreetypeFont
from panda3d.core import FreetypeFont
- class FreetypeFont
Bases:
Namable
This is a common base class for both DynamicTextFont and PNMTextMaker. Both of these are utility classes that use the FreeType library to generate glyphs from fonts; this class abstracts out that common wrapper around FreeType.
Inheritance diagram
- WODefault = 0
- WOInvalid = 3
- WOLeft = 1
- WORight = 2
- WO_default = 0
- WO_invalid = 3
- WO_left = 1
- WO_right = 2
- __init__(*args, **kwargs)
- getFontPixelSize()
C++ Interface: get_font_pixel_size(FreetypeFont self)
- /**
This is used to report whether the requested pixel size is being only
approximated by a fixed-pixel-size font. This returns 0 in the normal
case, in which a scalable font is used, or the fixed-pixel-size font has
exactly the requested pixel size.
If this returns non-zero, it is the pixel size of the font that we are
using to approximate our desired size.
*/
- getLineHeight()
C++ Interface: get_line_height(FreetypeFont self)
- /**
Returns the number of units high each line of text is.
*/
- getNativeAntialias()
C++ Interface: get_native_antialias(FreetypeFont self)
- /**
Returns whether Freetype’s built-in antialias mode is enabled. See
set_native_antialias().
*/
- getPixelSize()
C++ Interface: get_pixel_size(FreetypeFont self)
- /**
Returns the size of the font in pixels, as it appears in the texture.
*/
- getPixelsPerUnit()
C++ Interface: get_pixels_per_unit(FreetypeFont self)
- /**
Returns the resolution of the texture map. See set_pixels_per_unit().
*/
- getPointSize()
C++ Interface: get_point_size(FreetypeFont self)
- /**
Returns the point size of the font.
*/
- getPointsPerInch()
C++ Interface: get_points_per_inch()
- /**
Returns the number of points in one inch. This is a universal typographic
convention.
*/
- getPointsPerUnit()
C++ Interface: get_points_per_unit()
- /**
Returns the point size of the font that is one Panda unit high. This is an
arbitrary Panda convention for text, and is set to 10.0.
*/
- getScaleFactor()
C++ Interface: get_scale_factor(FreetypeFont self)
- /**
Returns the antialiasing scale factor. See set_scale_factor().
*/
- getSpaceAdvance()
C++ Interface: get_space_advance(FreetypeFont self)
- /**
Returns the number of units wide a space is.
*/
- getWindingOrder()
C++ Interface: get_winding_order(FreetypeFont self)
- /**
Returns the winding order set via set_winding_order().
*/
- get_font_pixel_size()
C++ Interface: get_font_pixel_size(FreetypeFont self)
- /**
This is used to report whether the requested pixel size is being only
approximated by a fixed-pixel-size font. This returns 0 in the normal
case, in which a scalable font is used, or the fixed-pixel-size font has
exactly the requested pixel size.
If this returns non-zero, it is the pixel size of the font that we are
using to approximate our desired size.
*/
- get_line_height()
C++ Interface: get_line_height(FreetypeFont self)
- /**
Returns the number of units high each line of text is.
*/
- get_native_antialias()
C++ Interface: get_native_antialias(FreetypeFont self)
- /**
Returns whether Freetype’s built-in antialias mode is enabled. See
set_native_antialias().
*/
- get_pixel_size()
C++ Interface: get_pixel_size(FreetypeFont self)
- /**
Returns the size of the font in pixels, as it appears in the texture.
*/
- get_pixels_per_unit()
C++ Interface: get_pixels_per_unit(FreetypeFont self)
- /**
Returns the resolution of the texture map. See set_pixels_per_unit().
*/
- get_point_size()
C++ Interface: get_point_size(FreetypeFont self)
- /**
Returns the point size of the font.
*/
- get_points_per_inch()
C++ Interface: get_points_per_inch()
- /**
Returns the number of points in one inch. This is a universal typographic
convention.
*/
- get_points_per_unit()
C++ Interface: get_points_per_unit()
- /**
Returns the point size of the font that is one Panda unit high. This is an
arbitrary Panda convention for text, and is set to 10.0.
*/
- get_scale_factor()
C++ Interface: get_scale_factor(FreetypeFont self)
- /**
Returns the antialiasing scale factor. See set_scale_factor().
*/
- get_space_advance()
C++ Interface: get_space_advance(FreetypeFont self)
- /**
Returns the number of units wide a space is.
*/
- get_winding_order()
C++ Interface: get_winding_order(FreetypeFont self)
- /**
Returns the winding order set via set_winding_order().
*/
- setNativeAntialias()
C++ Interface: set_native_antialias(const FreetypeFont self, bool native_antialias)
- /**
Sets whether the Freetype library’s built-in antialias mode is enabled.
There are two unrelated ways to achieve antialiasing: with Freetype’s
native antialias mode, and with the use of a scale_factor greater than one.
By default, both modes are enabled.
At low resolutions, some fonts may do better with one mode or the other.
In general, Freetype’s native antialiasing will produce less blurry
results, but may introduce more artifacts.
*/
- setPixelSize()
C++ Interface: set_pixel_size(const FreetypeFont self, float pixel_size)
- /**
Computes the appropriate pixels_per_unit value to set the size of the font
in the texture to the indicated number of pixels. This is just another way
to specify pixels_per_unit().
*/
- setPixelsPerUnit()
C++ Interface: set_pixels_per_unit(const FreetypeFont self, float pixels_per_unit)
- /**
Set the resolution of the texture map, and hence the clarity of the
resulting font. This sets the number of pixels in the texture map that are
used for each onscreen unit.
Setting this number larger results in an easier to read font, but at the
cost of more texture memory.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- setPointSize()
C++ Interface: set_point_size(const FreetypeFont self, float point_size)
- /**
Sets the point size of the font. This controls the apparent size of the
font onscreen. By convention, a 10 point font is about 1 screen unit high.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- setScaleFactor()
C++ Interface: set_scale_factor(const FreetypeFont self, float scale_factor)
- /**
Sets the factor by which the font is rendered larger by the FreeType
library before being filtered down to its actual size in the texture as
specified by set_pixels_per_unit(). This may be set to a number larger
than 1.0 to improve the font’s antialiasing (since FreeType doesn’t really
do a swell job of antialiasing by itself). There is some performance
implication for setting this different than 1.0.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- setWindingOrder()
C++ Interface: set_winding_order(const FreetypeFont self, int winding_order)
- /**
Specifies an explicitly winding order on this particular font. This is
only necessary if the render_mode is RM_polygon or RM_solid, and only if
FreeType appears to guess wrong on this font. Normally, you should leave
this at WO_default.
*/
- set_native_antialias()
C++ Interface: set_native_antialias(const FreetypeFont self, bool native_antialias)
- /**
Sets whether the Freetype library’s built-in antialias mode is enabled.
There are two unrelated ways to achieve antialiasing: with Freetype’s
native antialias mode, and with the use of a scale_factor greater than one.
By default, both modes are enabled.
At low resolutions, some fonts may do better with one mode or the other.
In general, Freetype’s native antialiasing will produce less blurry
results, but may introduce more artifacts.
*/
- set_pixel_size()
C++ Interface: set_pixel_size(const FreetypeFont self, float pixel_size)
- /**
Computes the appropriate pixels_per_unit value to set the size of the font
in the texture to the indicated number of pixels. This is just another way
to specify pixels_per_unit().
*/
- set_pixels_per_unit()
C++ Interface: set_pixels_per_unit(const FreetypeFont self, float pixels_per_unit)
- /**
Set the resolution of the texture map, and hence the clarity of the
resulting font. This sets the number of pixels in the texture map that are
used for each onscreen unit.
Setting this number larger results in an easier to read font, but at the
cost of more texture memory.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- set_point_size()
C++ Interface: set_point_size(const FreetypeFont self, float point_size)
- /**
Sets the point size of the font. This controls the apparent size of the
font onscreen. By convention, a 10 point font is about 1 screen unit high.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- set_scale_factor()
C++ Interface: set_scale_factor(const FreetypeFont self, float scale_factor)
- /**
Sets the factor by which the font is rendered larger by the FreeType
library before being filtered down to its actual size in the texture as
specified by set_pixels_per_unit(). This may be set to a number larger
than 1.0 to improve the font’s antialiasing (since FreeType doesn’t really
do a swell job of antialiasing by itself). There is some performance
implication for setting this different than 1.0.
This should only be called before any characters have been requested out of
the font, or immediately after calling clear().
*/
- set_winding_order()
C++ Interface: set_winding_order(const FreetypeFont self, int winding_order)
- /**
Specifies an explicitly winding order on this particular font. This is
only necessary if the render_mode is RM_polygon or RM_solid, and only if
FreeType appears to guess wrong on this font. Normally, you should leave
this at WO_default.
*/
- winding_order