| [ Web Proxy ] |
| Viewing: https://matplotlib.org/stable/api/_as_gen/../../devel/MEP/../../api/toolkits/../ft2font.html | [Back] [Original] |
matplotlib.ft2font#Bases:
An object representing a single font face.
Outside of the font itself and querying its properties, this object provides methods for processing text strings into glyph shapes.
Commonly, one will use FT2Font.set_text to load some glyph metrics and outlines.
Then FT2Font.draw_glyphs_to_bitmap and FT2Font.get_image may be used to get a
rendered form of the loaded string.
For single characters, FT2Font.load_char or FT2Font.load_glyph may be used,
either directly for their return values, or to use FT2Font.draw_glyph_to_bitmap or
FT2Font.get_path.
Useful metrics may be examined via the Glyph return values or
FT2Font.get_kerning. Most dimensions are given in 26.6 or 16.6 fixed-point
integers representing subpixels. Divide these values by 64 to produce floating-point
pixels.
The source of the font data in a format (ttf or ttc) that FreeType can read.
The index of the face in the font file to load.
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 trigger missing glyph warnings.
Warning
This API is private: do not use it directly.
Ascender in 26.6 units.
Face global bounding box (xmin, ymin, xmax, ymax).
Clear all the glyphs, reset for a new call to set_text.
Descender in 26.6 units.
Draw a single glyph to the bitmap at pixel locations x, y.
Note it is your responsibility to create the image manually with the correct size 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.
The image buffer on which to draw the glyph.
The position of the glyph's top left corner.
The glyph to draw.
Whether to render glyphs 8-bit antialiased or in pure black-and-white.
See also
Draw the glyphs that were loaded by set_text to the bitmap.
The bitmap size will be automatically set to include the glyphs.
Whether to render glyphs 8-bit antialiased or in pure black-and-white.
See also
The index of the font in the file.
Face family name.
The original filename for this object.
Get the (x, y) offset for the bitmap if ink hangs left or below (0, 0).
Since Matplotlib only supports left-to-right text, y is always 0.
The x and y offset in 26.6 subpixels of the bitmap. To get x and y in pixels, divide these values by 64.
See also
Return the glyph index corresponding to a character code point.
A character code point in the current charmap (which defaults to Unicode.)
Whether to enable fallback fonts while searching for a character.
The corresponding glyph index.
Return a mapping of character codes to glyph indices in the font.
The charmap is Unicode by default, but may be changed by set_charmap or
select_charmap.
A dictionary of the selected charmap mapping character codes to their corresponding glyph indices.
Get the descent of the current string set by set_text.
The rotation of the string is accounted for.
The descent in 26.6 subpixels of the bitmap. To get the descent in pixels, divide these values by 64.
See also
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.
The glyph number to query.
The name of the glyph, or if the font does not contain names, a name synthesized by Matplotlib.
See also
Return the underlying image buffer for this font object.
See also
Get the kerning between two glyphs.
The glyph indices. Note these are not characters nor character codes.
Use get_char_index to convert character codes to glyph indices.
A kerning mode constant:
DEFAULT - Return scaled and grid-fitted kerning distances.
UNFITTED - Return scaled but un-grid-fitted kerning distances.
UNSCALED - Return the kerning vector in original font units.
Changed in version 3.10: This now takes a ft2font.Kerning value instead of an int.
The kerning adjustment between the two glyphs.
Return the glyph index of a given glyph name.
The name of the glyph to query.
The corresponding glyph index; 0 means 'undefined character code'.
See also
Return the number of loaded glyphs.
Get the path data from the currently loaded glyph.
The (N, 2) array of vertices describing the current glyph.
The (N, ) array of codes corresponding to the vertices.
See also
Return the information in the PS Font Info structure.
For more information, see the FreeType documentation on this structure.
Load the entire SFNT names table.
The SFNT names table; the dictionary keys are tuples of:
(platform-ID, ISO-encoding-scheme, language-code, description)
and the values are the direct information from the font table.
Return one of the SFNT tables.
Which table to return.
The corresponding table; for more information, see the FreeType documentation.
Get the dimensions of the current string set by set_text.
The rotation of the string is accounted for.
The width and height in 26.6 subpixels of the current string. To get width and height in pixels, divide these values by 64.
See also
Height in 26.6 units; used to compute a default line spacing (baseline-to-baseline distance).
Load character in current fontfile and set glyph.
The character code to prepare rendering information for. This code must be in
the charmap, or else a .notdef glyph may be returned instead.
LoadFlags.FORCE_AUTOHINTAny bitwise-OR combination of the LoadFlags flags.
Changed in version 3.10: This now takes an ft2font.LoadFlags instead of an int.
The glyph information corresponding to the specified character.
See also
Load glyph index in current fontfile and set glyph.
Note that the glyph index is specific to a font, and not universal like a Unicode code point.
The glyph index to prepare rendering information for.
LoadFlags.FORCE_AUTOHINTAny bitwise-OR combination of the LoadFlags flags.
Changed in version 3.10: This now takes an ft2font.LoadFlags instead of an int.
The glyph information corresponding to the specified index.
See also
Maximum vertical cursor advance for all glyphs.
Maximum horizontal cursor advance for all glyphs.
Number of charmaps in the face.
Number of faces in file.
Number of bitmap in the face.
Number of glyphs in the face.
Number of named instances in the face.
PostScript name of the font.
Whether face is scalable; attributes after this one are only defined for scalable faces.
Select a charmap by its FT_Encoding number.
For more details on character mapping, see the FreeType documentation.
The charmap in the form defined by FreeType: https://freetype.org/freetype2/docs/reference/ft2-character_mapping.html#ft_encoding
See also
Make the i-th charmap current.
For more details on character mapping, see the FreeType documentation.
The charmap number in the range [0, num_charmaps).
See also
Set the size of the text.
The size of the text in points.
The DPI used for rendering the text.
Set the text string and angle.
You must call this before draw_glyphs_to_bitmap.
The text to prepare rendering information for.
The angle at which to render the supplied text.
LoadFlags.FORCE_AUTOHINTAny bitwise-OR combination of the LoadFlags flags.
Changed in version 3.10: This now takes an ft2font.LoadFlags instead of an int.
The font feature tags to use for the font.
Available font feature tags may be found at https://learn.microsoft.com/en-us/typography/opentype/spec/featurelist
Added in version 3.11.
A sequence of x,y glyph positions in 26.6 subpixels; divide by 64 for pixels.
Style flags; see StyleFlags.
Style name.
Vertical position of the underline bar.
Thickness of the underline bar.
Number of font units covered by the EM.
Bases:
An image buffer for drawing glyphs.
The dimensions of the image buffer.
Draw a filled rectangle to the image.
The bounds of the rectangle from (x0, y0) to (x1, y1).
Bases: Flag
Flags returned by FT2Font.face_flags.
For more information, see the FreeType documentation.
Added in version 3.10.
Bases:
Information about a single glyph.
You cannot create instances of this object yourself, but must use
FT2Font.load_char or FT2Font.load_glyph to generate one. This object may be
used in a call to FT2Font.draw_glyph_to_bitmap.
For more information on the various metrics, see the FreeType documentation.
The control box of the glyph.
The glyph's height.
Advance width for horizontal layout.
Left side bearing for horizontal layout.
Top side bearing for horizontal layout.
The advance width of the unhinted glyph.
Advance height for vertical layout.
Left side bearing for vertical layout.
Top side bearing for vertical layout.
The glyph's width.
Bases: Enum
Kerning modes for FT2Font.get_kerning.
For more information, see the FreeType documentation.
Added in version 3.10.
Bases:
The character code for the item.
The FT_Face of the item.
The glyph index for the item.
The kerning between this item and the previous one.
The x position of the item.
The y position of the item.
Bases: Flag
Flags for FT2Font.load_char, FT2Font.load_glyph, and FT2Font.set_text.
For more information, see the FreeType documentation.
Added in version 3.10.
Bases: Enum
Render modes.
For more information, see the FreeType documentation.
Added in version 3.10.
Bases: Flag
Flags returned by FT2Font.style_flags.
For more information, see the FreeType documentation.
Added in version 3.10.
| Web Proxy Viewer | New URL | Original Page |