Bases: object
Create a new FT2Font object.
The source of the font data in a format (ttf or ttc) that FreeType can read
Must be positive. Used to scale the hinting in the x-direction
A list of FT2Font objects used to find missing glyphs.
Warning
This API is both private and provisional: do not use it directly
Used to adjust the degree of kerning.
Warning
This API is private: do not use it directly
Number of faces in file.
Face and style flags; see the ft2font constants.
Number of glyphs in the face.
Face family and style name.
Number of bitmap in the face.
Whether face is scalable; attributes after this one are only defined for scalable faces.
Face global bounding box (xmin, ymin, xmax, ymax).
Number of font units covered by the EM.
Ascender and descender in 26.6 units.
Height in 26.6 units; used to compute a default line spacing (baseline-to-baseline distance).
Maximum horizontal and vertical cursor advance for all glyphs.
Vertical position and thickness of the underline bar.
PostScript name of the font.
Clear all the glyphs, reset for a new call to set_text.
Draw a single glyph to the bitmap at pixel locations x, y Note it is your responsibility to set up the bitmap manually with set_bitmap_size(w, h) before this call is made.
If you want automatic layout, use set_text in combinations with draw_glyphs_to_bitmap. This function is instead intended for people who want to render individual glyphs (e.g., returned by load_char) at precise locations.
Draw the glyphs that were loaded by set_text to the bitmap. The bitmap size will be automatically set to include the glyphs.
Get the (x, y) offset in 26.6 subpixels for the bitmap if ink hangs left or below (0, 0). Since Matplotlib only supports left-to-right text, y is always 0.
Return the glyph index corresponding to a character codepoint.
Return a dict that maps the character codes of the selected charmap (Unicode by default) to their corresponding glyph indices.
Get the descent in 26.6 subpixels of the current string set by set_text. The rotation of the string is accounted for. To get the descent in pixels, divide this value by 64.
Retrieve the ASCII name of a given glyph index in a face.
Due to Matplotlib's internal design, for fonts that do not contain glyph names (per FT_FACE_FLAG_GLYPH_NAMES), this returns a made-up name which does not roundtrip through get_name_index.
Return the underlying image buffer for this font object.
Get the kerning between left and right glyph indices. mode is a kerning mode constant:
Return the glyph index of a given glyph name. The glyph index 0 means 'undefined character code'.
Return the number of loaded glyphs.
Get the path data from the currently loaded glyph as a tuple of vertices, codes.
Return the information in the PS Font Info structure.
Load the entire SFNT names table, as a dict whose keys are (platform-ID, ISO-encoding-scheme, language-code, and description) tuples.
Return one of the following SFNT tables: head, maxp, OS/2, hhea, vhea, post, or pclt.
Get the width and height in 26.6 subpixels of the current string set by set_text. The rotation of the string is accounted for. To get width and height in pixels, divide these values by 64.
Get the xy locations of the current glyphs.
Deprecated since version 3.8.
Load character with charcode in current fontfile and set glyph. flags can be a bitwise-or of the LOAD_XXX constants; the default value is LOAD_FORCE_AUTOHINT. Return value is a Glyph object, with attributes
Load character with glyphindex in current fontfile and set glyph. flags can be a bitwise-or of the LOAD_XXX constants; the default value is LOAD_FORCE_AUTOHINT. Return value is a Glyph object, with attributes
Select a charmap by its FT_Encoding number.
Make the i-th charmap current.
Set the point size and dpi of the text.
Set the text string and angle. flags can be a bitwise-or of the LOAD_XXX constants; the default value is LOAD_FORCE_AUTOHINT. You must call this before draw_glyphs_to_bitmap. A sequence of x,y positions is returned.
Bases: object
Draw an empty rectangle to the image.
Deprecated since version 3.8.
Draw a filled rectangle to the image.
© 2012–2023 Matplotlib Development Team. All rights reserved.
Licensed under the Matplotlib License Agreement.
https://matplotlib.org/stable/api/ft2font.html