Functions

font_get_coverage(font: Font, language: Language) Coverage

Gets the PangoCoverage for a PangoFT2Font.

Use get_coverage instead.

Parameters:
  • font – a Pango FT2 font

  • language – a language tag.

Returns:

a PangoCoverage

font_get_kerning(font: Font, left: int, right: int) int

Retrieves kerning information for a combination of two glyphs.

Use kern_glyphs() instead.

Parameters:
  • font – a PangoFont

  • left – the left PangoGlyph

  • right – the right PangoGlyph

Returns:

The amount of kerning (in Pango units) to apply for the given combination of glyphs.

get_unknown_glyph(font: Font) int

Return the index of a glyph suitable for drawing unknown characters with font, or %PANGO_GLYPH_EMPTY if no suitable glyph found.

If you want to draw an unknown-box for a character that is not covered by the font, use GET_UNKNOWN_GLYPH() instead.

Parameters:

font – a PangoFont

Returns:

a glyph index into font, or %PANGO_GLYPH_EMPTY

render(bitmap: Bitmap, font: Font, glyphs: GlyphString, x: int, y: int) None

Renders a PangoGlyphString onto a FreeType2 bitmap.

Parameters:
  • bitmap – the FreeType2 bitmap onto which to draw the string

  • font – the font in which to draw the string

  • glyphs – the glyph string to draw

  • x – the x position of the start of the string (in pixels)

  • y – the y position of the baseline (in pixels)

render_layout(bitmap: Bitmap, layout: Layout, x: int, y: int) None

Render a PangoLayout onto a FreeType2 bitmap

Parameters:
  • bitmap – a FT_Bitmap to render the layout onto

  • layout – a PangoLayout

  • x – the X position of the left of the layout (in pixels)

  • y – the Y position of the top of the layout (in pixels)

render_layout_line(bitmap: Bitmap, line: LayoutLine, x: int, y: int) None

Render a PangoLayoutLine onto a FreeType2 bitmap

Parameters:
  • bitmap – a FT_Bitmap to render the line onto

  • line – a PangoLayoutLine

  • x – the x position of start of string (in pixels)

  • y – the y position of baseline (in pixels)

render_layout_line_subpixel(bitmap: Bitmap, line: LayoutLine, x: int, y: int) None

Render a PangoLayoutLine onto a FreeType2 bitmap, with he location specified in fixed-point Pango units rather than pixels.

(Using this will avoid extra inaccuracies from rounding to integer pixels multiple times, even if the final glyph positions are integers.)

Added in version 1.6.

Parameters:
  • bitmap – a FT_Bitmap to render the line onto

  • line – a PangoLayoutLine

  • x – the x position of start of string (in Pango units)

  • y – the y position of baseline (in Pango units)

render_layout_subpixel(bitmap: Bitmap, layout: Layout, x: int, y: int) None

Render a PangoLayout onto a FreeType2 bitmap, with he location specified in fixed-point Pango units rather than pixels.

(Using this will avoid extra inaccuracies from rounding to integer pixels multiple times, even if the final glyph positions are integers.)

Added in version 1.6.

Parameters:
  • bitmap – a FT_Bitmap to render the layout onto

  • layout – a PangoLayout

  • x – the X position of the left of the layout (in Pango units)

  • y – the Y position of the top of the layout (in Pango units)

render_transformed(bitmap: Bitmap, matrix: Matrix | None, font: Font, glyphs: GlyphString, x: int, y: int) None

Renders a PangoGlyphString onto a FreeType2 bitmap, possibly transforming the layed-out coordinates through a transformation matrix.

Note that the transformation matrix for font is not changed, so to produce correct rendering results, the font must have been loaded using a PangoContext with an identical transformation matrix to that passed in to this function.

Added in version 1.6.

Parameters:
  • bitmap – the FreeType2 bitmap onto which to draw the string

  • matrix – a PangoMatrix

  • font – the font in which to draw the string

  • glyphs – the glyph string to draw

  • x – the x position of the start of the string (in Pango units in user space coordinates)

  • y – the y position of the baseline (in Pango units in user space coordinates)

shutdown_display() None

Free the global fontmap. (See for_display()) Use of the global PangoFT2 fontmap is deprecated.