doc/fontconfig-user.sgml | 23 +++++++++++++++++++++++ src/fcxml.c | 5 +++++ 2 files changed, 28 insertions(+) New commits: commit 2837c63876b9b1f27d74aad51d45fc18d48f4652 Author: Akira TAGOH <akira at tagoh.org> Date: Mon May 21 13:43:20 2012 +0900 Bug 33644 - Fontconfig doesn''t match correctly in <test> Warn if the multiple values is set to <test>, including the case of in <alias> because the behavior isn''t intuitive since so many users is asking for a help to get things working for their expectation. Use multiple <match>s or <alias>es for OR operator and multiple <test>s for AND operator. diff --git a/doc/fontconfig-user.sgml b/doc/fontconfig-user.sgml index c6ab856..f29cfe0 100644 --- a/doc/fontconfig-user.sgml +++ b/doc/fontconfig-user.sgml @@ -627,6 +627,29 @@ This is an example of a system-wide configuration file <family>monospace</family> <prefer><family>Andale Mono</family></prefer> </alias> + +<-- + The example of the requirements of OR operator; + If the ''family'' contains ''Courier New'' OR ''Courier'' + add ''monospace'' as the alternative +--> +<match target="pattern"> + <test name="family" mode="eq"> + <string>Courier New</string> + </test> + <edit name="family" mode="prepend"> + <string>monospace</string> + </edit> +</match> +<match target="pattern"> + <test name="family" mode="eq"> + <string>Courier</string> + </test> + <edit name="family" mode="prepend"> + <string>monospace</string> + </edit> +</match> + </fontconfig> </programlisting> </refsect2> diff --git a/src/fcxml.c b/src/fcxml.c index f027270..d92cbcc 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -1590,6 +1590,7 @@ FcParseAlias (FcConfigParse *parse) case FcVStackFamily: if (family) { + FcConfigMessage (parse, FcSevereWarning, "Having multiple <family> in <alias> isn''t supported and may not works as expected"); new = FcExprCreateOp (parse->config, vstack->u.expr, FcOpComma, family); if (!new) FcConfigMessage (parse, FcSevereError, "out of memory"); @@ -2204,6 +2205,10 @@ FcParseTest (FcConfigParse *parse) FcConfigMessage (parse, FcSevereWarning, "missing test expression"); return; } + if (expr->op == FcOpComma) + { + FcConfigMessage (parse, FcSevereWarning, "Having multiple values in <test> isn''t supported and may not works as expected"); + } test = FcTestCreate (parse, kind, qual, name, FC_OP (compare, flags), expr); if (!test) {