Index: doc/public/cairo-sections.txt =================================================================== RCS file: /cvs/cairo/cairo/doc/public/cairo-sections.txt,v retrieving revision 1.33 diff -u -p -r1.33 cairo-sections.txt --- doc/public/cairo-sections.txt 24 Aug 2005 04:10:39 -0000 1.33 +++ doc/public/cairo-sections.txt 14 Jan 2006 10:23:05 -0000 @@ -202,6 +202,7 @@ cairo_scaled_font_status cairo_font_extents_t cairo_scaled_font_extents cairo_text_extents_t +cairo_scaled_font_text_extents cairo_scaled_font_glyph_extents Index: src/cairo-scaled-font.c =================================================================== RCS file: /cvs/cairo/cairo/src/cairo-scaled-font.c,v retrieving revision 1.9 diff -u -p -r1.9 cairo-scaled-font.c --- src/cairo-scaled-font.c 16 Dec 2005 11:02:35 -0000 1.9 +++ src/cairo-scaled-font.c 14 Jan 2006 10:23:06 -0000 @@ -582,6 +582,33 @@ cairo_scaled_font_extents (cairo_scaled_ } /** + * cairo_scaled_font_text_extents: + * @scaled_font: a #cairo_scaled_font_t + * @utf8: a string of text, encoded in UTF-8 + * @extents: a #cairo_text_extents_t which to store the retrieved extents. + * + * cairo_font_text_extents() gets the overall metrics for a string of + * text. The extents are computed as if the text is shown at the origin of + * 0,0. + **/ +void +cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, + const char *utf8, + cairo_text_extents_t *extents) +{ + cairo_status_t status = CAIRO_STATUS_SUCCESS; + cairo_glyph_t *glyphs; + int num_glyphs; + + status = _cairo_scaled_font_text_to_glyphs (scaled_font, 0, 0, utf8, &glyphs, &num_glyphs); + if (status) { + _cairo_scaled_font_set_error (scaled_font, status); + return; + } + cairo_scaled_font_glyph_extents (scaled_font, glyphs, num_glyphs, extents); +} + +/** * cairo_scaled_font_glyph_extents: * @scaled_font: a #cairo_scaled_font_t * @glyphs: an array of glyph IDs with X and Y offsets. Index: src/cairo.h =================================================================== RCS file: /cvs/cairo/cairo/src/cairo.h,v retrieving revision 1.155 diff -u -p -r1.155 cairo.h --- src/cairo.h 10 Oct 2005 19:45:15 -0000 1.155 +++ src/cairo.h 14 Jan 2006 10:23:11 -0000 @@ -928,6 +928,11 @@ cairo_scaled_font_extents (cairo_scaled_ cairo_font_extents_t *extents); cairo_public void +cairo_scaled_font_text_extents (cairo_scaled_font_t *scaled_font, + const char *utf8, + cairo_text_extents_t *extents); + +cairo_public void cairo_scaled_font_glyph_extents (cairo_scaled_font_t *scaled_font, cairo_glyph_t *glyphs, int num_glyphs,