Font#
PangoFcFont
is a base class for font implementations
using the Fontconfig and FreeType libraries.
It is used in onjunction with FontMap
.
When deriving from this class, you need to implement all
of its virtual functions other than shutdown() along with
the get_glyph_extents() virtual function from PangoFont
.
Methods#
- class Font
- description_from_pattern(pattern: Pattern, include_size: bool) FontDescription #
Creates a
PangoFontDescription
that matches the specified Fontconfig pattern as closely as possible.Many possible Fontconfig pattern values, such as
%FC_RASTERIZER
or%FC_DPI
, don’t make sense in the context ofPangoFontDescription
, so will be ignored.Added in version 1.4.
- Parameters:
pattern – a
FcPattern
include_size – if
True
, the pattern will include the size from thepattern
; otherwise the resulting pattern will be unsized. (only%FC_SIZE
is examined, not%FC_PIXEL_SIZE
)
- get_glyph(wc: str) int #
Gets the glyph index for a given Unicode character for
font
.If you only want to determine whether the font has the glyph, use
has_char
.Added in version 1.4.
- Parameters:
wc – Unicode character to look up
- get_languages() list[Language] | None #
Returns the languages that are supported by
font
.This corresponds to the FC_LANG member of the FcPattern.
The returned array is only valid as long as the font and its fontmap are valid.
Added in version 1.48.
Deprecated since version 1.50: Use pango_font_get_language()
- get_unknown_glyph(wc: str) int #
Returns the index of a glyph suitable for drawing
wc
as an unknown character.Use
GET_UNKNOWN_GLYPH()
instead.Added in version 1.4.
- Parameters:
wc – the Unicode character for which a glyph is needed.
- has_char(wc: str) bool #
Determines whether
font
has a glyph for the codepointwc
.Added in version 1.4.
Deprecated since version 1.44: Use
has_char
- Parameters:
wc – Unicode codepoint to look up
- kern_glyphs(glyphs: GlyphString) None #
This function used to adjust each adjacent pair of glyphs in
glyphs
according to kerning information infont
.Since 1.44, it does nothing.
Added in version 1.4.
Deprecated since version 1.32: Please do not use it in newly written code
- Parameters:
glyphs – a
PangoGlyphString