[Fontconfig] Another proposal for saving custom fonts in fontconfig

Nicolas Mailhot nicolas.mailhot at laposte.net
Wed Jun 26 11:49:08 UTC 2019


Le 2019-06-26 12:16, Akira TAGOH a écrit :

> Indeed, it looks like feasible like what you said. but if I understand
> correctly, it isn't a custom family name for varfonts but style name.
> Though I doubt how one can effectively name it less than actual
> parameters of fontvariations.

Then I'd expect something like:

   <match target="scan">
     <test name="fullname">
       <string>original starting point</string>
     </test>
     <edit name="family">
       <string>clean family name</string> (if necessary; quite often, 
will be ne necessary)
     </edit>
     <edit name="style">
       <string>clean original style, with default axis values</string> 
(if original style needs changing; alternatively, some way to hide the 
default style)
     </edit>
     <add name="style">
       <string>synthetic style1</string>
       <axis>
         <string>axis name</string>
         <double>axis value</double> (if double is the correct thing 
here)
       </axis>
     </add>
     <add name="style">
       <string>synthetic style2</string>
       <axis>
         <string>axis name</string>
         <double>axis value</double>
       </axis>
     </add>
     <edit name="fullname" value="auto"/>
   </match>

The main fontconfig syntax change to do such things reliably is
   <edit name="fullname" value="auto"/> ← compute the correct fullname, 
using WWS rules, for family + style

which should probably have
   <edit name="family" value="auto"/>  ← derive the correct family from 
fullname, using WWS rules
   <edit name="style" value="auto"/>   ← derive the correct style  from 
fullname, using WWS rules

Because what makes such operations fail is practice, is the way family 
and style need to be defined both in fullname and family and style, and 
people + software keep making mistakes doing just one of them, or 
specifying inconsistent values at both layers.

*if* fontconfig was smart enough, and upstream naming was clean, it 
could be simplified into

   <match target="scan">
     <test name="family">
       <string>family to operate on</string>
     </edit>
     <unset name="style"/>
     <add name="style">
       <string>synthetic style1</string>
       <axis>
         <string>axis name</string>
         <double>axis value</double>
       </axis>
     </add>
     <add name="style">
       <string>synthetic style2</string>
       <axis>
         <string>axis name</string>
         <double>axis value</double>
       </axis>
     </add>
     <edit name="fullname" value="auto"/>
   </match>

(if fontconfig is able to autoselect, the original style most closely 
matching the synthetic to add, without needing a fullname help)

-- 
Nicolas Mailhot


More information about the Fontconfig mailing list