diff options
author | Matthias Clasen <mclasen@redhat.com> | 2022-06-12 09:17:45 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2022-06-22 13:54:02 -0400 |
commit | 7d21242bb8aefe601d12bf94d41b88975ffacbba (patch) | |
tree | 1454c18fa3e5d421730de5c3360c0c92bc4e2a67 /docs | |
parent | a29d5f1950d55bff21615b6dc0b43cbef1df46ae (diff) | |
download | pango-7d21242bb8aefe601d12bf94d41b88975ffacbba.tar.gz |
docs: Sync the cairo example
Diffstat (limited to 'docs')
-rw-r--r-- | docs/pango_cairo.md | 16 | ||||
-rw-r--r-- | docs/rotated-text.png | bin | 23044 -> 23224 bytes |
2 files changed, 8 insertions, 8 deletions
diff --git a/docs/pango_cairo.md b/docs/pango_cairo.md index e1370918..f4d699f6 100644 --- a/docs/pango_cairo.md +++ b/docs/pango_cairo.md @@ -13,9 +13,10 @@ this section allow using Pango to render to Cairo surfaces. Using Pango with Cairo is straightforward. A `PangoContext` created with [func@Pango.cairo_create_context] can be used on any Cairo context (`cairo_t`), but needs to be updated to match the current transformation matrix and target -surface of the Cairo context using [func@Pango.cairo_update_context]. The -convenience function [func@Pango.cairo_update_layout] handles the common case -where the program doesn't need to manipulate the properties of the `PangoContext`. +surface of the Cairo context using [func@Pango.cairo_update_context]. +The convenience functions [func@Pango.cairo_create_layout] and +[func@Pango.cairo_update_layout] handle the common case where the program +doesn't need to manipulate the properties of the `PangoContext`. When you get the metrics of a layout or of a piece of a layout using functions such as [method@Pango.Lines.get_extents], the reported metrics are in user-space @@ -59,7 +60,6 @@ draw_text (cairo_t *cr) /* Draw the layout N_WORDS times in a circle */ for (i = 0; i < N_WORDS; i++) { - PangoRectangle ext; int width, height; double angle = (360. * i) / N_WORDS; double red; @@ -77,14 +77,14 @@ draw_text (cairo_t *cr) lines = pango_layout_get_lines (layout); - pango_lines_get_extents (lines, NULL, &ext); - cairo_move_to (cr, - ((double)ext.width / PANGO_SCALE) / 2, - RADIUS); - pango_cairo_show_lines (cr, layout); + pango_lines_get_size (lines, &width, &height); + cairo_move_to (cr, - ((double) width / PANGO_SCALE) / 2, - RADIUS); + pango_cairo_show_layout (cr, layout); cairo_restore (cr); } - /* free the layout object */ + /* Free the layout object */ g_object_unref (layout); } diff --git a/docs/rotated-text.png b/docs/rotated-text.png Binary files differindex b29682e8..72b17d58 100644 --- a/docs/rotated-text.png +++ b/docs/rotated-text.png |