Comment 74 for bug 105900

Revision history for this message
Petr Gajdos (pgajdos) wrote : Re: Bold, Italics, and Bold Italics not in English on Fonts menu

This is my first try to workaround the problem for fc-match at least. Not sure if it resolves original problem. I don't see inside fontconfig structures far enough to find real solution -- let's wait for upstream.

Could you try and let me know?

Index: fontconfig-2.8.0/src/fcmatch.c
===================================================================
--- fontconfig-2.8.0.orig/src/fcmatch.c
+++ fontconfig-2.8.0/src/fcmatch.c
@@ -413,6 +413,40 @@ FcFontRenderPrepare (FcConfig *confi
     }
     else
         v = FcValueCanonicalize(&FcPatternEltValues (fe)->value);
+
+ /* This is workaround only!! */
+ if (fe->object == FC_STYLE_OBJECT)
+ {
+ FcPatternElt *le, *sle;
+ FcValue lang, stlang;
+ FcValueList *stlangs, *sts;
+ int l;
+
+ if ((le = FcPatternObjectFindElt(pat, FC_LANG_OBJECT)))
+ lang = FcValueCanonicalize(&FcPatternEltValues(le)->value);
+ else
+ { /* I think it is not needed. */
+ lang.type = FcTypeString;
+ lang.u.s = (const FcChar8 *)"en";
+ }
+ sle = FcPatternObjectFindElt(font, FC_STYLELANG_OBJECT);
+ stlangs = FcPatternEltValues(sle);
+ sts = FcPatternEltValues(fe);
+ l = 0;
+
+ do
+ {
+ stlang = FcValueCanonicalize(&stlangs->value);
+ if (FcLangCompare(stlang.u.s, lang.u.s) < FcLangDifferentLang)
+ break;
+ sts = FcValueListNext(sts);
+ l++;
+ } while ((stlangs = FcValueListNext(stlangs)));
+
+ lang = FcValueCanonicalize(&sts->value);
+ v.u.s = lang.u.s;
+ }
+
     FcPatternObjectAdd (new, fe->object, v, FcFalse);
     }
     for (i = 0; i < pat->num; i++)