说明:
一、本文引用自:http://www.builder.com.cn/,如果引起火星碰撞地球,您的系统崩溃,火狐与google火拼等情况,请与原作者联系,与本人无关;
二、本人的Ubuntu版本号为11.04,字体的安装没有下文提到的那么复杂,比如安装Windows系列的字体,在桌面环境(Gnome2.32.1)下,双击字体文件,再单击【安装】按钮即可安装字体;
三、对我的系统非常有效:Ubuntu11.04+Firefox4.0.1,看下图。
=======引用=======================================================================
Ubuntu下 Firefox 字体配置参考方案
开发者在线 Builder.com.cn 更新时间:2008-03-26 作者:理论上存在 来源:CSDN
本文关键词: 字体配置 Firefox Ubuntu 开源
Ubuntu Linux 6.06 下 Firefox 2.0b1 字体配置 参考 方案
大家可以看到,无论是中文网页还是英文网页,浏览效果都和Windows下的IE相差不大。
也许你注意到了,英文字体不如Windows下的锐利。这是因为启用了Anti-aliasing 的结果。
在 Windows XP 下,如果你安装了微软的 ClearType 字体美化软件,那么英文字体的美化效果和AA 是相似的。
ClearType 和 Anti-aliasing 都是很先进的显示技术,有利于缓解视觉疲劳,保护眼睛。微软的下一代操作系统 Windows Vista 将应用 ClearType 显示技术。锋利的字体将成为 Windows 的历史。
这样的显示效果是怎么样配置出来的呢?
首先,你手头上要有支持 XFT 的 Firefox 。Firefox 默认是不带 XFT 的。你最好自己编译一份。我现在下载的版本是2.0Beta1。
源码下载地址:
http://releases.mozilla.org/pub/mozilla.org/firefox/releases/2.0b1/source/firefox-2.0b1-source.tar.bz2
注意解压的源码不能直接编译,必须先在解压出来的mozilla 目录下创建一个名为mozconfig 的文件,指定编译参数。
具体方法参见源码包中的README .
下面把我的mozconfig 文件内容贴出来给大家参考.
# Build Firefox
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/release/firefox-static
. $topsrcdir/browser/config/mozconfig
ac_add_options --enable-optimize=-O2
ac_add_options --disable-debug
ac_add_options --enable-default-toolkit=gtk2
ac_add_options --enable-xft #这是必须的
ac_add_options --enable-static
ac_add_options --disable-shared
ac_add_options --disable-tests
mozconfig 创建完毕就可以编译安装了。
# ./configure
# make
# make install
下 面安装常用中文字体。文泉驿、文鼎等都是不错的选择。如果你没有这些字体,那么考虑用Windows下已经安装的,包括中易公司的sim* 系列字体看看效果。比较简单的做法是,把Windows目录下的Fonts文件夹中几个重要字体,比如宋体、楷体、仿宋、细黑、Tohama、Arial 等复制到 /usr/share/fonts/other 文件夹中。然后执行
# fc-cache /usr/share/fonts/other
更新字体缓存。
以下步骤是假定你拷贝了WindowsFonts下的所有主要字体。如果你使用了其他字体,参照下面的步骤修改具体参数即可。
检查一下 /etc/fonts/fonts.conf 文件有没有被修改过。如果被修改了,最好恢复到最原始的版本。
下面在 /etc/fonts/ 目录下创建文件 local.conf ,文件内容如下:
<?
xml version="1.0"
?>
<!
DOCTYPE fontconfig SYSTEM "fonts.dtd"
>
<!--
/etc/fonts/local.conf file for local customizations
-->
<
fontconfig
>
<
match
target
="font"
>
<
edit
name
="autohint"
>
<
bool
>
true
</
bool
>
</
edit
>
<
edit
name
="hintstyle"
>
<
const
>
hintfull
</
const
>
</
edit
>
<
edit
name
="antialias"
>
<
bool
>
true
</
bool
>
</
edit
>
</
match
>
<
match
target
="font"
>
<
edit
name
="embeddedbitmap"
mode
="assign"
>
<
bool
>
true
</
bool
>
</
edit
>
</
match
>
<
match
target
="font"
>
<!--
check to see if the font is just regular
-->
<
test
name
="weight"
compare
="less_eq"
>
<
const
>
medium
</
const
>
</
test
>
<!--
check to see if the pattern requests bold
-->
<
test
target
="pattern"
name
="weight"
compare
="more"
>
<
const
>
medium
</
const
>
</
test
>
<!--
set the embolden flag
needed for applications using cairo, e.g. gucharmap, gedit, ...
-->
<
edit
name
="embolden"
mode
="assign"
>
<
bool
>
true
</
bool
>
</
edit
>
<!--
set weight to bold
needed for applications using Xft directly, e.g. Firefox, ...
-->
<
edit
name
="weight"
mode
="assign"
>
<
const
>
bold
</
const
>
</
edit
>
<!--
Hinting will be done before Embolden in freetype2,
but in such case, Embolden will get wrong result
on some glyph contours after applying hinting.
Actually, hinting should be done after embolden, but we can't
fix it in current freetype2. So as a workaround, just turn off
hinting if we want to do embolden.
-->
<!--
<edit name="hintstyle" mode="assign">
<const>hintnone</const>
</edit>
-->
</
match
>
<
match
target
="font"
>
<
test
target
="pattern"
name
="lang"
compare
="contains"
>
<
string
>
zh
</
string
>
<
string
>
ja
</
string
>
<
string
>
ko
</
string
>
</
test
>
<
edit
name
="spacing"
>
<
const
>
proportional
</
const
>
</
edit
>
<
edit
name
="globaladvance"
>
<
bool
>
false
</
bool
>
</
edit
>
</
match
>
<
match
target
="pattern"
>
<
test
name
="family"
>
<
string
>
SimSun
</
string
>
<
string
>
SimHei
</
string
>
<
string
>
KaiTi_GB2312
</
string
>
<
string
>
FangSong_GB2312
</
string
>
<
string
>
Batang
</
string
>
<
string
>
Gulim
</
string
>
<
string
>
MS Gothic
</
string
>
<
string
>
MingLiU
</
string
>
<
string
>
SimSun-18030
</
string
>
<
string
>
AR PL SungtiL GB
</
string
>
<
string
>
AR PL ShanHeiSun Uni
</
string
>
<
string
>
AR PL New Sung
</
string
>
<
string
>
PMingLiU
</
string
>
</
test
>
<
edit
binding
="strong"
mode
="prepend"
name
="family"
>
<
string
>
Tahoma
</
string
>
<
string
>
Arial
</
string
>
<
string
>
Verdana
</
string
>
<
string
>
DejaVu Sans
</
string
>
<
string
>
Bitstream Vera Sans
</
string
>
</
edit
>
</
match
>
<
alias
>
<
family
>
serif
</
family
>
<
prefer
>
<
family
>
Nimbus Roman No9 L
</
family
>
<
family
>
Thorndale AMT
</
family
>
<
family
>
DejaVu Serif
</
family
>
<
family
>
Bitstream Vera Serif
</
family
>
<
family
>
Times New Roman
</
family
>
<
family
>
Luxi Serif
</
family
>
<
family
>
Likhan
</
family
>
<
family
>
FreeSerif
</
family
>
<
family
>
Times
</
family
>
<
family
>
SimSun
</
family
>
<
family
>
SimHei
</
family
>
<
family
>
KaiTi_GB2312
</
family
>
<
family
>
FangSong_GB2312
</
family
>
<
family
>
Batang
</
family
>
<
family
>
Gulim
</
family
>
<
family
>
MS Gothic
</
family
>
<
family
>
MingLiU
</
family
>
<
family
>
SimSun-18030
</
family
>
<
family
>
WenQuanYi Bitmap Song
</
family
>
<
family
>
AR PL ShanHeiSun Uni
</
family
>
<
family
>
AR PL New Sung
</
family
>
<
family
>
FZSongTi
</
family
>
<
family
>
FZMingTiB
</
family
>
<
family
>
AR PL SungtiL GB
</
family
>
<
family
>
AR PL Mingti2L Big5
</
family
>
<
family
>
Kochi Mincho
</
family
>
<
family
>
UnBatang
</
family
>
<
family
>
Baekmuk Batang
</
family
>
<
family
>
HanyiSong
</
family
>
<
family
>
ZYSong18030
</
family
>
</
prefer
>
</
alias
>
<
alias
>
<
family
>
sans-serif
</
family
>
<
prefer
>
<
family
>
DejaVu Sans
</
family
>
<
family
>
Bitstream Vera Sans
</
family
>
<
family
>
Luxi Sans
</
family
>
<
family
>
Arial
</
family
>
<
family
>
Verdana
</
family
>
<
family
>
Albany AMT
</
family
>
<
family
>
Nimbus Sans L
</
family
>
<
family
>
FreeSans
</
family
>
<
family
>
Helvetica
</
family
>
<
family
>
SimSun
</
family
>
<
family
>
SimHei
</
family
>
<
family
>
KaiTi_GB2312
</
family
>
<
family
>
FangSong_GB2312
</
family
>
<
family
>
Batang
</
family
>
<
family
>
Gulim
</
family
>
<
family
>
MS Gothic
</
family
>
<
family
>
MingLiU
</
family
>
<
family
>
SimSun-18030
</
family
>
<
family
>
WenQuanYi Bitmap Song
</
family
>
<
family
>
AR PL ShanHeiSun Uni
</
family
>
<
family
>
AR PL New Sung
</
family
>
<
family
>
FZSongTi
</
family
>
<
family
>
FZMingTiB
</
family
>
<
family
>
AR PL SungtiL GB
</
family
>
<
family
>
AR PL Mingti2L Big5
</
family
>
<
family
>
Kochi Gothic
</
family
>
<
family
>
UnDotum
</
family
>
<
family
>
Baekmuk Gulim
</
family
>
<
family
>
Baekmuk Dotum
</
family
>
</
prefer
>
</
alias
>
<
alias
>
<
family
>
monospace
</
family
>
<
prefer
>
<
family
>
DejaVu Sans Mono
</
family
>
<
family
>
Bitstream Vera Sans Mono
</
family
>
<
family
>
Luxi Mono
</
family
>
<
family
>
Courier New
</
family
>
<
family
>
Cumberland AMT
</
family
>
<
family
>
Nimbus Mono L
</
family
>
<
family
>
Andale Mono
</
family
>
<
family
>
FreeMono
</
family
>
<
family
>
SimSun
</
family
>
<
family
>
SimHei
</
family
>
<
family
>
KaiTi_GB2312
</
family
>
<
family
>
FangSong_GB2312
</
family
>
<
family
>
Batang
</
family
>
<
family
>
Gulim
</
family
>
<
family
>
MS Gothic
</
family
>
<
family
>
MingLiU
</
family
>
<
family
>
NSimSun
</
family
>
<
family
>
NSimSun-18030
</
family
>
<
family
>
PMingLiU
</
family
>
<
family
>
WenQuanYi Bitmap Song
</
family
>
<
family
>
AR PL ShanHeiSun Uni
</
family
>
<
family
>
AR PL New Sung
</
family
>
<
family
>
FZSongTi
</
family
>
<
family
>
FZMingTiB
</
family
>
<
family
>
AR PL SungtiL GB
</
family
>
<
family
>
AR PL Mingti2L Big5
</
family
>
<
family
>
Kochi Gothic
</
family
>
<
family
>
UnDotum
</
family
>
<
family
>
Baekmuk Gulim
</
family
>
<
family
>
Baekmuk Dotum
</
family
>
<
family
>
HanyiSong
</
family
>
<
family
>
ZYSong18030
</
family
>
</
prefer
>
</
alias
>
</
fontconfig
>
这份配置文件能适应大多数情况。
注意中间有一段是分别指定中文字体和其他字体的渲染顺序的,大家可以根据自己的需要修改。
最后打开 Firefox 浏览器,在地址栏中输入 about:config
修改一些键值。
以下左边为 Preference Name, 右边为修改后的值Value。
font.FreeType2.unhinted false
browser.display.use_document_fonts 0
font.default.zh-CN SimSun
font.language.group x-western
font.name.monospace.zh.CN SimSun
font.name.sans-serif.zh-CN SimSun
font.name.serif.zh-CN SimSun
inti.charset.default GB2312
以上只是针对简体中文的设置。如果你浏览繁体中文网页,可将 font.default.zh-HK 等设置为 -arphic-Ming for ISO10646-big5hkscs-0 等。
把 browser.display.use_document_fonts 置0是最关键的,否则下面的字体设置都不起作用。
SimSun 就是你要使用的宋体的字体名称。使用字体查看器打开字体文件时可以看到字体名称。
好了,打开几个网页看看效果。
附带说一句,按照上面的方法创建文件 local.conf 后,在支持XFT的Opera 中不能再选SimSun作为首选字体了,否则网页文字会变得模糊不清。
依次打开 工具->首选项->高级->字体, 把网页普通文字改为NSimSun ,再在"国际字体"的"书写系统"选"简体中文", ",把"普通字体"也改为NSimSun 。(Veiz)
=======引用=======================================================================