Functions
pango_renderer_draw_glyph_item ()
void
pango_renderer_draw_glyph_item (PangoRenderer *renderer,
const char *text,
PangoGlyphItem *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 (PDF for example).
Note that text
is the start of the text for layout, which is then
indexed by glyph_item->item->offset
.
If text
is NULL, this simply calls pango_renderer_draw_glyphs().
The default implementation of this method simply falls back to
pango_renderer_draw_glyphs().
Since: 1.22
pango_renderer_draw_rectangle ()
void
pango_renderer_draw_rectangle (PangoRenderer *renderer,
PangoRenderPart 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
pango_renderer_activate() to activate a renderer.
Since: 1.8
pango_renderer_draw_error_underline ()
void
pango_renderer_draw_error_underline (PangoRenderer *renderer,
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
pango_renderer_activate() to activate a renderer.
Since: 1.8
pango_renderer_draw_trapezoid ()
void
pango_renderer_draw_trapezoid (PangoRenderer *renderer,
PangoRenderPart 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.
Since: 1.8
pango_renderer_draw_glyph ()
void
pango_renderer_draw_glyph (PangoRenderer *renderer,
PangoFont *font,
PangoGlyph glyph,
double x,
double y);
Draws a single glyph with coordinates in device space.
Since: 1.8
pango_renderer_part_changed ()
void
pango_renderer_part_changed (PangoRenderer *renderer,
PangoRenderPart part);
Informs Pango that the way that the rendering is done
for part
has changed 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
When the stipple changes or underlines with different stipples
might be joined together. Pango automatically calls this for
changes to colors. (See pango_renderer_set_color())
Since: 1.8
pango_renderer_get_color ()
PangoColor *
pango_renderer_get_color (PangoRenderer *renderer,
PangoRenderPart part);
Gets the current rendering color for the specified part.
Returns
the color for the
specified part, or NULL if it hasn't been set and should be
inherited from the environment.
[transfer none][nullable]
Since: 1.8
pango_renderer_set_alpha ()
void
pango_renderer_set_alpha (PangoRenderer *renderer,
PangoRenderPart part,
guint16 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.
Since: 1.38
pango_renderer_get_alpha ()
guint16
pango_renderer_get_alpha (PangoRenderer *renderer,
PangoRenderPart part);
Gets the current alpha for the specified part.
Returns
the alpha for the specified part,
or 0 if it hasn't been set and should be
inherited from the environment.
Since: 1.38
pango_renderer_set_matrix ()
void
pango_renderer_set_matrix (PangoRenderer *renderer,
const PangoMatrix *matrix);
Sets the transformation matrix that will be applied when rendering.
Since: 1.8
pango_renderer_get_matrix ()
const PangoMatrix *
pango_renderer_get_matrix (PangoRenderer *renderer);
Gets the transformation matrix that will be applied when
rendering. See pango_renderer_set_matrix().
Returns
the matrix, or NULL 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.
[nullable]
Since: 1.8
pango_renderer_get_layout ()
PangoLayout *
pango_renderer_get_layout (PangoRenderer *renderer);
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.
Returns
the layout, or NULL if
no layout is being rendered using renderer
at this time.
[transfer none][nullable]
Since: 1.20
pango_renderer_get_layout_line ()
PangoLayoutLine *
pango_renderer_get_layout_line (PangoRenderer *renderer);
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.
Returns
the layout line, or NULL
if no layout line is being rendered using renderer
at this time.
[transfer none][nullable]
Since: 1.20
Types and Values
struct PangoRenderer
struct PangoRenderer {
PangoMatrix *matrix; /* May be NULL */
};
PangoRenderer is a base class for objects that are used to
render Pango objects such as PangoGlyphString and
PangoLayout.
Since: 1.8
enum PangoRenderPart
PangoRenderPart defines different items to render for such
purposes as setting colors.
Since: 1.8
PANGO_TYPE_RENDER_PART
#define PANGO_TYPE_RENDER_PART (pango_render_part_get_type ())
struct PangoRendererClass
struct PangoRendererClass {
void (*draw_glyphs) (PangoRenderer *renderer,
PangoFont *font,
PangoGlyphString *glyphs,
int x,
int y);
void (*draw_rectangle) (PangoRenderer *renderer,
PangoRenderPart part,
int x,
int y,
int width,
int height);
void (*draw_error_underline) (PangoRenderer *renderer,
int x,
int y,
int width,
int height);
void (*draw_shape) (PangoRenderer *renderer,
PangoAttrShape *attr,
int x,
int y);
void (*draw_trapezoid) (PangoRenderer *renderer,
PangoRenderPart part,
double y1_,
double x11,
double x21,
double y2,
double x12,
double x22);
void (*draw_glyph) (PangoRenderer *renderer,
PangoFont *font,
PangoGlyph glyph,
double x,
double y);
void (*part_changed) (PangoRenderer *renderer,
PangoRenderPart part);
void (*begin) (PangoRenderer *renderer);
void (*end) (PangoRenderer *renderer);
void (*prepare_run) (PangoRenderer *renderer,
PangoLayoutRun *run);
void (*draw_glyph_item) (PangoRenderer *renderer,
const char *text,
PangoGlyphItem *glyph_item,
int x,
int y);
};
Class structure for PangoRenderer.
The following vfuncs take user space coordinates in Pango units
and have default implementations:
draw_glyphs
draw_rectangle
draw_error_underline
draw_shape
draw_glyph_item
The default draw_shape implementation draws nothing.
The following vfuncs take device space coordinates as doubles
and must be implemented:
draw_trapezoid
draw_glyph
Since: 1.8