aboutsummaryrefslogtreecommitdiffstats
path: root/_config/fontconfig/fonts.conf
blob: a4031e1d2ed215d6873fd361d35fb5b4f7b0931a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>

  <!--
      Custom font configurations

      System-wide location:
          /etc/fonts/local.conf
      User-wide location:
          $XDG_CONFIG_HOME/fontconfig/fonts.conf
          (default: ~/.config/fontconfig/fonts.conf)

      References:
      [1] https://freedesktop.org/software/fontconfig/fontconfig-user.html
      [2] https://wiki.archlinux.org/index.php/font_configuration
      [3] https://wiki.gentoo.org/wiki/Fontconfig
      [4] https://eev.ee/blog/2015/05/20/i-stared-into-the-fontconfig-and-the-fontconfig-stared-back-at-me/


      Aaron LI
      Created: 2014-04-06
      Updated: 2016-12-05
  -->

  <!--
      Set correct common families for custom "serif" and "monospace" fonts,
      otherwise fontconfig assumes any /unrecognized/ font is "sans-serif",
      thus cause *wrong fallback* fonts being found.
  -->
  <!-- "serif" faces -->
  <alias>
    <family>Source Serif Pro</family>
    <default><family>serif</family></default>
  </alias>
  <!-- "monospace" faces -->
  <alias>
    <family>Source Code Pro</family>
    <default><family>monospace</family></default>
  </alias>
  <alias>
    <family>Fira Code</family>
    <default><family>monospace</family></default>
  </alias>

  <!--
      By default, fontconfig assumes any unrecognized font is "sans-serif",
      so the above custom fonts now have *both* families.  Fix this.
  -->
  <match>
    <test compare="eq" name="family">
      <string>sans-serif</string>
    </test>
    <test compare="eq" name="family">
      <string>serif</string>
    </test>
    <!-- The "delete" applies to the *first* match -->
    <edit mode="delete" name="family"/>
  </match>
  <match>
    <test compare="eq" name="family">
      <string>sans-serif</string>
    </test>
    <test compare="eq" name="family">
      <string>monospace</string>
    </test>
    <edit mode="delete" name="family"/>
  </match>

  <!-- Font families preferences -->
  <!--
      <alias> elements provide a shorthand notation for the set of common
      match operations needed to substitute one font family for another.
      They contain a <family> element followed by optional <prefer>,
      <accept> and <default> elements.
  -->
  <!-- "serif" font family -->
  <alias>
    <!-- Which font family to be edited -->
    <family>serif</family>
    <!-- List of font families to *prepend before* the matching family -->
    <prefer>
      <family>Source Serif Pro</family>
      <family>Noto Serif</family>
    </prefer>
    <!-- List of font families to *append after* the matching family -->
    <accept></accept>
    <!-- List of font families to *append* to the *end* of matching family -->
    <default></default>
  </alias>
  <!-- "sans-serif" font family -->
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Source Sans Pro</family>
      <family>Noto Sans</family>
    </prefer>
  </alias>
  <!-- "monospace" font family -->
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Source Code Pro</family>
      <family>Fira Code</family>
      <family>Noto Mono</family>
    </prefer>
  </alias>

  <!-- Substitute Helvetica and Arial -->
  <match>
    <test name="family">
      <string>Helvetica</string>
    </test>
    <edit binding="same" mode="assign" name="family">
      <string>Source Sans Pro</string>
    </edit>
  </match>
  <match>
    <test name="family">
      <string>Arial</string>
    </test>
    <edit binding="same" mode="assign" name="family">
      <string>Source Sans Pro</string>
    </edit>
  </match>
</fontconfig>