[cairo-commit] src/cairo-scaled-font.c

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Jan 24 19:27:34 PST 2008


 src/cairo-scaled-font.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 6d0dc3e0760e6bc6b0eceab48674410b4e865287
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Jan 24 22:24:23 2008 -0500

    [cairo-scaled-font] Don't err on font size 0

diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index c5752ba..6b40e5c 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -483,8 +483,22 @@ _cairo_scaled_font_init (cairo_scaled_font_t               *scaled_font,
 
     inverse = scaled_font->scale;
     status = cairo_matrix_invert (&inverse);
-    if (status)
-	return status;
+    /* If the font scale matrix rank 0, just using an all-zero inverse matrix
+     * makes everything work correctly.  This make font size 0 work without
+     * producing an error.
+     *
+     * FIXME:  If the scale is rank 1, we still go into error mode.  But then
+     * again, that's what we doo everywhere in cairo.
+     */
+    if (status &&
+	scaled_font->scale.xx == 0. && scaled_font->scale.xy == 0. &&
+	scaled_font->scale.yx == 0. && scaled_font->scale.yy == 0.)
+      {
+        cairo_matrix_init (&inverse,
+			   0, 0, 0, 0,
+			   -scaled_font->scale.x0,
+			   -scaled_font->scale.y0);
+      }
 
     scaled_font->glyphs = _cairo_cache_create (_cairo_scaled_glyph_keys_equal,
 					       _cairo_scaled_glyph_destroy,


More information about the cairo-commit mailing list