Signed-off-by: Byeongsik Jeon bsjeon@hanmail.net --- v2: This is not a fontconfig bug, but an intended situation.
The pettern returned by FcFontList() does not contain FC_RGBA. The reason why the FcFontList(NULL, pat, NULL) works correctly is because FcConfigSubstitute() matches the fontconfig config file and fills it in the pattern.
Because the fontconfig config file is very flexible, for FcConfigSubstitute() to match the user's intentions, Wine should not limit the request pattern object using FcObjectSet.
v1: 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 settings, but still returns incorrect results.
00d: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.
dlls/gdi32/freetype.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c index 7cc42b2a47..4fc4411a4a 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,15 @@ 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; + + fontset = pFcFontList( NULL, pat, NULL ); + if (!fontset) + { + pFcPatternDestroy(pat); + return; + } + for(i = 0; i < fontset->nfont; i++) { FcBool scalable; DWORD aa_flags; @@ -2875,7 +2876,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); }