1.10 <PangoRenderer>

Class: <PangoRenderer>

It derives from <GObject>.

<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.

Fields

matrix

the current transformation matrix for the Renderer; may be #f, which should be treated the same as the identity matrix.

Procedures

Method: renderer:activate self
Method: activate self

Does initial setup before rendering operations on self.

renderer:deactivate should be called when done drawing. Calls such as renderer:draw-layout automatically activate the layout before drawing on it.

Calls to renderer:activate and renderer:deactivate can be nested and the renderer will only be initialized and deinitialized once.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

Method: renderer:deactivate self
Method: deactivate self

Cleans up after rendering operations on self.

See docs for renderer:activate.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

Method: renderer:draw-error-underline self x y width height
Method: draw-error-underline self x y width 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 self is already active. Use renderer:activate to activate a renderer.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

x

Passed: a 32-bit integer.

X coordinate of underline, in Pango units in user coordinate system

y

Passed: a 32-bit integer.

Y coordinate of underline, in Pango units in user coordinate system

width

Passed: a 32-bit integer.

width of underline, in Pango units in user coordinate system

height

Passed: a 32-bit integer.

height of underline, in Pango units in user coordinate system

Method: renderer:draw-glyph self font glyph x y
Method: draw-glyph self font glyph x y

Draws a single glyph with coordinates in device space.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

font

Passed: a <PangoFont>.

a <PangoFont>

glyph

Passed: an unsigned 32-bit integer.

the glyph index of a single glyph

x

Passed: a real number.

X coordinate of left edge of baseline of glyph

y

Passed: a real number.

Y coordinate of left edge of baseline of glyph

Method: renderer:draw-glyph-item self text glyph-item x y
Method: draw-glyph-item self text glyph-item x 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 renderer:draw-layout-line or renderer:draw-layout.

Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset.

If text is #f, this simply calls renderer:draw-glyphs.

The default implementation of this method simply falls back to renderer:draw-glyphs.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

text

Passed: a string, or #f.

the UTF-8 text that glyph-item refers to

glyph-item

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units

Method: renderer:draw-glyphs self font glyphs x y
Method: draw-glyphs self font glyphs x y

Draws the glyphs in glyphs with the specified <PangoRenderer>.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

font

Passed: a <PangoFont>.

a <PangoFont>

glyphs

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units.

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units.

Method: renderer:draw-layout self layout x y
Method: draw-layout self layout x 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.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

layout

Passed: a <PangoLayout>.

a <PangoLayout>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units.

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units.

Method: renderer:draw-layout-line self line x y
Method: draw-layout-line self line x 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.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

line

Passed: a <PangoLayoutLine>.

a <PangoLayoutLine>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units.

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units.

Method: renderer:draw-rectangle self part x y width height
Method: draw-rectangle self part x y width height

Draws an axis-aligned rectangle in user space coordinates with the specified <PangoRenderer>.

This should be called while self is already active. Use renderer:activate to activate a renderer.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

type of object this rectangle is part of

x

Passed: a 32-bit integer.

X position at which to draw rectangle, in user space coordinates in Pango units

y

Passed: a 32-bit integer.

Y position at which to draw rectangle, in user space coordinates in Pango units

width

Passed: a 32-bit integer.

width of rectangle in Pango units

height

Passed: a 32-bit integer.

height of rectangle in Pango units

Method: renderer:draw-trapezoid self part y1- x11 x21 y2 x12 x22
Method: draw-trapezoid self part y1- x11 x21 y2 x12 x22

Draws a trapezoid with the parallel sides aligned with the X axis using the given <PangoRenderer>; coordinates are in device space.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

type of object this trapezoid is part of

y1-

Passed: a real number.

Y coordinate of top of trapezoid

x11

Passed: a real number.

X coordinate of left end of top of trapezoid

x21

Passed: a real number.

X coordinate of right end of top of trapezoid

y2

Passed: a real number.

Y coordinate of bottom of trapezoid

x12

Passed: a real number.

X coordinate of left end of bottom of trapezoid

