diff options
author | Uli Schlachter <psychon@znc.in> | 2020-12-26 15:55:20 +0000 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2020-12-26 15:55:20 +0000 |
commit | 2a48955a331e48e40bce0bcf886b41fd83ea4c6f (patch) | |
tree | 7ffe15b04bc1e55fbfbb7c491e05cce0ac55ee41 /src/cairo.c | |
parent | 1d99f816b3804f2568ee4669cd0fe57f66ab319d (diff) | |
parent | 2eb12d3fbc7ba727a6af5ef0893f9822ecd2d7d3 (diff) | |
download | cairo-1.16.tar.gz |
Merge branch 'backport-fixes' into '1.16'1.16
Cherry-pick fixes from master into 1.16
See merge request cairo/cairo!20
Diffstat (limited to 'src/cairo.c')
-rw-r--r-- | src/cairo.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/cairo.c b/src/cairo.c index ca0c91e8b..b2bda657d 100644 --- a/src/cairo.c +++ b/src/cairo.c @@ -144,35 +144,34 @@ * * An example of creating a link with user specified clickable region: * <informalexample><programlisting> - * cairo_font_extents_t font_extents; + * struct text { + * const char *s; + * double x, y; + * }; + * const struct text text1 = { "This link is split", 450, 70 }; + * const struct text text2 = { "across two lines", 50, 70 }; * cairo_text_extents_t text1_extents; * cairo_text_extents_t text2_extents; * char attribs[100]; - * const char *text1 = "This link is split"; - * const char *text2 = "across two lines"; - * - * cairo_font_extents (cr, &font_extents); - * cairo_move_to (cr, 450, 50); - * cairo_text_extents (cr, text1, &text1_extents); - * cairo_move_to (cr, 50, 70); - * cairo_text_extents (cr, text2, &text2_extents); + * + * cairo_text_extents (cr, text1.s, &text1_extents); + * cairo_text_extents (cr, text2.s, &text2_extents); * sprintf (attribs, * "rect=[%f %f %f %f %f %f %f %f] uri='https://cairographics.org'", - * text1_extents.x_bearing, - * text1_extents.y_bearing, + * text1_extents.x_bearing + text1.x, + * text1_extents.y_bearing + text1.y, * text1_extents.width, * text1_extents.height, - * text2_extents.x_bearing, - * text2_extents.y_bearing, + * text2_extents.x_bearing + text2.x, + * text2_extents.y_bearing + text2.y, * text2_extents.width, * text2_extents.height); * * cairo_tag_begin (cr, CAIRO_TAG_LINK, attribs); - * cairo_show_text (cr, "This is a link to the cairo website"); - * cairo_move_to (cr, 450, 50); - * cairo_show_text (cr, text1); - * cairo_move_to (cr, 50, 70); - * cairo_show_text (cr, text2); + * cairo_move_to (cr, text1.x, text1.y); + * cairo_show_text (cr, text1.s); + * cairo_move_to (cr, text2.x, text2.y); + * cairo_show_text (cr, text2.s); * cairo_tag_end (cr, CAIRO_TAG_LINK); * </programlisting></informalexample> * |