ubuntu 에서 폰트 우선순위 정하기 (7.10, 8.04)

Computing 2008. 6. 9. 13:27
홈 디렉토리에

.fonts.conf 를 아래와 같이 만든다 :

  1. shawn.ygdrasil:~$ cat .fonts.conf  
  2. <fontconfig>  
  3.   
  4. <!-- Always on antialiasing for Korean letters -->  
  5.   
  6. <match target="font">  
  7.         <edit name="antialias" mode="assign">  
  8.                 <bool>true</bool>  
  9.         </edit>  
  10.         <edit name="autohint" mode="assign">  
  11.                 <bool>false</bool>  
  12.         </edit>  
  13.         <edit name="hintstyle" mode="assign">  
  14.                 <const>hintmedium</const>  
  15.         </edit>  
  16. </match>  
  17.   
  18. <!-- Set preferred Korean fonts -->  
  19.   
  20. <match target="font">  
  21.         <test name="lang" compare="contains">  
  22.                 <string>ko</string>  
  23.         </test>  
  24.         <alias>  
  25.                 <family>serif</family>  
  26.                 <prefer>  
  27.                         <family>Malgun Gothic</family>  
  28.                 </prefer>  
  29.         </alias>  
  30. </match>  
  31. <match target="font">  
  32.         <test name="lang" compare="contains">  
  33.                 <string>ko</string>  
  34.         </test>  
  35.         <alias>  
  36.                 <family>sans-serif</family>  
  37.                 <prefer>  
  38.                         <family>Malgun Gothic</family>  
  39.                         <family>UnDotum</family>  
  40.                 </prefer>  
  41.         </alias>  
  42. </match>  
  43. <match target="font">  
  44.         <test name="lang" compare="contains">  
  45.                  <string>ko</string>  
  46.         </test>  
  47.         <alias>  
  48.                 <family>monospace</family>  
  49.                 <prefer>  
  50.                         <family>Malgun Gothic</family>  
  51.                         <family>UnDotum</family>  
  52.                 </prefer>  
  53.         </alias>  
  54. </match>  
  55.   
  56. </fontconfig>  


