[Fontconfig] any possible trouble by adding lang to the pattern by default

Raimund Steger rs at mytum.de
Tue May 29 15:02:58 PDT 2012


Jjgod Jiang wrote:
> Hi,
>
> On Tue, May 29, 2012 at 10:10 PM, Keith Packard<keithp at keithp.com>  wrote:
>> Just edit the lang field in the pattern.
>
> But how do you set lang field to be exactly the current value of your
> LANG/FC_LANG variable? I think the point is to make it dynamic rather
> than a static value written to a local file.

LANG (as opposed to FC_LANG) *is* already used to provide a default 
value dynamically, provided programs use FcDefaultSubstitute which I 
think they all do.

(BTW- Akira- is there a special reason why applying the new string set 
needed to be done in FcConfigSubstituteWithPat in addition to 
FcDefaultSubstitute?)

In case you need a different configuration for individual programs and 
cannot modify LANG for those, i. e. as would be possible through 
FC_LANG, I suspect you could create a file like:

<fontconfig>
   <include>/etc/fonts/fonts.conf</include>
   <match target="pattern">
     <test name="lang" qual="all" compare="not_eq">
       <string>ja</string>
     </test>
     <edit name="lang" mode="prepend">
       <string>ja</string>
       <string>zh-cn</string>
     </edit>
   </match>
</fontconfig>

(i. e., assigning 'ja','zh-cn' to 'lang' in case no 'lang' was in the 
pattern (unlikely) or 'ja' was not in it)

and use:

FONTCONFIG_FILE=your.config.file fc-match

because that will redirect fontconfig configuration for that single 
operation to your file. It would mean you need to have as many of those 
configuration files as you would have possible settings of your FC_LANG 
variable that are not matched by settings of the LANG variable (are they 
that many..??)

Raimund



More information about the Fontconfig mailing list