QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2222|回复: 0

原创: 文泉驿点阵与SimSun共存解决方案

[复制链接]
发表于 2007-2-15 22:44:11 | 显示全部楼层 |阅读模式
小弟在使用文泉驿点阵字体过程中发现,它对大字体支持的不太好。于是小弟采用小字体采用文泉驿,
大字体采用SimSun的,英文采用Tahoma的方案,效果不错,也解决了SimSun小号字粗体发毛的问题。


1)从Win下把SimSun和Tahoma拷到FreeBSD中,建立一个字体目录:
[code:1]
  mkdir /usr/X11R6/lib/X11/fonts/zh_CN.fonts
  cp simsun.ttf /usr/X11R6/lib/X11/fonts/zh_CN.fonts
  cp tahoma.ttf /usr/X11R6/lib/X11/fonts/zh_CN.fonts
  cp tahomad.ttf /usr/X11R6/lib/X11/fonts/zh_CN.fonts

  fc-cache -fv
[/code:1]


2)再安装ports中提供的wqy字体
[code:1]
  pkg_add wqy-0.7.0,1.tbz
[/code:1]

3)把下面的local.conf拷贝到/usr/X11R6/etc/fonts目录即可,如果以前修改过fonts.conf的话,也是没有影响的。
[code:1]
  <?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- ~/.fonts.conf file to configure local fonts with SimSun and Tahoma -->
<fontconfig>

   <!-- chinese fonts directory -->
   <dir>/usr/X11R6/lib/X11/fonts/TrueType</dir>
   <dir>/usr/X11R6/lib/X11/fonts/zh_CN.fonts</dir>
   <dir>/usr/X11R6/lib/X11/fonts/wqy</dir>

   <!-- support oblique font -->
   <match target="font">
      <!-- check to see if the font is roman -->
      <test name="slant">
         <const>roman</const>
      </test>
      <!-- check to see if the pattern requested non-roman -->
      <test target="pattern" name="slant" compare="not_eq">
         <const>roman</const>
      </test>
      <!-- multiply the matrix to slant the font -->
      <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>
      <!-- pretend the font is oblique now -->
      <edit name="slant" mode="assign">
         <const>oblique</const>
      </edit>
   </match>

   <!-- support bold font -->
   <match target="font">
      <!-- check to see if the font is just regular -->
      <test name="weight" compare="less_eq">
         <int>100</int>
      </test>
      <!-- check to see if the pattern requests bold -->
      <test target="pattern" name="weight" compare="more_eq">
         <int>180</int>
      </test>
      <!-- set the embolden flag -->
      <edit name="embolden" mode="assign">
         <bool>true</bool>
      </edit>
   </match>

   <!--support auto hints -->
   <match target="font" >
      <edit mode="assign" name="antialias" >
         <bool>true</bool>
      </edit>
      <edit mode="assign" name="hintstyle" >
         <const>hintslight</const>
      </edit>
      <edit mode="assign" name="hinting" >
         <bool>true</bool>
      </edit>
      <edit mode="assign" name="autohint" >
         <bool>false</bool>
      </edit>
   </match>

   <!-- close auto hints when size between 8 and 17 -->
   <match target="font" >
      <!--
      <test compare="contains" name="lang" >
         <string>zh-cn</string>
         <string>zh-tw</string>
         <string>ja</string>
         <string>ko</string>
      </test>
      -->
      <test compare="more_eq" name="pixelsize" qual="any" >
         <double>8</double>
      </test>
      <test compare="less_eq" name="pixelsize" qual="any" >
         <double>17</double>
      </test>
      <edit mode="assign" name="antialias" >
         <bool>false</bool>
      </edit>
   </match>

   <!-- resolve mono fonts too widely -->
   <match target="font">
      <test compare="contains" name="lang" >
         <string>zh-cn</string>
         <string>zh-tw</string>
         <string>ja</string>
         <string>ko</string>
      </test>
      <edit name="spacing">
         <const>proportional</const>
      </edit>
      <edit name="globaladvance">
         <bool>false</bool>
      </edit>
   </match>

   <!-- set smallest font size -->
   <match target="font" >
      <!--
      <test compare="contains" name="lang" >
         <string>zh-cn</string>
         <string>zh-tw</string>
         <string>ja</string>
         <string>ko</string>
      </test>
      -->
      <test compare="more_eq" name="pixelsize" >
         <int>8</int>
      </test>
      <test compare="less_eq" name="pixelsize" >
         <int>12</int>
      </test>
      <edit compare="eq" name="pixelsize" >
         <int>12</int>
      </edit>
   </match>

   <!-- set font WenQuanYi , Tahoma , SimSun -->
   <match target="pattern">
      <test qual="any" name="family">
         <string>Serif</string>
         <string>Sans-Serif</string>
      </test>
      <edit name="family" mode="prepend_first" binding="strong">
         <string>WenQuanYi Bitmap Song</string>
      </edit>
      <edit name="family" mode="prepend_first" binding="strong">
         <string>Tahoma</string>
      </edit>

   </match>

   <!-- replace mono fonts with WenQuanYi -->
   <match target="pattern">
      <test qual="any" name="family">
         <string>monospace</string>
      </test>
      <edit name="family" mode="prepend_first" binding="strong">
         <string>WenQuanYi Bitmap Song</string>
      </edit>
   </match>


   <!-- change WenQuanYi to SimSun when big fonts -->
   <match target="pattern" >
      <test target="font" compare="more_eq" name="pixelsize" >
         <int>17</int>
      </test>
      <test qual="any" name="family">
         <string>Serif</string>
         <string>Sans-Serif</string>
      </test>
      <edit name="family" mode="prepend_first" binding="strong">
         <string>SimSun</string>
      </edit>
      <edit name="family" mode="prepend_first" binding="strong">
         <string>Tahoma</string>
      </edit>
   </match>

</fontconfig>
[/code:1]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

×
您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-4-26 04:31 , Processed in 0.092315 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表