필요하다면 /etc/fonts/conf.avail/ 디렉토리 아래의 language-selector 들 중 ko-kr 파일을 수정해 준다.

  1. shawn.ygdrasil:~$ cat ko_KR   
  2. <fontconfig>  
  3.         <include ignore_missing="yes">CJK_aliases</include>  
  4.   
  5. <!-- Turn on antialias and hinting with hintmedium -->  
  6. <match target="font" >  
  7.         <edit mode="assign" name="antialias" >  
  8.                 <bool>true</bool>  
  9.         </edit>  
  10. </match>  
  11. <match target="font" >  
  12.         <edit mode="assign" name="hinting" >  
  13.                 <bool>true</bool>  
  14.         </edit>  
  15. </match>  
  16. <match target="font" >  
  17.         <edit mode="assign" name="hintstyle" >  
  18.                 <const>hintmedium</const>  
  19.         </edit>  
  20. </match>  
  21.   
  22. <!-- Control spacing property for Korean -->  
  23. <match target="font">  
  24.         <test name="lang" compare="contains">  
  25.                 <string>ko</string>  
  26.         </test>  
  27.         <test name="spacing" compare="eq">  
  28.                 <const>dual</const>  
  29.         </test>  
  30.         <edit name="spacing">  
  31.                 <const>proportional</const>  
  32.         </edit>  
  33.         <edit name="globaladvance" binding="strong">  
  34.                 <bool>false</bool>  
  35.         </edit>  
  36. </match>  
  37. <match target="font">  
  38.         <test name="lang" compare="contains">  
  39.                 <string>ko</string>  
  40.         </test>  
  41.         <test name="outline" compare="eq">  
  42.                 <bool>false</bool>  
  43.         </test>  
  44.         <test name="spacing" compare="eq">  
  45.                 <const>mono</const>  
  46.                 <const>charcell</const>  
  47.         </test>  
  48.         <edit name="spacing">  
  49.                 <const>proportional</const>  
  50.         </edit>  
  51.         <edit name="globaladvance" binding="strong">  
  52.                 <bool>false</bool>  
  53.         </edit>  
  54.         </match>  
  55.   
  56. <!-- Turn off antialias and autohint for Korean fonts depending on pixelsize -->  
  57. <match target="font">  
  58.         <test name="lang" compare="contains">  
  59.                 <string>ko</string>  
  60.         </test>  
  61.         <test name="pixelsize" compare="more">  
  62.                 <int>10</int>  
  63.         </test>  
  64.         <test name="pixelsize" compare="less">  
  65.                 <int>22</int>  
  66.         </test>  
  67.         <edit name="antialias" mode="assign">  
  68.                 <bool>true</bool>  
  69.         </edit>  
  70.         <edit name="autohint" mode="assign">  
  71.                 <bool>false</bool>  
  72.         </edit>  
  73.         <edit name="hintstyle" mode="assign">  
  74.                 <const>hintmedium</const>  
  75.         </edit>  
  76. </match>  
  77.   
  78. <!-- Turn on antialias and hinting with hintmedium for ttf-Unfonts -->  
  79. <match target="font">  
  80.         <test name="family" compare="contains">  
  81.                 <string>Un</string>  
  82.         </test>  
  83.         <edit name="antialias" mode="assign">  
  84.                 <bool>true</bool>  
  85.         </edit>  
  86.         <edit name="hinting" mode="assign">  
  87.                 <bool>true</bool>  
  88.         </edit>  
  89.         <edit name="hintsytle" mode="assign">  
  90.                 <const>hintmedium</const>  
  91.         </edit>  
  92. </match>  
  93.   
  94. <!-- Turn off antialias and autohint for ttf-alee depending on pixelsize -->  
  95. <match target="font">  
  96.         <test name="family">  
  97.                 <string>Guseul</string>  
  98.         </test>  
  99.         <edit name="autohint" mode="assign">  
  100.                 <bool>true</bool>  
  101.         </edit>  
  102. </match>  
  103. <match target="font">  
  104.         <test name="family">  
  105.                 <string>Guseul</string>  
  106.                 <string>Guseul Mono</string>  
  107.         </test>  
  108.         <test name="pixelsize" compare="more">  
  109.                 <int>11</int>  
  110.         </test>  
  111.         <test name="pixelsize" compare="less">  
  112.                 <int>16</int>  
  113.         </test>  
  114.         <edit name="antialias" mode="assign">  
  115.                 <bool>true</bool>  
  116.         </edit>  
  117.         <edit name="autohint" mode="assign">  
  118.                 <bool>false</bool>  
  119.         </edit>  
  120. </match>  
  121.   
  122. <!-- Set preferred Korean fonts -->  
  123. <match target="font">  
  124.         <test name="lang" compare="contains">  
  125.                 <string>ko</string>  
  126.         </test>  
  127.         <alias>  
  128.                 <family>serif</family>  
  129.                 <prefer>  
  130.                         <family>UnBatang</family>  
  131.                 </prefer>  
  132.         </alias>  
  133. </match>  
  134. <match target="font">  
  135.         <test name="lang" compare="contains">  
  136.                 <string>ko</string>  
  137.         </test>  
  138.         <alias>  
  139.                 <family>sans-serif</family>  
  140.                 <prefer>  
  141.                         <family>UnDotum</family>  
  142.                         <family>Guseul</family>  
  143.                 </prefer>  
  144.         </alias>  
  145. </match>  
  146. <match target="font">  
  147.         <test name="lang" compare="contains">  
  148.                 <string>ko</string>  
  149.         </test>  
  150.         <alias>  
  151.                 <family>monospace</family>  
  152.                 <prefer>  
  153.                         <family>UnDotum</family>  
  154.                         <family>Guseul Mono</family>  
  155.                 </prefer>  
  156.         </alias>  
  157. </match>  
  158.   
  159. <!-- Bind EunGuseul with Bitstream Vera Sans -->  
  160. <match target="pattern">  
  161.         <test name="family">  
  162.                 <string>Guseul</string>  
  163.         </test>  
  164.         <edit mode="append" binding="strong" name="family">  
  165.                 <string>Bitstream Vera Sans</string>  
  166.         </edit>  
  167. </match>  
  168.   
  169. <!-- Bind EunGuseul Mono with Bitstream Vera Sans Mono -->  
  170. <match target="pattern">  
  171.         <test name="family">  
  172.                 <string>Guseul Mono</string>  
  173.         </test>  
  174.         <edit mode="append" binding="strong" name="family">  
  175.                 <string>Bitstream Vera Sans Mono</string>  
  176.         </edit>  
  177. </match>   
  178.   
  179. </fontconfig>  


language selector 까지는 수정하지 않아도 그럭저럭 만족스러운 결과가 나온다.
위의 설정파일들은 맑은고딕을 설치한 후의 설정이니 주의할 것.
: