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 20 Jan 2006 05:32:00 -0000 @@ -582,6 +582,34 @@ 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); + free (glyphs); +} + +/** * 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 20 Jan 2006 05:32:00 -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,