Linux下中文支持
这里说的是在英文界面下的中文显示及输入。
UTF-8
在GentooLinux中,建立一个文件/etc/env.d/10lang,内容为
LANG="en_US.UTF-8"
中文字体
拷贝需要的中文字体文件到/usr/share/fonts目录下。修改/etc/fonts/fonts.conf,调整字体渲染顺序,比如将SimSun放到稍前的位置。
中文粗体
fontconfig-2.3.2、freetype-2.1.10或以上版本不需要补丁就可以支持中文粗体。比如在GentooLinux中,emerge xorg-x11之前,在/etc/portage/package.keywords中增加
=media-libs/fontconfig-2.3.2 ~x86 =media-libs/freetype-2.1.10 ~x86
(UbuntuLinux Dapper版本已经支持中文粗体)
修改/etc/fonts/local.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<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>
<match target="font" >
<test name="family" qual="any" >
<string>SimSun</string>
<string>SimHei</string>
<string>NSimSun</string>
<string>NSimSun</string>
<string>宋体</string>
<string>黑体</string>
</test>
<test name="pixelsize" compare="more">
<double>11</double>
</test>
<test name="pixelsize" compare="less">
<double>16</double>
</test>
<edit mode="assign" name="antialias" >
<bool>false</bool>
</edit>
<edit name="globaladvance" mode="assign">
<bool>false</bool>
</edit>
</match>
<!-- Enable sub-pixel rendering -->
<match target="font">
<test qual="all" name="rgba">
<const>unknown</const>
</test>
<edit name="rgba" mode="assign"><const>rgb</const></edit>
</match>
<!-- Use the Autohinter -->
<match target="font">
<edit name="autohint" mode="assign"><bool>false</bool></edit>
</match>
<!-- Disable Autohinting for bold fonts -->
<match target="font">
<test name="weight" compare="more">
<const>medium</const>
</test>
<edit name="autohint" mode="assign"><bool>false</bool></edit>
</match>
<!-- Exclude/Include a range of fonts for Anti Aliasing -->
<!--
<match target="font">
<test qual="any" name="size" compare="more">
<double>9</double>
</test>
<test qual="any" name="size" compare="less">
<double>14</double>
</test>
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
</match>
-->
<!-- And/Or disable Anti Aliasing for a range on pixel-based size.
Disabling this using both methods seems to fix Firefox. -->
<!--
<match target="font">
<test compare="less" name="pixelsize" qual="any">
<double>20</double>
</test>
<edit mode="assign" name="antialias">
<bool>false</bool>
</edit>
</match>
-->
</fontconfig>
中文输入法
使用scim平台。
在GentooLinux中,emerge scim。使用拼音输入法,再emerge scim-chinese。 创建文件/etc/X11/xinit/xinitrc.d/90-scim,内容为
#!/bin/bash export XMODIFIERS="@im=SCIM" export GTK_IM_MODULE="xim" export QT_IM_MODULE="xim" /usr/bin/scim -d
可以编辑/etc/gtk-2.0/gtk.immodules文件,注释掉不需要的输入法。只需要保留xim就可以了。
