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

Carl Worth cworth at kemper.freedesktop.org
Tue Apr 25 11:20:28 PDT 2006


 src/cairo-ft-font.c |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

New commits:
diff-tree fe8bf47afc11b12034fd2c92caf424c8911d630b (from 90b7a2d5fc5d195a0e521e48d17a78a98b53b224)
Author: Zhe Su <james.su at gmail.com>
Date:   Tue Apr 25 10:20:42 2006 -0700

    Support fontconfig embeddedbitmap option/handle transformation issue as well.

diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index a23388a..eb6ccd1 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -1227,7 +1227,9 @@ const cairo_scaled_font_backend_t cairo_
 static cairo_ft_options_t
 _get_pattern_ft_options (FcPattern *pattern)
 {
-    FcBool antialias, vertical_layout, hinting, autohint;
+    FcBool antialias, vertical_layout, hinting, autohint, bitmap;
+    FcBool transform;
+    FcMatrix *font_matrix;
     cairo_ft_options_t ft_options;
     int rgba;
 #ifdef FC_HINT_STYLE    
@@ -1237,15 +1239,31 @@ _get_pattern_ft_options (FcPattern *patt
 
     ft_options.load_flags = 0;
     ft_options.extra_flags = 0;
+
+#ifndef FC_EMBEDDED_BITMAP
+#define FC_EMBEDDED_BITMAP "embeddedbitmap"
+#endif
+
+    if (FcPatternGetMatrix (pattern,
+			    FC_MATRIX, 0, &font_matrix) != FcResultMatch)
+	font_matrix = NULL;
+
+    transform = (font_matrix && (font_matrix->xx != 1 || font_matrix->xy != 0 ||
+				 font_matrix->yx != 0 || font_matrix->yy != 1));
+
+    /* Check whether to force use of embedded bitmaps */
+    if (FcPatternGetBool (pattern,
+			  FC_EMBEDDED_BITMAP, 0, &bitmap) != FcResultMatch)
+	bitmap = FcFalse;
     
     /* disable antialiasing if requested */
     if (FcPatternGetBool (pattern,
 			  FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
 	antialias = FcTrue;
 
-    if (antialias)
+    if ((!bitmap && antialias) || transform)
 	ft_options.load_flags |= FT_LOAD_NO_BITMAP;
-    else
+    else if (!antialias)
 	ft_options.load_flags |= FT_LOAD_MONOCHROME;
     
     /* disable hinting if requested */


More information about the cairo-commit mailing list