Re: fontconfig match question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm forwarding this due to problems Behdad had in posting to the list.

His solution is clever.

Behdad Esfahbod wrote:

On Mon, 2006-07-17 at 12:22 -0400, Owen Taylor wrote:
On Mon, 2006-07-17 at 12:05 -0400, Stephen C. North wrote:
OK, "fail over to a default font" may not be quite the right way to describe
what happens.  At the end of the day, when fontconfig can't resolve a request
like "Cursive-Script-Like-Don-Knuth's-Handwriting at 12 pt" to anything
better, its rule of last resort substitutes a system default like "Sans".
In our world, we would consider this worth a runtime warning.  So, how can
I tell if the last resort rule was matched?  Just check if the family
is "Sans" when we didn't ask for "Sans"?
Basically, what you want to do is detect whether the resulting font
matches:

A) The family that was originally specified
B) A family that was added by an alias rule, except for families
   resulting indirectly from the rule in the default config:
"If the font still has no generic name, add sans-serif"

But that's hard to do. An approximation might be:

What about this:  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"


_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig

[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux