10-scale-bitmap-fonts.conf revision a32e9e42
1<?xml version="1.0"?>
2<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
3<fontconfig>
4  <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
5    <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
6  </its:rules>
7
8  <description>Bitmap scaling</description>
9<!--
10  If font is bitmap, calculate scale factor.
11  Note that color bitmap fonts have scalable=true, while
12  non-color ones have scalable=false.  Both groups have outline=false.
13  -->
14<match target="font">
15  <test name="outline" compare="eq">
16    <bool>false</bool>
17  </test>
18  <edit name="pixelsizefixupfactor" mode="assign">
19    <divide>
20      <name target="pattern">pixelsize</name>
21      <name target="font"   >pixelsize</name>
22    </divide>
23  </edit>
24</match>
25<!--
26  For non-scalable bitmap fonts (ie. non-color), skip
27  minor scaling if hinting is enabled.
28  -->
29<match target="font">
30  <test name="outline" compare="eq">
31    <bool>false</bool>
32  </test>
33  <test name="scalable" compare="eq">
34    <bool>false</bool>
35  </test>
36  <test name="hinting" compare="eq">
37    <bool>true</bool>
38  </test>
39  <edit name="scalingnotneeded" mode="assign">
40    <and>
41      <less>
42        <name>pixelsizefixupfactor</name>
43        <double>1.2</double>
44      </less>
45      <more>
46        <name>pixelsizefixupfactor</name>
47        <double>0.8</double>
48      </more>
49    </and>
50  </edit>
51</match>
52<match target="font">
53  <test name="scalingnotneeded" compare="eq">
54    <bool>true</bool>
55  </test>
56  <edit name="pixelsizefixupfactor" mode="assign">
57    <double>1.0</double>
58  </edit>
59</match>
60<!--
61  If we *are* going to scale, go ahead and do it.
62  -->
63<match target="font">
64  <test name="outline" compare="eq">
65    <bool>false</bool>
66  </test>
67  <test name="pixelsizefixupfactor" compare="not_eq">
68    <double>1.0</double>
69  </test>
70  <edit name="matrix" mode="assign">
71    <times>
72      <name>matrix</name>
73      <matrix>
74        <name>pixelsizefixupfactor</name> <double>0</double>
75        <double>0</double> <name>pixelsizefixupfactor</name>
76       </matrix>
77    </times>
78  </edit>
79  <edit name="size" mode="assign">
80    <divide>
81      <name>size</name>
82      <name>pixelsizefixupfactor</name>
83    </divide>
84  </edit>
85</match>
86
87</fontconfig>
88