Fontconfig Tip of the Day
Many fontconfig users ask how they can detect whether fontconfig failed to find the requested font.
It's not obvious, as fontconfig has knowledge to substituted avilable similar fonts. For example, if you ask for Helvetica, it will return the Free metric-compatible "Nimbus Sans L". So you cannot just compare the family name of the match.
Here is the trick as I found it today: match font for "YourFamily,sans", and "YourFamily,serif". If they return the same family, it's a match, if they don't, it's junk fallback.
[behdad@home ~]$ fc-match "Helvetica,serif"
n019003l.pfb: "Nimbus Sans L" "Regular"
[behdad@home ~]$ fc-match "Helvetica,sans"
n019003l.pfb: "Nimbus Sans L" "Regular"
[behdad@home ~]$ fc-match "NonExistant,serif"
VeraSe.ttf: "Bitstream Vera Serif" "Roman"
[behdad@home ~]$ fc-match "NonExistant,sans"
Vera.ttf: "Bitstream Vera Sans" "Roman"
Owen's thoughts
about the issue.