x22

Passed: a real number.

X coordinate of right end of bottom of trapezoid

Method: renderer:get-alpha self part ⇒ %return
Method: get-alpha self part ⇒ %return

Gets the current alpha for the specified part.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part to get the alpha for

%return

Returned: an unsigned 16-bit integer.

the alpha for the specified part, or 0 if it hasn’t been set and should be inherited from the environment.

Method: renderer:get-color self part ⇒ %return
Method: get-color self part ⇒ %return

Gets the current rendering color for the specified part.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part to get the color for

%return

Returned: a <PangoColor>, or #f.

the color for the specified part, or #f if it hasn’t been set and should be inherited from the environment.

Method: renderer:get-layout self ⇒ %return
Method: get-layout self ⇒ %return

Gets the layout currently being rendered using self.

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.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

%return

Returned: a <PangoLayout>, or #f.

the layout, or #f if no layout is being rendered using self at this time.

Method: renderer:get-layout-line self ⇒ %return
Method: get-layout-line self ⇒ %return

Gets the layout line currently being rendered using self.

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.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

%return

Returned: a <PangoLayoutLine>, or #f.

the layout line, or #f if no layout line is being rendered using self at this time.

Method: renderer:get-matrix self ⇒ %return
Method: get-matrix self ⇒ %return

Gets the transformation matrix that will be applied when rendering.

See renderer:set-matrix.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

%return

Returned: a <PangoMatrix>, or #f.

the matrix, or #f if no matrix has been set (which is the same as the identity matrix). The returned matrix is owned by Pango and must not be modified or freed.

Method: renderer:part-changed self part
Method: part-changed self 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 <PangoRenderer> was to add a stipple option for drawing underlines, it needs to call

pango_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 renderer:set-color)

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part for which rendering has changed.

Method: renderer:set-alpha self part alpha
Method: set-alpha self part alpha

Sets the alpha for part of the rendering.

Note that the alpha may only be used if a color is specified for part as well.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part to set the alpha for

alpha

Passed: an unsigned 16-bit integer.

an alpha value between 1 and 65536, or 0 to unset the alpha

Method: renderer:set-color self part [color]
Method: set-color self part [color]

Sets the color for part of the rendering.

Also see renderer:set-alpha.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part to change the color of

color

Passed, or left out: a <PangoColor>, or #f.

the new color or #f to unset the current color

Method: renderer:set-matrix self [matrix]
Method: set-matrix self [matrix]

Sets the transformation matrix that will be applied when rendering.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

matrix

Passed, or left out: a <PangoMatrix>, or #f.

a <PangoMatrix>, or #f to unset any existing matrix (No matrix set is the same as setting the identity matrix.)

Virtual methods

Virtual method: renderer:do-begin implementor self

Do renderer-specific initialization before drawing

To override it in a new class, give register-type #:vfuncs `((begin . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

Virtual method: renderer:do-draw-error-underline implementor self x y width 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 self is already active. Use renderer:activate to activate a renderer.

To override it in a new class, give register-type #:vfuncs `((draw-error-underline . ,procedure)). The procedure is called as (procedure self x y width height).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

x

Passed: a 32-bit integer.

X coordinate of underline, in Pango units in user coordinate system

y

Passed: a 32-bit integer.

Y coordinate of underline, in Pango units in user coordinate system

width

Passed: a 32-bit integer.

width of underline, in Pango units in user coordinate system

height

Passed: a 32-bit integer.

height of underline, in Pango units in user coordinate system

Virtual method: renderer:do-draw-glyph implementor self font glyph x y

Draws a single glyph with coordinates in device space.

To override it in a new class, give register-type #:vfuncs `((draw-glyph . ,procedure)). The procedure is called as (procedure self font glyph x y).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

font

Passed: a <PangoFont>.

a <PangoFont>

glyph

Passed: an unsigned 32-bit integer.

the glyph index of a single glyph

x

Passed: a real number.

X coordinate of left edge of baseline of glyph

y

Passed: a real number.

