--- fontconfig-2.8.0.orig/src/fcmatch.c
+++ fontconfig-2.8.0/src/fcmatch.c
@@ -413,6 +413,56 @@ 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, style;
+ FcValueList *stlangs, *sts, *en_style;
+ int l;
+
+ /* Try to learn lang from pat. */
+ if ((le = FcPatternObjectFindElt(pat, FC_LANG_OBJECT)))
+ lang = FcValueCanonicalize(&FcPatternEltValues(le)->value);
+ else /* FC_LANG_OBJECT not found in pat. I think it can't happen. */
+ {
+ lang.type = FcTypeString;
+ lang.u.s = (const FcChar8 *)"en";
+ }
+
+ sle = FcPatternObjectFindElt(font, FC_STYLELANG_OBJECT); /* element of font containing */
+ sts = FcPatternEltValues(fe); /* styles translations associated to font */
+ /* langs of styles translations */
+
+ en_style = 0;
+ if (sle) /* style elt can be present, stylelang no (e. g. fc-match Times) */
+ { /* if so, sts list contain only one value, so we can jump to style = .. */
+ stlangs = FcPatternEltValues(sle);
+ l = 0;
+
+ do /* Find style corresponding to lang(.u.s). */
+ {
+ stlang = FcValueCanonicalize(&stlangs->value);
+ if (FcLangCompare(stlang.u.s, lang.u.s) < FcLangDifferentLang)
+ break;
+ if (FcLangCompare(stlang.u.s, "en") < FcLangDifferentLang)
+ en_style = sts; /* Will be used when translation not found for lang. */
+ sts = FcValueListNext(sts);
+ l++;
+ } while ((stlangs = FcValueListNext(stlangs)));
+ }
+
+ if (sts) /* Style translation was found for lang.u.s. */
+ style = FcValueCanonicalize(&sts->value);
+ else if (en_style) /* Not found, try English. */
+ style = FcValueCanonicalize(&en_style->value);
+ else /* Nor English found, take first one. */
+ style = FcValueCanonicalize(&FcPatternEltValues(fe)->value);
+
+ v.u.s = style.u.s;
+ }
+ FcPatternObjectAdd (new, fe->object, v, FcFalse);
}
for (i = 0; i < pat->num; i++)
Hi again,
the workaround for fc-match:
--- fontconfig- 2.8.0.orig/ src/fcmatch. c 2.8.0/src/ fcmatch. c lize(&FcPattern EltValues (fe)->value); FindElt( pat, FC_LANG_OBJECT))) lize(&FcPattern EltValues( le)->value) ; FindElt( font, FC_STYLELANG_ OBJECT) ; /* element of font containing */ ues(fe) ; /* styles translations associated to font */ ues(sle) ; lize(&stlangs- >value) ; stlang. u.s, lang.u.s) < FcLangDifferent Lang) stlang. u.s, "en") < FcLangDifferent Lang) (sts); (stlangs) )); lize(&sts- >value) ; lize(&en_ style-> value); lize(&FcPattern EltValues( fe)->value) ;
FcPatternObjec tAdd (new, fe->object, v, FcFalse);
+++ fontconfig-
@@ -413,6 +413,56 @@ FcFontRenderPrepare (FcConfig *confi
}
else
v = FcValueCanonica
+
+ /* This is workaround only!! */
+ if (fe->object == FC_STYLE_OBJECT)
+ {
+ FcPatternElt *le, *sle;
+ FcValue lang, stlang, style;
+ FcValueList *stlangs, *sts, *en_style;
+ int l;
+
+ /* Try to learn lang from pat. */
+ if ((le = FcPatternObject
+ lang = FcValueCanonica
+ else /* FC_LANG_OBJECT not found in pat. I think it can't happen. */
+ {
+ lang.type = FcTypeString;
+ lang.u.s = (const FcChar8 *)"en";
+ }
+
+ sle = FcPatternObject
+ sts = FcPatternEltVal
+ /* langs of styles translations */
+
+ en_style = 0;
+ if (sle) /* style elt can be present, stylelang no (e. g. fc-match Times) */
+ { /* if so, sts list contain only one value, so we can jump to style = .. */
+ stlangs = FcPatternEltVal
+ l = 0;
+
+ do /* Find style corresponding to lang(.u.s). */
+ {
+ stlang = FcValueCanonica
+ if (FcLangCompare(
+ break;
+ if (FcLangCompare(
+ en_style = sts; /* Will be used when translation not found for lang. */
+ sts = FcValueListNext
+ l++;
+ } while ((stlangs = FcValueListNext
+ }
+
+ if (sts) /* Style translation was found for lang.u.s. */
+ style = FcValueCanonica
+ else if (en_style) /* Not found, try English. */
+ style = FcValueCanonica
+ else /* Nor English found, take first one. */
+ style = FcValueCanonica
+
+ v.u.s = style.u.s;
+ }
+
}
for (i = 0; i < pat->num; i++)