From 66db69a6d991945f96feb1da683a2e04ea396842 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 14 Dec 2014 13:55:53 -0800 Subject: [PATCH] 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 --- src/fcfreetype.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) 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; - - if (!FcPatternAddBool (pat, FC_SCALABLE, - (face->face_flags & FT_FACE_FLAG_SCALABLE) != 0)) - goto bail1; + { + int has_outline = !!(face->face_flags & FT_FACE_FLAG_SCALABLE); + int has_color = 0; #ifdef FT_FACE_FLAG_COLOR - if (!FcPatternAddBool (pat, FC_COLOR, - (face->face_flags & FT_FACE_FLAG_COLOR) != 0)) - goto bail1; + 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, 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