On Fri, Apr 27, 2012 at 9:25 PM, Fabian Greffrath <fabian@...> wrote:
> Now, the line in question is line 17, which calls FcPatternAddInteger() to
> "guide" fontconfig and add the information that we are looking for
> monospaced fonts to "pattern". However, this line does not seem to do what
> is expected. First, there are still a lot of fonts returned by FcFontSort()
> that are non-monospaced (remove the "break;" commands to see them all)
FcFontSort() doesn't necessarily returns only FcPatterns matched the
given pattern. it returns FcPatterns sorted by the score according to
the result of matching the pattern. I guess what you are expecting to
see may be more close to FcFontList() perhaps.
> This has lead to a bug reported in Debian  that occured when
> Liberation-Mono was the only installed monospaced Truetype font and the
> queried pattern was "FreeMono". I believe that removing the
> FcPatternAddInteger() call fixes this issue (it did on my system, but the OP
> hasn't answered yet).
Well, if you want to use FcFontSort() anyway, you shouldn't trim at
least as long as you want to filter the result out by the fontformat
say because, the result is really depending on what fonts are
installed on the system and the pattern though, if any fonts that has
same coverage is added to the list prior to a font what you want to
see, it won't be added if you give a FcTrue to the trim.