Basics
Guides
API Reference
Basics
Guides
API Reference
[16:7] extends: object
PangoRenderer is a base class for objects that can render text provided as
PangoGlyphString or PangoLayout. By subclassing PangoRenderer and
overriding operations such as @draw_glyphs and @draw_rectangle, renderers for
particular font backends and destinations can be created.
Renderer (Handle = null)
Creates a new
Rendererby wrapping a native handle or another wrapper.
Handle is the native handle or another wrapper whose handle to adopt.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
Object.
A Object object.activate ()
Does initial setup before rendering operations on @renderer. [method@Pango.Renderer.deactivate] should be called when done drawing. Calls such as [method@Pango.Renderer.draw_layout] automatically activate the layout before drawing on it. Calls to [method@Pango.Renderer.activate] and [method@Pango.Renderer.deactivate] can be nested and the renderer will only be initialized and deinitialized once.
None.deactivate ()
Cleans up after rendering operations on @renderer. See docs for [method@Pango.Renderer.activate].
None.draw_error_underline (int x, int y, int width, int height)
Draw a squiggly line that approximately covers the given rectangle in the style of an underline used to indicate a spelling error. The width of the underline is rounded to an integer number of up/down segments and the resulting rectangle is centered in the original rectangle. This should be called while @renderer is already active. Use [method@Pango.Renderer.activate] to activate a renderer.
x is X coordinate of underline, in Pango units in user coordinate system.y is Y coordinate of underline, in Pango units in user coordinate system.width is width of underline, in Pango units in user coordinate system.height is height of underline, in Pango units in user coordinate system.None.draw_glyph_item (string text, object glyph_item, int x, int y)
Draws the glyphs in @glyph_item with the specified
PangoRenderer, embedding the text associated with the glyphs in the output if the output format supports it. This is useful for rendering text in PDF. Note that this method does not handle attributes in @glyph_item. If you want colors, shapes and lines handled automatically according to those attributes, you need to use pango_renderer_draw_layout_line() or pango_renderer_draw_layout(). Note that @text is the start of the text for layout, which is then indexed byglyph_item->item->offset. If @text is %NULL, this simply calls [method@Pango.Renderer.draw_glyphs]. The default implementation of this method simply falls back to [method@Pango.Renderer.draw_glyphs].
text is the UTF-8 text that @glyph_item refers to.glyph_item is a PangoGlyphItem.x is X position of left edge of baseline, in user space coordinates in Pango units.y is Y position of left edge of baseline, in user space coordinates in Pango units.None.draw_glyphs (object font, object glyphs, int x, int y)
Draws the glyphs in @glyphs with the specified
PangoRenderer.
font is a PangoFont.glyphs is a PangoGlyphString.x is X position of left edge of baseline, in user space coordinates in Pango units..y is Y position of left edge of baseline, in user space coordinates in Pango units..None.draw_layout (object layout, int x, int y)
Draws @layout with the specified
PangoRenderer. This is equivalent to drawing the lines of the layout, at their respective positions relative to @x, @y.
layout is a PangoLayout.x is X position of left edge of baseline, in user space coordinates in Pango units..y is Y position of left edge of baseline, in user space coordinates in Pango units..None.draw_layout_line (object line, int x, int y)
Draws @line with the specified
PangoRenderer. This draws the glyph items that make up the line, as well as shapes, backgrounds and lines that are specified by the attributes of those items.
line is a PangoLayoutLine.x is X position of left edge of baseline, in user space coordinates in Pango units..y is Y position of left edge of baseline, in user space coordinates in Pango units..None.draw_rectangle (string part, int x, int y, int width, int height)
Draws an axis-aligned rectangle in user space coordinates with the specified
PangoRenderer. This should be called while @renderer is already active. Use [method@Pango.Renderer.activate] to activate a renderer.
part is type of object this rectangle is part of.x is X position at which to draw rectangle, in user space coordinates in Pango units.y is Y position at which to draw rectangle, in user space coordinates in Pango units.width is width of rectangle in Pango units.height is height of rectangle in Pango units.None.draw_trapezoid (string part, double y1_, double x11, double x21, double y2, double x12, double x22)
Draws a trapezoid with the parallel sides aligned with the X axis using the given
PangoRenderer; coordinates are in device space.
part is type of object this trapezoid is part of.y1_ is Y coordinate of top of trapezoid.x11 is X coordinate of left end of top of trapezoid.x21 is X coordinate of right end of top of trapezoid.y2 is Y coordinate of bottom of trapezoid.x12 is X coordinate of left end of bottom of trapezoid.x22 is X coordinate of right end of bottom of trapezoid.None.get_color (string part)
Gets the current rendering color for the specified part.
part is the part to get the color for.get_layout ()
Gets the layout currently being rendered using @renderer. Calling this function only makes sense from inside a subclass's methods, like in its draw_shape vfunc, for example. The returned layout should not be modified while still being rendered.
get_layout_line ()
Gets the layout line currently being rendered using @renderer. Calling this function only makes sense from inside a subclass's methods, like in its draw_shape vfunc, for example. The returned layout line should not be modified while still being rendered.
get_matrix ()
Gets the transformation matrix that will be applied when rendering. See [method@Pango.Renderer.set_matrix].
part_changed (string part)
Informs Pango that the way that the rendering is done for @part has changed. This should be called if the rendering changes in a way that would prevent multiple pieces being joined together into one drawing call. For instance, if a subclass of
PangoRendererwas to add a stipple option for drawing underlines, it needs to callpango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);When the stipple changes or underlines with different stipples might be joined together. Pango automatically calls this for changes to colors. (See [method@Pango.Renderer.set_color])
part is the part for which rendering has changed..None.set_color (string part, object color)
Sets the color for part of the rendering. Also see [method@Pango.Renderer.set_alpha].
part is the part to change the color of.color is the new color or %NULL to unset the current color.None.set_matrix (matrix)
Sets the transformation matrix that will be applied when rendering.
matrix is a PangoMatrix, or %NULL to unset any existing matrix (No matrix set is the same as setting the identity matrix.).None.
Aussom
Write once. Embed everywhere.
Copyright 2026 Austin Lehman. All rights reserved.