From dbc7c4a2cfe1ba6c537957b3b68b625403ca99fd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 14 Dec 2014 13:39:41 -0800 Subject: [PATCH] Add FC_COLOR Only adds "color" to pattern if FreeType version supports color. Based on patch from Jungshik Shin. --- doc/fontconfig-devel.sgml | 1 + fontconfig/fontconfig.h | 1 + src/fcfreetype.c | 6 ++++++ src/fcmatch.c | 1 + src/fcobjs.h | 1 + 5 files changed, 10 insertions(+) diff --git a/doc/fontconfig-devel.sgml b/doc/fontconfig-devel.sgml index 2b1122f..9f3613a 100644 --- a/doc/fontconfig-devel.sgml +++ b/doc/fontconfig-devel.sgml @@ -176,6 +176,7 @@ convenience for the application's rendering mechanism. scalable FC_SCALABLE Bool Whether glyphs can be scaled scale FC_SCALE Double Scale factor for point->pixel conversions + color FC_COLOR Bool Whether any glyphs have color dpi FC_DPI Double Target dots per inch rgba FC_RGBA Int unknown, rgb, bgr, vrgb, vbgr, none - subpixel geometry diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index afc917c..85cdd6d 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -94,6 +94,7 @@ typedef int FcBool; #define FC_RASTERIZER "rasterizer" /* String (deprecated) */ #define FC_OUTLINE "outline" /* Bool */ #define FC_SCALABLE "scalable" /* Bool */ +#define FC_COLOR "color" /* Bool */ #define FC_SCALE "scale" /* double */ #define FC_DPI "dpi" /* double */ #define FC_RGBA "rgba" /* Int */ diff --git a/src/fcfreetype.c b/src/fcfreetype.c index da66741..2575a72 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1285,6 +1285,12 @@ FcFreeTypeQueryFace (const FT_Face face, (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) goto bail1; +#ifdef FT_FACE_FLAG_COLOR + if (!FcPatternAddBool (pat, FC_COLOR, + (face->face_flags & FT_FACE_FLAG_COLOR) != 0)) + goto bail1; +#endif + /* * Get the OS/2 table diff --git a/src/fcmatch.c b/src/fcmatch.c index 25081e2..46d08bc 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -284,6 +284,7 @@ typedef enum _FcMatcherPriority { PRI1(FILE), PRI1(FONTFORMAT), PRI1(SCALABLE), + PRI1(COLOR), PRI1(FOUNDRY), PRI1(CHARSET), PRI_FAMILY_STRONG, diff --git a/src/fcobjs.h b/src/fcobjs.h index bfdf4b5..573fa61 100644 --- a/src/fcobjs.h +++ b/src/fcobjs.h @@ -68,4 +68,5 @@ FC_OBJECT (FONT_FEATURES, FcTypeString, NULL) FC_OBJECT (PRGNAME, FcTypeString, NULL) FC_OBJECT (HASH, FcTypeString, NULL) /* deprecated */ FC_OBJECT (POSTSCRIPT_NAME, FcTypeString, FcComparePostScript) +FC_OBJECT (COLOR, FcTypeBool, FcCompareBool) /* ^-------------- Add new objects here. */