debian 安装xwindow 中文桌面
时间:2006-06-17 来源:heavyrain
could not open default font 'fixed' #该行无法打开默认字体。
原因:a、字库没有安装。
b、字库安装后加载点加载无效,加载点路径不正确或权限不够。 安装 xfs(字体服务器) 、 安装字体包 xfonts-base
debian中文桌面的快速构建
作者: EricNeon
来自: www.linuxsir.org
在debian的中文美化时,基本可以按照我这样的步骤来做。我也是参考了香港debian桌面安装大赛时采用的方式,步骤顺序上做了调整,并在debian和gentoo系统上测试成功。
1.第一步,产生语系(locale)
如果没有安装locales的请安装locales:
#apt-get install locales |
#dpkg-reconfigure locales |
en_US.ISO-8859-1 en_US.UTF-8 zh_CN.GB2312 zh_CN.UTF-8 zh_CN.GBK zh_TW.BIG5 zh_TW.UTF-8 |
再将默认locale选择为“C”。然后用“locale -a”来查看现在系统中所有支持的语系,
#locale -a C POSIX en_US.ISO-8859-1 en_US.UTF-8 zh_CN.GB2312 zh_CN.UTF-8 zh_CN.GBK zh_TW.BIG5 zh_TW.UTF-8 |
#locale LANG=C LC_ALL=POSIX LC_CTYPE=POSIX ... |
2.建议先安装firefly修正的一些包。
同样在/etc/apt/sources.list中加入源地址:
deb http://debian.okey.net/debian-uo/ sid firefly 或者deb ftp://ftp.hk.debian.org/unofficial/firefly/binary-i386 ./ |
#apt-get update #apt-get install ttf-firefly-sung |
#apt-cache search firefly |
3.安装字体
linux中最常用的中文字体是文鼎的四套中文字体:ttf-arphic-bkai00mp(文鼎PL中楷AR PL KaitiMBig5,包含BIG5中13000个繁体字),ttf-arphic-gbsn00lp(文鼎PL简报宋AR PL SungtiLGB,包含GB2312中7000多个简体),ttf-arphic-bsmi00lp(文鼎PL细上海宋AR PL Mingti2L Big5)以及ttf-arphic-gkai00mp(文鼎PL KaitiMGB,包含GB2312中7000多个简体字)。这些字体可以直接通过apt来安装。
#apt-get install ttf-arphic-bkai00mp tf-arphic-gbsn00lp ttf-arphic-bsmi00lp ttf-arphic-gkai00mp |
但是由于中文字体笔画繁多,矢量字体加上Anti-Alias在细尺寸时反而显得模糊不清。这里我推荐使用台湾萤火虫(firefly)合并衬线后的新字体——文鼎PL新宋。
在/etc/apt/sources.list中加上新宋字体的apt仓库源:
deb ftp://debian.linux.org.tw/pub/apt unstable main 或者 deb ftp://ftp.hk.debian.org/unoffical/dlot-apt unstable main |
#apt-get update #apt-get install ttf-fireflysung |
接着就是安装文鼎的四个字体,自由字体中英文字体效果比较好的有Bitstream Vera Sans字体和DejaVu字体。特别是这个DejaVu字体是fundawang提及的将在Mandrake中采用的英文字体,我在gentoo和dbeian中测试效果都好于Bitstream Vera字体,故推荐使用。
#apt-get install ttf-bitstream-vera ttf-dejavu |
为了提高对微软平台的兼容程度,我也建议安装msttcorefonts这一套微软的英文字体。这套字体包含了AndalMono、ArialBlack、Arial、ComicSansMS、Georgia、Impact、TimesNew Roman、Times、Trebuchet、Verdana和Webdings等11种字体。
#apt-get install msttcorefonts |
4.设置Fontconfig这一步非常重要,也许你是安装了非常好看的字体,但是如果你不修正你的Fontconfig,再好看的效果也不一定出来。
首先我们编辑/etc/fonts/fonts.conf这个文件,检查字体的使用顺序,把你要用的效果最好的字体放在最前面。
重排Serif字体显示顺序:
<alias> <family>serif</family> <prefer> <family>DejaVu Serif</family> <family>Bitstream Vera Serif</family> <family>Times New Roman</family> <family>Times</family> <family>AR PL New Sung</family> <family>SimSun</family> <family>Luxi Serif</family> <family>AR PL Mingti2L Big5</family> <family>AR PL SungtiL GB</family> <family>Ming(ISO10646)</family> <family>Kochi Mincho</family> <family>Baekmuk Batung</family> </prefer> </alias> |
重排sans-serif字体显示顺序:
<alias> <family>sans-serif</family> <prefer> <family>DejaVu Serif</family> <family>Bitstream Vera Sans</family> <family>Arial</family> <family>Verdana</family> <family>Helvetica</family> <family>AR PL New Sung</family> <family>SimSun</family> <family>Luxi Serif</family> <family>Ming(ISO10646)</family> <family>AR PL kaitiM Big5</family> <family>AR PL kaitiM GB</family> <family>Kochi Gothic</family> <family>Baekmuk Dotum</family> </prefer> </alias> |
重排monospace的字体显示顺序:
<alias> <family>monospace</family> <prefer> <family>Bitstream Vera Sans Mono</family> <family>Courier New</family> <family>Courier</family> <family>AR PL New Sung</family> <family>Ming(ISO10646)</family> <family>Kochi Mincho</family> <family>Baekmuk Batung</family> </prefer> </alias> |
接着我们来做一次模仿,请在所有写着“Bitstream Vera xxx”字样的一行前面按照这行的写法添加自己的字体。这样做的目的是让系统在做字体的替换时做得更彻底些。例如:
<match target="font"> <test name="family"> <string>DejaVu Sans Mono</string> <string>Bitstream Vera Sans Mono</string> </test> ... </match> |
5.调整/etc/fonts/local.conf这一步也是非常重要的,因为我们要做的是关闭中文字体在8px-16px之间时的Anti-Alias,以及加入粗体的设定。
我的locale.conf如下:
<?xml version="1.0"?> <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <!-- /etc/fonts/local.conf file for local customizations --> <fontconfig> <!-- Enable sub-pixel rendering <match target="font"> <edit name="rgba" mode="assign"><const>rgb</const></edit> </match> --> <!-- Add by Firefly([email protected]) --> <match target="font"> <edit name="embeddedbitmap" mode="assign"> <bool>true</bool> </edit> </match> <!-- Add by Firefly([email protected]) Most of Asian fonts can't explain by freetype2, so,if these fonts have dual width(half/full) and monospacing, you need to disable globaladvance. --> <match target="font"> <test name="spacing" compare="more_eq"> <const>mono</const> </test> <edit name="globaladvance" mode="assign"> <bool>false</bool> </edit> </match> <!-- Add by [email protected] Artificial bold for fonts without a bold version. --> <match target="font"> <!-- check to see if the pattern requested > "medium" --> <test target="pattern" name="weight" compare="more"> <const>medium</const> </test> <!-- pretend the font is bold now --> <edit name="weight" mode="assign"> <const>bold</const> </edit> </match> <!-- Add by [email protected] --> <match target="pattern"> <test name="lang" compare="contains"> <string>zh-tw</string> <string>zh-cn</string> <string>zh-hk</string> <string>zh-mo</string> <string>zh-sg</string> <string>zh</string> <string>ja</string> <string>ko</string> </test> <edit name="hinting" mode="assign"> <bool>true</bool> </edit> <edit name="usegamma" mode="assign"> <if> <less> <name>pixelsize</name> <double>20</double> </less> </if> <bool>true</bool> </edit> </match> <!--........................................................................--> <config> <!-- Add by Firefly ([email protected]) Output non English/Latin family name. --> <familyoutput> <const>auto</const> <!--const>englishonly</const--> <!--const>any</const--> </familyoutput> </config> <!--.......................................................................--> <!-- Add by EricNeon ([email protected]) Disable Chinese fonts Anti-Alias in 8px-16px. --> <match target="font"> <test name="pixelsize" compare="more_eq"> <double>8</double> </test> <test name="pixelsize" compare="less_eq"> <double>16</double> </test> <edit name="antialias"> <bool>false</bool> </edit> <edit name="hinting"> <bool>true</bool> </edit> </match> </fontconfig> |
case "$LANG" in zh_CN*) /usr/bin/scim -d(或fcitx &) XMODIFIERS=@im=scim(或fcitx) GTK_IM_MODULE=scim(或fcitx) ;; zh_TW*) /usr/bin/scim -d(或fcitx &) XMODIFIERS=@im=scim(或fcitx) GTK_IM_MODULE=scim(或fcitx) ;; zh_HK*) /usr/bin/scim -d(或fcitx &) XMODIFIERS=@im=scim(或fcitx) GTK_IM_MODULE=scim(或fcitx) ;; esac export XMODIFIERS GTK_IM_MODULE export LANG=zh_CN.UTF-8 (如果你没有设置locale=zh_CN.UTF-8) export G_FILENAME_ENCODING=@UTF-8 |
现在你可以到你的桌面下去看看效果了,无论是使用startx还是用gdm、xdm、kdm等启动桌面,都不需要另外再设置locale和输入法。