[Fontconfig] Scalable pattern matching

Patrick Lam plam at MIT.EDU
Sun Mar 5 20:40:30 PST 2006

Rich Baumann wrote:
> Hi,
> 	I need fontconfig to return only scalable fonts from FcFontMatch but
> I've been unable to figure out how to do so. I've tried adding
> FC_SCALABLE, FcTrue to the search pattern, but if the first (or only)
> matching family name in the search pattern is for a bitmap font,
> fontconfig returns a pattern for that font, even if a later family name
> in the search pattern matches a scalable font. Am I missing something in
> the API, or is it not possible to get the behavior I need? I've been
> told that there's a way to build fontconfig so that it doesn't support
> bitmap fonts, however this is for use in a graphics library, not just
> for my personal use, so that's a non-option.

As I understand it, the problem is that you're specifying a match 
pattern that contains multiple elements, say, 
:family=sans:scalable=true.  It doesn't know whether you wanted to match 
on family or scalable, so it arbitrarily picks one of these for you to 
match on.

Try using FcFontSort and then throwing out the fonts that don't contain 
FC_SCALABLE=true; that is, iterate through the list and pick the first 
font in the sorted list which is scalable.


More information about the Fontconfig mailing list