[PATCH 2/3] gdi32: Disable the code that doesn't work as intended around FcFontList().

Byeongsik Jeon bsjeon at hanmail.net
Mon Oct 22 07:52:20 CDT 2018


The current Wine does not operate the following settings correctly.

  <match target="pattern">
    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="rgba"      mode="assign"><const>rgb</const></edit>
  </match>

  <match target="font">
    <test name="family" compare="eq">
      <string>NanumGothic</string>
    </test>

    <edit name="antialias" mode="assign"><bool>true</bool></edit>
    <edit name="rgba"      mode="assign"><const>none</const></edit>
  </match>

The correct result is as follows, but the actual result(zero) is not 5.
It returns different results in slightly different fontconfig settings,
but still returns incorrect results.

000d:trace:font:init_fontconfig enabled, default flags = 11
000d:trace:font:load_fontconfig_fonts fontconfig: /usr/share/fonts/TTF/NanumGothic.ttf aa 5
000d:trace:font:load_fontconfig_fonts fontconfig: /usr/share/fonts/TTF/NanumGothicBold.ttf aa 5

This issue can be simply simulated with the following commands:

$ fc-list -b NanumGothic rgba
Pattern has 0 elts (size 0)
        (null):

$ fc-match -b NanumGothic rgba
Pattern has 1 elts (size 16)
        rgba: 5(i)(w)

$ fc-list -b NanumGothic file scalable antialias rgba
Pattern has 2 elts (size 16)
        file: "/usr/share/fonts/TTF/NanumGothic.ttf"(s)
        scalable: True(s)

$ fc-match -b NanumGothic file scalable antialias rgba
Pattern has 4 elts (size 16)
        antialias: True(w)
        file: "/usr/share/fonts/TTF/NanumGothic.ttf"(w)
        scalable: True(w)
        rgba: 5(i)(w)

In conclusion, FC_ANTIALIAS and FC_RGBA through FcObjectSetAdd()
does not work. But strangely, FcFontList(NULL, pettern, NULL) returns
the correct results. It is necessary to investigate whether this is
a bug in the fontconfig or an intended situation.

I considered creating codes that do the same thing using FcFontSort(),
without using suspicious FcFontList().
However,
I think it is a simple and not bad way to disable problematic Wine code.

Signed-off-by: Byeongsik Jeon <bsjeon at hanmail.net>
---
 dlls/gdi32/freetype.c | 30 +++++++++++++++++++++---------
 1 file changed, 21 insertions(+), 9 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index f60bdf4990..08d12b262a 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -2829,7 +2829,6 @@ static void init_fontconfig(void)
 static void load_fontconfig_fonts(void)
 {
     FcPattern *pat;
-    FcObjectSet *os;
     FcFontSet *fontset;
     int i, len;
     char *file;
@@ -2838,13 +2837,27 @@ static void load_fontconfig_fonts(void)
     if (!fontconfig_enabled) return;
 
     pat = pFcPatternCreate();
-    os = pFcObjectSetCreate();
-    pFcObjectSetAdd(os, FC_FILE);
-    pFcObjectSetAdd(os, FC_SCALABLE);
-    pFcObjectSetAdd(os, FC_ANTIALIAS);
-    pFcObjectSetAdd(os, FC_RGBA);
-    fontset = pFcFontList(NULL, pat, os);
-    if(!fontset) return;
+    if (!pat) return;
+#if 0
+    {
+        FcObjectSet *os;
+        os = pFcObjectSetCreate();
+        pFcObjectSetAdd(os, FC_FILE);
+        pFcObjectSetAdd(os, FC_SCALABLE);
+        pFcObjectSetAdd(os, FC_ANTIALIAS);
+        pFcObjectSetAdd(os, FC_RGBA);
+        fontset = pFcFontList(NULL, pat, os);
+        pFcObjectSetDestroy(os);
+    }
+#else
+    fontset = pFcFontList( NULL, pat, NULL );
+#endif
+    if (!fontset)
+    {
+        pFcPatternDestroy(pat);
+        return;
+    }
+
     for(i = 0; i < fontset->nfont; i++) {
         FcBool scalable;
         DWORD aa_flags;
@@ -2875,7 +2888,6 @@ static void load_fontconfig_fonts(void)
                           ADDFONT_EXTERNAL_FONT | ADDFONT_ADD_TO_CACHE | ADDFONT_AA_FLAGS(aa_flags) );
     }
     pFcFontSetDestroy(fontset);
-    pFcObjectSetDestroy(os);
     pFcPatternDestroy(pat);
 }
 
-- 
2.19.1




More information about the wine-devel mailing list