You are not logged in.

#1 2005-09-25 14:04:05

aquila_deus
Member
From: Taipei
Registered: 2005-07-02
Posts: 348
Website

Fake bold and italic fonts!

Assume you have a regular-style-only font called PMingLiU and you want to add bold and italic styles for it:

1.Edit fonts.cache-1 in PMingLiU's font dir (after running fc-cache):

Find its line:

"PMingLiU.ttf" 0 "PMingLiU:familylang=en:style=Regular:stylelang=en:slant=0:weight=80: ...

To create its italic style, copy and change "slant" to 100:

"PMingLiU.ttf" 0 "PMingLiU:familylang=en:style=Regular:stylelang=en:slant=100:weight=80: ...

To create its bold style, copy and change "weight" to 200:

"PMingLiU.ttf" 0 "PMingLiU:familylang=en:style=Regular:stylelang=en:slant=0:weight=200: ...

To create the bold italic style, copy and change both of "slant" and "weight":

"PMingLiU.ttf" 0 "PMingLiU:familylang=en:style=Regular:stylelang=en:slant=100:weight=200: ...

2.Now it's listed, but not real italic or bold yet. So you need to add the followings to ~/.fonts.conf:

<!--
  Emulate bold style
 -->
<match target="font">
  <test name="family" qual="any">
    <string>PMingLiU</string>
  </test>
  <test compare="more_eq" name="weight">
    <int>140</int>
  </test>
  <edit mode="assign" name="embolden">
    <bool>true</bool>
  </edit>
</match>

<!--
  Emulate italic style
 -->
<match target="font">
  <test name="family" qual="any">
    <string>PMingLiU</string>
  </test>
  <test compare="more_eq" name="slant">
    <int>80</int>
  </test>
  <edit name="matrix" mode="assign">
    <times>
      <name>matrix</name>
      <matrix><double>1</double><double>0.2</double>
        <double>0</double><double>1</double>
      </matrix>
    </times>
  </edit>
</match>

Done!

If you have many fonts to add, you could use something like the following in ~/.fonts.conf:

<test name="family" qual="any">
  <string>PMingLiU</string>
  <string>MingLiU</string>
  <string>FontXXX</string>
  <string>FontYYY</string>
</test>

Examples here =>
http://www.aqd.ath.cx/stuff-linux/config/fonts.cache-1
http://www.aqd.ath.cx/stuff-linux/config/fonts.conf


Cheers!

Offline

Board footer

Powered by FluxBB