2008-06-09

Font substitution in X Windows

The font technology incorporated in graphics systems (MS Windows, X Windows, printing) is really complicated. As George Williams, FontForge creator, mentioned in an interview, he wasn't concious of all purposes of OpenType features (the fragment about Arabic characters in OpenType).

That is why I'm not surprised how though is to configure fonts in Linux properly. But I found a nice guide on Ubuntu Forum, which can be a how-to for all X Windows systems: HOWTO: Hoary ClearType-like fonts. Don't be confused - you can modify the guide according to your personal preferences, and you don't need to copy MS Windows behavior on your desktop :-)

Here is my ~/.fonts.conf:
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<match target="font">
  <test compare="more" name="pixelsize" qual="any">
   <double>12</double>
  </test>
  <edit name="autohint" mode="assign" >
   <bool>true</bool>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>Arial</string>
  </test>
  <edit name="family" mode="assign">
   <string>DejaVu Sans Condensed</string>
  </edit>
</match>
<match target="pattern">   <test qual="any" name="family">    <string>Helvetica</string>   </test>   <edit name="family" mode="assign">    <string>DejaVu Sans Condensed</string>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>sans-serif</string>
  </test>
  <edit name="family" mode="assign">
   <string>DejaVu Sans Condensed</string>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>Times</string>
  </test>
  <edit name="family" mode="assign">
   <string>AntykwaTorunska</string>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>serif</string>
  </test>
  <edit name="family" mode="assign">
   <string>AntykwaTorunska</string>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>monospaced</string>
  </test>
  <edit name="family" mode="assign">
   <string>Inconsolata</string>
  </edit>
</match>
<match target="pattern">
  <test qual="any" name="family">
   <string>Courier</string>
  </test>
  <edit name="family" mode="assign">
   <string>Inconsolata</string>
  </edit>
</match>
</fontconfig>


After this disposition, you won't see Arial any more. Even on font list in preferences window Arial is substituted to a font specified in your ~/.fonts.conf. And mplayer's subtitles also :-)

PS
Zygfryd Gardzielewski's Antykwa ToruĊ„ska from 1960:

No comments: