[Fontconfig] fc-match for monospace?

Behdad Esfahbod behdad at behdad.org
Fri Sep 25 19:09:10 PDT 2009

On 09/25/2009 09:49 PM, Patrick M. Rutkowski wrote:
> Ah, excellent, "fc-match mono", that works.
> However, I'm confused as to what exactly the pattern syntax is there.
> I thought patterns had to be in :foo=bar form, or repetitions thereof.
> Since "fc-match mono" gave me "Bitstream Vera Sans Mono", I thought
> that perhaps it was doing a caseless substring match on the text
> "mono" in the font name. So, I did an "fc-match DejaVu" to test this
> theory, but it failed to return any of the DejaVu fonts on my system.

The syntax is "familyname-size:key=value:key=value:..."

The family names "mono", "monospace", "sans", "sans-serif", "serif", 
"cursive", and "fantasy" are special aliases.

> Thought it's working now, I'm still very confused as to what is going on.
> What is "fc-match mono" doing, _exactly_?

It's asking for the best font with family name "mono".  "mono" is a special 
family name to access the default monospace font on the system.

> Is this pattern syntax documented anywhere? I tried looking to the
> FcNameParse() documentation for help, but no luck.



> -Patrick
> On Fri, Sep 25, 2009 at 9:36 PM, Behdad Esfahbod<behdad at behdad.org>  wrote:
>> On 09/25/2009 06:25 PM, Patrick M. Rutkowski wrote:
>>> I'm very confused about how "fc-match" is supposed to work.
>>> I run something like: `fc-match :spacing=mono`, or the synonym
>>> `fc-match :spacing=100`, yet it does NOT give me a monospace font as I
>>> expected. I instead get:
>>> Vera.ttf "Bitstream Vera Sans" "Roamn"
>>> At the same time, `fc-list :spacing=mono fullname` shows that there
>>> are indeed monospace fonts on the system
>>> ...
>>> :fullname=Free Monospaced
>>> :fullname=DejaVu Sans Mono
>>> ...
>>> What's the deal here?
>> If you check fcmatch.c, you see that FC_SPACING has a lower priority than
>> FC_FAMILY, so that's matched first.
>>> I want to integrate libfreetype in my application for font searching
>>> in the Linux port. Is it really the case that I won't be able to do
>>> things like allow the user to ask for a monospace font and ACTUALLY
>>> GET ONE? (instead of Bitstream Vera Sans).
>> The right way to do that is to "fc-match monospace"
>> Cheers,
>> behdad
>>> Many thanks in advance
>>> -Patrick
> _______________________________________________
> Fontconfig mailing list
> Fontconfig at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/fontconfig

More information about the Fontconfig mailing list