[Fontconfig] Bitmap font resizing

Behdad Esfahbod behdad at behdad.org
Sun Dec 30 17:26:00 PST 2012


On 12-12-29 06:24 PM, Behdad Esfahbod wrote:
>> > I'm not sure about using the 'dpi' and 'size'
>> > properties to calculate the scaling factor because these properties will not
>> > always be there.
> Agreed.  The target="font" approach is the right way to do it.

This is now in master too, and I really like it.  I can now do a config like
this and it all works:

<match target="font">
  <test name="scalable" compare="eq">
    <bool>false</bool>
  </test>
  <edit name="pixelsizefixupfactor" mode="assign">
    <divide>
      <name target="pattern">pixelsize</name>
      <name target="font"   >pixelsize</name>
    </divide>
  </edit>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix>
        <name>pixelsizefixupfactor</name> <double>0</double>
        <double>0</double> <name>pixelsizefixupfactor</name>
       </matrix>
    </times>
  </edit>
  <edit name="size" mode="assign">
    <divide>
      <name>size</name>
      <name>pixelsizefixupfactor</name>
    </divide>
  </edit>
</match>

The nice thing about this config is that it doesn't touch the pixelsize so
clients that directly pass that to FreeType will continue working.  Clients
that support matrix on bitmaps will pickup the resizing.

All that is left is to come up with a sane default config.  I'll give it a try
and report back.


-- 
behdad
http://behdad.org/


More information about the Fontconfig mailing list