Freetypy API documentation¶
The API closely follows the FreeType API. It is not 100% complete, but it does contain the functionality that most would need.
Names have been modified to follow Python’s PEP8 style guidelines.
Where appropriate, extra API functions have been added to make working with FreeType more Pythonic. These methods are marked with the ⨎ in the documentation.
Face¶
Face |
Models a given typeface, in a given style. |
Size |
A Face object at a given size. |
Size_Metrics |
The metrics of a size object. |
FACE_FLAG |
Bit flags for important metadata about a Face . |
STYLE_FLAG |
Bit flags indicating the style of a Face . |
LOAD |
Indicates what to load for a glyph. |
SIZE_REQUEST_TYPE |
Modes for selecting the size of a bitmap Face . |
FSTYPE |
Bit flags indicating the embedding and subsetting restrictions of a Face . |
KERNING |
Kerning modes. |
Layout¶
⨎ Freetypy includes a very basic layout algorithm for left-to-right text. For more serious usage, one should use a real layout engine, such as Pango.
Layout |
⨎ Manages very simple layout of left-to-right text. |
Subset¶
⨎ Freetypy includes support for subsetting TrueType and OpenType fonts.
subset.subset_font (input_fd, output_fd, ...) |
Subset a SFNT-style (TrueType or OpenType) font. |
Glyph¶
Glyph |
Information pertaining to a single glyph. |
Glyph_Metrics |
Models the metrics of a single Glyph . |
GLYPH_BBOX |
Indicates how the values of Glyph.get_cbox are returned. |
GLYPH_FORMAT |
Describes the format of a given glyph image. |
SubGlyph |
A description of a given subglyph. |
SUBGLYPH_FLAG |
Describes subglyphs. |
Bitmap¶
Bitmap |
Describes a bitmap raster. |
Bitmap_Size |
The metrics of a bitmap strike in a bitmap Face . |
PIXEL_MODE |
Constants related to the pixel mode of Bitmap . |
RENDER_MODE |
Selects a Bitmap renderer. |
Outline¶
Outline |
Represents an outline. |
OUTLINE |
Bit flags to characterize an Outline . |
ORIENTATION |
Specifies how an Outline is oriented. |
CODES |
Codes returned by Outline.to_points_and_codes : |
CharMap¶
CharMap |
A mapping from code points to glyph identifiers. |
ENCODING |
A tag identifying a CharMap type. |
TrueType information¶
SfntName |
An SFNT ‘name’ table entry. |
SfntNames |
A sequence of SFNT names in a Face . |
TT_Header |
TrueType header. |
TT_HoriHeader |
TrueType horizontal header (‘hhea’). |
TT_VertHeader |
TrueType vertical header (‘vhea’). |
TT_OS2 |
Inf about the TrueType font, used on OS/2 and Microsoft Windows. |
TT_Pclt |
TrueType PCLT table. |
TT_Postscript |
TrueType PostScript table. |
TT_PLATFORM |
Platform identifier codes. |
TT_APPLE_ID |
Apple-specific encoding values. |
TT_ISO_ID |
Standard ISO encodings. |
TT_MAC_ID |
Macintosh-specific encoding values. |
TT_MAC_LANGID |
Language identifier. |
TT_MS_ID |
Microsoft-specific encoding values. |
TT_MS_LANGID |
Language identifier. |
TT_ADOBE_ID |
Adobe-specific encoding values. |
TT_NAME_ID |
The type of value stored in a SfntName record. |
TT_MAC_STYLE |
Bit flags for the style of the face. |
TT_HEADER_FLAGS |
⨎ Bit flags for global information about a Face . |
TT_WIDTH_CLASS |
⨎ Width values for the TT_OS2.width_class property. |
TT_WEIGHT_CLASS |
⨎ Weight values for the TT_OS2.weight_class property. |
TT_FS_SELECTION |
Bit flag for font style. |
LCD Filtering¶
set_lcd_filter |
Apply color filtering to LCD decimated bitmaps. |
set_lcd_filter_weights |
Enable LCD filter with custom weights. |