Y coordinate of left edge of baseline of glyph

Virtual method: renderer:do-draw-glyph-item implementor self text glyph-item x 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 renderer:draw-layout-line or renderer:draw-layout.

Note that text is the start of the text for layout, which is then indexed by glyph_item->item->offset.

If text is #f, this simply calls renderer:draw-glyphs.

The default implementation of this method simply falls back to renderer:draw-glyphs.

To override it in a new class, give register-type #:vfuncs `((draw-glyph-item . ,procedure)). The procedure is called as (procedure self text glyph-item x y).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

text

Passed: a string, or #f.

the UTF-8 text that glyph-item refers to

glyph-item

Passed: a <PangoGlyphItem>.

a <PangoGlyphItem>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units

Virtual method: renderer:do-draw-glyphs implementor self font glyphs x y

Draws the glyphs in glyphs with the specified <PangoRenderer>.

To override it in a new class, give register-type #:vfuncs `((draw-glyphs . ,procedure)). The procedure is called as (procedure self font glyphs x y).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

font

Passed: a <PangoFont>.

a <PangoFont>

glyphs

Passed: a <PangoGlyphString>.

a <PangoGlyphString>

x

Passed: a 32-bit integer.

X position of left edge of baseline, in user space coordinates in Pango units.

y

Passed: a 32-bit integer.

Y position of left edge of baseline, in user space coordinates in Pango units.

Virtual method: renderer:do-draw-rectangle implementor self part x y width height

Draws an axis-aligned rectangle in user space coordinates with the specified <PangoRenderer>.

This should be called while self is already active. Use renderer:activate to activate a renderer.

To override it in a new class, give register-type #:vfuncs `((draw-rectangle . ,procedure)). The procedure is called as (procedure self part x y width height).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

type of object this rectangle is part of

x

Passed: a 32-bit integer.

X position at which to draw rectangle, in user space coordinates in Pango units

y

Passed: a 32-bit integer.

Y position at which to draw rectangle, in user space coordinates in Pango units

width

Passed: a 32-bit integer.

width of rectangle in Pango units

height

Passed: a 32-bit integer.

height of rectangle in Pango units

Virtual method: renderer:do-draw-trapezoid implementor self part y1- x11 x21 y2 x12 x22

Draws a trapezoid with the parallel sides aligned with the X axis using the given <PangoRenderer>; coordinates are in device space.

To override it in a new class, give register-type #:vfuncs `((draw-trapezoid . ,procedure)). The procedure is called as (procedure self part y1- x11 x21 y2 x12 x22).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

type of object this trapezoid is part of

y1-

Passed: a real number.

Y coordinate of top of trapezoid

x11

Passed: a real number.

X coordinate of left end of top of trapezoid

x21

Passed: a real number.

X coordinate of right end of top of trapezoid

y2

Passed: a real number.

Y coordinate of bottom of trapezoid

x12

Passed: a real number.

X coordinate of left end of bottom of trapezoid

x22

Passed: a real number.

X coordinate of right end of bottom of trapezoid

Virtual method: renderer:do-end implementor self

Do renderer-specific cleanup after drawing

To override it in a new class, give register-type #:vfuncs `((end . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

Virtual method: renderer:do-part-changed implementor self 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 <PangoRenderer> was to add a stipple option for drawing underlines, it needs to call

pango_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 renderer:set-color)

To override it in a new class, give register-type #:vfuncs `((part-changed . ,procedure)). The procedure is called as (procedure self part).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

a <PangoRenderer>

part

Passed: a <PangoRenderPart>, or one of its symbols.

the part for which rendering has changed.

Virtual method: renderer:do-prepare-run implementor self run

updates the renderer for a new run

To override it in a new class, give register-type #:vfuncs `((prepare-run . ,procedure)). The procedure is called as (procedure self run).

implementor

Passed: the class whose implementation to call: <PangoRenderer>, or a class that derives from it, or its GType number.

self

Passed: a <PangoRenderer>.

run

Passed: a <PangoGlyphItem>.