[cairo-commit] cairo/src cairo-ft-font.c, 1.56, 1.57 cairo.h, 1.107, 1.108

Owen Taylor commit at pdx.freedesktop.org
Mon May 2 14:20:11 PDT 2005


Committed by: otaylor

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv21671/src

Modified Files:
	cairo-ft-font.c cairo.h 
Log Message:
2005-05-02  Owen Taylor  <otaylor at redhat.com>

        * src/cairo-ft-font.c (_cairo_ft_scaled_font_font_extents): Changes the
        sign of extents->descent to match win32 backend and the conventional
        convention.

        * src/cairo.h: Document cairo_font_extents_t.


Index: cairo-ft-font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-ft-font.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- cairo-ft-font.c	26 Apr 2005 19:38:06 -0000	1.56
+++ cairo-ft-font.c	2 May 2005 21:20:07 -0000	1.57
@@ -936,7 +936,7 @@
      * user space
      */
     extents->ascent =        DOUBLE_FROM_26_6(metrics->ascender) / scaled_font->unscaled->y_scale;
-    extents->descent =       DOUBLE_FROM_26_6(metrics->descender) / scaled_font->unscaled->y_scale;
+    extents->descent =       DOUBLE_FROM_26_6(- metrics->descender) / scaled_font->unscaled->y_scale;
     extents->height =        DOUBLE_FROM_26_6(metrics->height) / scaled_font->unscaled->y_scale;
     extents->max_x_advance = DOUBLE_FROM_26_6(metrics->max_advance) / scaled_font->unscaled->x_scale;
 

Index: cairo.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.h,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- cairo.h	2 May 2005 20:39:33 -0000	1.107
+++ cairo.h	2 May 2005 21:20:07 -0000	1.108
@@ -616,10 +616,10 @@
  *   after drawing these glyphs. Will typically be zero except
  *   for vertical text layout as found in East-Asian languages.
  *
- * The #cairo_text_extents_t< structure stores the extents of a single
+ * The #cairo_text_extents_t structure stores the extents of a single
  * glyph or a string of glyphs in user-space coordinates. Because text
- * extents are in user-space coordinates, they don't scale along with
- * the current transformation matrix. If you call
+ * extents are in user-space coordinates, they are mostly, but not
+ * entirely, independent of the current transformation matrix. If you call
  * <literal>cairo_scale(cr, 2.0, 2.0)</literal>, text will
  * be drawn twice as big, but the reported text extents will not be
  * doubled. They will change slightly due to hinting (so you can't
@@ -635,6 +635,47 @@
     double y_advance;
 } cairo_text_extents_t;
 
+/**
+ * cairo_font_extents_t:
+ * @ascent: the distance that the font extends above the baseline.
+ *          Note that this is not always exactly equal to the maximum
+ *          of the extents of all the glyphs in the font, but rather
+ *          is picked to express the font designer's intent as to
+ *          how the font should align with elements above it.
+ * @descent: the distance that the font extends below the baseline.
+ *           This value is positive for typical fonts that include
+ *           portions below the baseline. Note that this is not always
+ *           exactly equal to the maximum of the extents of all the
+ *           glyphs in the font, but rather is picked to express the
+ *           font designer's intent as to how the the font should
+ *           align with elements below it.
+ * @height: the recommended vertical distance between baselines when
+ *          setting consecutive lines of text with the font. This
+ *          is greater than @ascent+ at descent by a
+ *          quantity known as the <firstterm>line spacing</firstterm>
+ *          or <firstterm>external leading</firstterm>. When space
+ *          is at a premium, most fonts can be set with only
+ *          a distance of @ascent+ at descent between lines.
+ * @max_x_advance: the maximum distance in the X direction that 
+ *         the the origin is advanced for any glyph in the font.
+ * @max_y_advance: the maximum distance in the Y direction that
+ *         the the origin is advanced for any glyph in the font.
+ *         this will be zero for normal fonts used for horizontal
+ *         writing. (The scripts of East Asia are sometimes written
+ *         vertically.)
+ *
+ * The #cairo_text_extents_t structure stores metric information for
+ * a font. Values are given in the current user-space coordinate
+ * system.
+ *
+ * Because font metrics are in user-space coordinates, they are
+ * mostly, but not entirely, independent of the current transformation
+ * matrix. If you call <literal>cairo_scale(cr, 2.0, 2.0)</literal>,
+ * text will be drawn twice as big, but the reported text extents will
+ * not be doubled. They will change slightly due to hinting (so you
+ * can't assume that metrics are independent of the transformation
+ * matrix), but otherwise will remain unchanged.
+ */
 typedef struct {
     double ascent;
     double descent;




More information about the cairo-commit mailing list