Comment 108 for bug 105900

Revision history for this message
In , Pgajdos-f (pgajdos-f) wrote :

Following patch (first try, naive, not upstreamable, ...) should workaround the problem, at least for fc-match. Could you please test?

M17N/fontconfig

In case that this is not enough: could you please tell me how is fontconfig used by *office?

Thanks

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++)