On Thu, May 31, 2012 at 3:01 PM, Werner LEMBERG <wl@xxxxxxx> wrote: > > [I'm forwarding this mail to the fontconfig list (with omissions), > since it is indeed a problem IMHO] > >> [...] [I] found that fontconfig 2.8 no longer selects Emmentaler-20. >> >> I found that escaping the dash helps fc-match, but cannot get >> GnomeCanvas' text method to do the same. I just dropped >> emmentaler-20.otf in ~/.fonts and it's nicely in fc-list >> >> $ fc-scan ~/.fonts/emmentaler-20.otf >> Pattern has 19 elts (size 32) >> family: "Emmentaler-20"(s) >> familylang: "en"(s) >> style: "20"(s) >> stylelang: "en"(s) >> fullname: "Emmentaler-20"(s) >> fullnamelang: "en"(s) >> slant: 0(i)(s) >> weight: 100(i)(s) >> width: 100(i)(s) >> foundry: "unknown"(s) >> file: "/home/janneke/.fonts/emmentaler-20.otf"(s) >> [...] > >> $ fc-match Emmentaler-20 >> DejaVuSans.ttf: "DejaVu Sans" "Book" > >> $ fc-match Emmentaler\-20 >> DejaVuSans.ttf: "DejaVu Sans" "Book" > >> $ fc-match Emmentaler\\-20 >> emmentaler-20.otf: "Emmentaler-20" "20" > >> $ fc-list | grep Emmentaler >> Emmentaler\-20:style=20 > > fontconfig's behaviour doesn't look right to me. Why gets a `-' > character replaced with `\-' in the font name? This is because of the limitation of FcNameParse() since it uses "-" as a separator to guess the parameters. see what happened with it: $ FC_DEBUG=4 fc-match Emmentaler-20 ... FcConfigSubstitute Pattern has 2 elts (size 16) family: "Emmentaler"(s) size: 20(f)(s) ... Although this issue usually won't happens on the applications who uses fontconfig, because they do as the following: #include <fontconfig/fontconfig.h> int main(void) { FcPattern *pat, *match; FcResult result; FcInit(); pat = FcPatternCreate(); FcPatternAddString(pat, FC_FAMILY, "Emmentaler-20"); FcConfigSubstitute(NULL, pat, FcMatchPattern); FcDefaultSubstitute(pat); match = FcFontMatch(NULL, pat, &result); FcPatternPrint(match); if (match) FcPatternDestroy(match); FcPatternDestroy(pat); FcFini(); return 0; } $ ./a.out Pattern has 29 elts (size 32) family: "Emmentaler-20"(s) familylang: "en"(s) style: "20"(s) stylelang: "en"(s) fullname: "Emmentaler-20"(s) fullnamelang: "en"(s) ... Additionally, there is > a discrepancy between the output of fc-scan and fc-list, since the > former doesn't show `\-'. because the default format for fc-list uses FcNameUnparse(). if you don't like it, you can specify the output format with -f for your preference: $ fc-list -f '%{?file{%{file}: }}%{-file{%{family}:style=%{style}}}\n' ... /usr/share/fonts/lilypond/emmentaler-20.otf: Emmentaler-20:style=20 ... Hope that helps, > > > Werner > _______________________________________________ > Fontconfig mailing list > Fontconfig@xxxxxxxxxxxxxxxxxxxxx > http://lists.freedesktop.org/mailman/listinfo/fontconfig -- Akira TAGOH _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig