]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcfreetype.c
Add FcResultOutOfMemory to provide an accurate error when FcFontSetMatch
[fontconfig.git] / src / fcfreetype.c
index 816f08ab190f1ca8c5d84fc919ec6ede8a9951f1..daaba28bbb4ff8ee9ead029c7641632e39a14329 100644 (file)
 #endif
 
 #if !HAVE_FT_GET_BDF_PROPERTY
-#warning "No FT_Get_BDF_Property"
+#warning "No FT_Get_BDF_Property: Please install freetype 2.1.4 or later"
 #endif
 
 #if !HAVE_FT_GET_PS_FONT_INFO
-#warning "No FT_Get_Font_Info"
+#warning "No FT_Get_PS_Font_Info: Please install freetype 2.1.1 or later"
 #endif
 
 /*
@@ -1094,7 +1094,7 @@ bail:
 #define FT_Get_Next_Char(face, ucs4, gi) ((ucs4) >= 0xffffff ? \
                                          (*(gi) = 0), 0 : \
                                          (*(gi) = 1), (ucs4) + 1)
-#warning "No FT_Get_Next_Char"
+#warning "No FT_Get_Next_Char: Please install freetype version 2.1.0 or newer"
 #endif
 
 typedef struct _FcCharEnt {
@@ -1829,7 +1829,10 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4,
     return FcFalse;
 }
 
-#define APPROXIMATELY_EQUAL(x,y) (ABS ((x) - (y)) <= MAX (ABS (x), ABS (y)) / 33)
+#define FC_MIN(a,b) ((a) < (b) ? (a) : (b))
+#define FC_MAX(a,b) ((a) > (b) ? (a) : (b))
+#define FC_ABS(a)   ((a) < 0 ? -(a) : (a))
+#define APPROXIMATELY_EQUAL(x,y) (FC_ABS ((x) - (y)) <= FC_MAX (FC_ABS (x), FC_ABS (y)) / 33)
 
 FcCharSet *
 FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
@@ -2046,7 +2049,7 @@ FcFreeTypeCharSetAndSpacing (FT_Face face, FcBlanks *blanks, int *spacing)
 #endif
     if (fixed_advance)
        *spacing = FC_MONO;
-    else if (dual_advance && APPROXIMATELY_EQUAL (2 * MIN (advance_one, advance_two), MAX (advance_one, advance_two)))
+    else if (dual_advance && APPROXIMATELY_EQUAL (2 * FC_MIN (advance_one, advance_two), FC_MAX (advance_one, advance_two)))
         *spacing = FC_DUAL;
     else
        *spacing = FC_PROPORTIONAL;