fonts.conf-盡可能使用Droid字體


2

我希望盡可能使用Droid字體。所以我用以下內容創建了~/.fonts.conf

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Droid</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Droid</family>
    </prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer>
      <family>Droid</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Liberation</family>
    </prefer>
  </alias>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>none</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintmedium</const>
  </edit>
 </match>
 <dir>~/.fonts</dir>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
</fontconfig>

但是我在控制台中得到了這個

[email protected]:~/Documents$ fc-match sans
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
DejaVuSans.ttf: "DejaVu Sans" "Book"

我嘗試重新啟動計算機,但得到相同的結果。

如何強制Ubuntu在可能的情況下使用Droid字體?

2

Ok, i replaced 'Droid' with 'Droid Sans', 'Droid Serif', etc., and it worked:

[email protected]:~/Documents$ fc-match sans
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
DroidSans.ttf: "Droid Sans" "Regular"
[email protected]:~/Documents$ fc-match serif
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
DroidSerif-Regular.ttf: "Droid Serif" "Regular"
[email protected]:~/Documents$ fc-match sans-serif
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
DroidSans.ttf: "Droid Sans" "Regular"
[email protected]:~/Documents$ fc-match mono
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading configurations from ~/.fonts.conf is deprecated.
LiberationMono-Regular.ttf: "Liberation Mono" "Regular"
[email protected]:~/Documents$ 

Then i added more patterns to the file, and now fonts are replaced in browser:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <alias>
    <family>serif</family>
    <prefer>
      <family>Droid Serif</family>
    </prefer>
  </alias>
  <alias>
    <family>sans-serif</family>
    <prefer>
      <family>Droid Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>sans</family>
    <prefer>
      <family>Droid Sans</family>
    </prefer>
  </alias>
  <alias>
    <family>monospace</family>
    <prefer>
      <family>Liberation Mono</family>
    </prefer>
  </alias>

  <!-- Replace Arial, Times New Roman, Verdana and Courier New -->
  <!-- with their counterparts. Strong binding used to override -->
  <!-- distribution defaults -->
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Arial</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Dorid Sans</string>
    </edit>
  </match>
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Times New Roman</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Droid Serif</string>
    </edit>
  </match>
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Verdana</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Droid Sans</string>
    </edit>
  </match>
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Helvetica</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Droid Sans</string>
    </edit>
  </match>
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Courier New</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Liberation Mono</string>
    </edit>
  </match>
  <match target="pattern" name="family">
    <test name="family" qual="any">
      <string>Courier</string>
    </test>
    <edit name="family" mode="assign" binding="strong">
      <string>Liberation Mono</string>
    </edit>
  </match>


  <match target="font">
  <edit mode="assign" name="rgba">
   <const>none</const>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
 </match>
 <match target="font">
  <edit mode="assign" name="hintstyle">
   <const>hintmedium</const>
  </edit>
 </match>
 <dir>~/.fonts</dir>
 <match target="font">
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
 </match>
</fontconfig>