Re: Asking FontConfig for a font that supports a script

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

 



Hi Behdad,

The software I'm working on has its own simple fallback mechanism, used if the user-specified font doesn't support a given character. If the character is a Latin character, the software wants to ask FontConfig for a Latin script font, and then will try to see if that font supports the character.

Yes, it's very simplistic, but we do have a more sophisticated hand-tuned mechanism in place for those situations where that's possible. We however need to cover the situation where no hand-tuned mechanism is available, and so we have to rely on FontConfig for this.

>If you
>check that file, you see that indeed FC_CHARSET is matched.  But it's up to
>you to populate the charset for different scripts.

By this you mean the software would call FcFreeTypeCharSet and associate it with each font on the system? I think this would not be efficient enough for our needs. A mechanism whereby the operator of the FontConfig setup on that device would associate particular fonts with particular scripts in the config files, just as happens for associating fonts with generic family names like serif or sans-serif, would be more desirable.

> It's loosely defined.  In the future it will be BCP49.  Right now it's
> "whatever glibc uses".  For useful values, check the fontconfig/fc-lang directory.

Thanks. It sounds like language matching is the next best facility we have available to script matching right now.

Best,
Sairus

-----Original Message-----
From: Behdad Esfahbod [mailto:behdad.esfahbod@xxxxxxxxx] On Behalf Of Behdad Esfahbod
Sent: Thursday, July 28, 2011 1:58 PM
To: Sairus Patel
Cc: fontconfig@xxxxxxxxxxxxxx
Subject: Re:  Asking FontConfig for a font that supports a script

Hi Sairus,

On 07/26/11 14:01, Sairus Patel wrote:
> I want to query FontConfig:
> - "give me a font for Latin characters"
> - "give me a font for Simplified Chinese characters"
> - "give me a font for Mathematical symbols"
> etc
> 
> Do I use FC_LANG when creating the pattern? It doesn't seem quite the right fit, since there are several languages, including "en", that use Latin characters. Yet the codebase I'm dealing with uses FC_LANG for this.
> 
> I thought FC_CHARSET might be a possibilty, but I don't see it used in FcDefaultSubstitute.

FcDefaultSubstitute is not the right place to look.  fcmatch.c is.  If you
check that file, you see that indeed FC_CHARSET is matched.  But it's up to
you to populate the charset for different scripts.

I have a hard time seeing how matching on whole scripts can be useful.  For
example, I don't think I have seen any font that supports the full Arabic
script.  Or even if there is, that's hardly ever a useful criteria since no
language uses the entire Arabic script as encoded in Unicode.  So, what is
your usecase?


> If FC_LANG is what I should use, then is the valid list of parameter values ISO 639-1? This seems to be suggested by http://www.freedesktop.org/software/fontconfig/fontconfig-devel/x31.html#AEN44.

It's loosely defined.  In the future it will be BCP49.  Right now it's
"whatever glibc uses".  For useful values, check the fontconfig/fc-lang directory.


> Or is it up to the person who sets up the config files?
> 
> I looked at thread "ISO 15924 font selection" in the archives but didn't see any resolution.

Yeah, we haven't been able to define a useful select-by-script behavior yet.
Suggestions are welcome.

Cheers,
behdad


> Thanks,
> Sairus
_______________________________________________
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