doc/fontconfig-devel.sgml | 1 + fontconfig/fontconfig.h | 1 + src/fcfreetype.c | 27 +++++++++++++++++++++------ src/fcmatch.c | 1 + src/fcobjs.h | 1 + 5 files changed, 25 insertions(+), 6 deletions(-) New commits: commit 66db69a6d991945f96feb1da683a2e04ea396842 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Sun Dec 14 13:55:53 2014 -0800 Treat color fonts as scalable All color fonts are designed to be scaled, even if they only have bitmap strikes. Client is responsible to scale the bitmaps. This is in constrast to non-color strikes... Clients can still use FC_OUTLINE to distinguish bitmap vs outline fonts. Previously FC_OUTLINE and FC_SCALABLE always had the same value. Now FC_SCALABLE is set to (FC_OUTLINE || FC_COLOR). Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=87122 diff --git a/src/fcfreetype.c b/src/fcfreetype.c index 2575a72..81ebda7 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -1277,20 +1277,29 @@ FcFreeTypeQueryFace (const FT_Face face, if (!pat) goto bail0; - if (!FcPatternAddBool (pat, FC_OUTLINE, - (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) - goto bail1; + { + int has_outline = !!(face->face_flags & FT_FACE_FLAG_SCALABLE); + int has_color = 0; - if (!FcPatternAddBool (pat, FC_SCALABLE, - (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) - goto bail1; +#ifdef FT_FACE_FLAG_COLOR + has_color = !!(face->face_flags & FT_FACE_FLAG_COLOR); +#endif + + if (!FcPatternAddBool (pat, FC_OUTLINE, has_outline)) + goto bail1; #ifdef FT_FACE_FLAG_COLOR - if (!FcPatternAddBool (pat, FC_COLOR, - (face->face_flags & FT_FACE_FLAG_COLOR) != 0)) - goto bail1; + if (!FcPatternAddBool (pat, FC_COLOR, has_color)) + goto bail1; #endif + /* All color fonts are designed to be scaled, even if they only have + * bitmap strikes. Client is responsible to scale the bitmaps. This + * is in constrast to non-color strikes... */ + if (!FcPatternAddBool (pat, FC_SCALABLE, has_outline || has_color)) + goto bail1; + } + /* * Get the OS/2 table commit dbc7c4a2cfe1ba6c537957b3b68b625403ca99fd Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Sun Dec 14 13:39:41 2014 -0800 Add FC_COLOR Only adds "color" to pattern if FreeType version supports color. Based on patch from Jungshik Shin. 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. */ _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig