替换OpenBSD中firefox的默认字体

秀秀桌面并和大家分享一下自己的经验。

版主: lionux天地乾坤

回复
头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

替换OpenBSD中firefox的默认字体

帖子 leo » 2010-01-21 13:17

替换OpenBSD中firefox的默认字体
方法
这里先罗嗦一下,你安装完firefox后,第一次运行时应该在"url"框里输入"about:config",将"general.useragent.local"这项改为"zh-CN",这样你就可以在菜单栏上看见比小学生写的还烂的字体了,如果你没有兴趣的话这步完全可以不做,也就是保持英文菜单。
另外还有一个改善firefox字体的方法就是,进入/usr/ports/chinese里面 make install clean一下,这样firefox里中文会变成非常小的楷体字,还有点发虚,不知道你是否会满意?
好了,步入正题:
OpenBSD中firefox的字体并非很美观,不过我们可以将其替换为自己觉得合适的字体,这里以Vista和Windows 2008采用的微软雅黑为例(你可以同时添加多种字体):
先将从互联网上下载的或你的2K8或Vista系统中的windows/fonts目录下的微软雅黑字体(mshy.ttf)拷贝到"/usr/local/lib/X11/fonts/myfonts/“,给X添加一种字体需要同时在fontconfig library和X server里注册这种字体。
客户端的渲染系统
为了避免为应用新字体重新启动X,你需要运行:
# /usr/X11R6/bin/fc-cache -v
服务器端的渲染系统
编辑/etc/X11/xorg.conf这个文件,添加如下内容:
Section "Files"
FontPath "/usr/X11R6/lib/X11/fonts/TTF/"
FontPath "/usr/local/lib/X11/fonts/myfonts/"
...
EndSection
接下来用mkfontdir(1) 命令建立这个字体的scale:
# cd /usr/local/lib/X11/fonts/myfonts
# /usr/X11R6/bin/mkfontscale
# /usr/X11R6/bin/mkfontdir
最后为了避免重新启动X,运行下面的命令就可以在当前会话中运用新字体了
$ xset fp rehash
firefox里的设置
启动firefox后,选择Edit菜单、Preferences、Content,应该出现如下的画面:
图片
在Default font里选择Microsoft YaHei,
看看效果如何?
图片
一旦你觉得字体满意,点击Advanced按钮,将网页字体设定成自己喜爱的。
这里感谢CU的axlrose兄的提醒,这里还需要修改~/.mozilla/firefox/XXXXXXXX.default/chrome目录下的两个css文件:userChrome.css和userContent.css,注意这里XXXXXXXX是一个随机的8位字符串的,你需要根据自己机器的情况调整,参考了一下网上的内容修改如下:
我的userChrome.css
/*
* Edit this file and copy it as userChrome.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to customize the look of Mozilla's user interface
* You should consider using !important on rules which you want to
* override default settings.
*/
/*
* Do not remove the @namespace line -- it's required for correct functioning
*/
@namespace url("http://www.mozilla.org/keymaster/gateke ... s.only.xul"); /* set default namespace to XUL */

/*
* Some possible accessibility enhancements:
*/
*{
font-size: 12pt !important;
}
*{
font-family: Microsoft YaHei !important;
}
/*
* Make all the default font sizes 16 pt:
*
* * {
* font-size: 16pt !important
* }
*/
/*
* Make menu items in particular 15 pt instead of the default size:
*
* menupopup > * {
* font-size: 15pt !important
* }
*/
/*
* Give the Location (URL) Bar a fixed-width font
*
* #urlbar {
* font-family: monospace !important;
* }
*/
/*
* Eliminate the throbber and its annoying movement:
*
* #throbber-box {
* display: none !important;
* }
*/
/*
* For more examples see http://www.mozilla.org/unix/customizing.html
*/
我的userContent
/*
* Edit this file and copy it as userContent.css into your
* profile-directory/chrome/
*/
/*
* This file can be used to apply a style to all web pages you view
* Rules without !important are overruled by author rules if the
* author sets any. Rules with !important overrule author rules.
*/
/*
* example: turn off "blink" element blinking
*
* blink { text-decoration: none ! important; }
*
*/
/*
* example: give all tables a 2px border
*
* table { border: 2px solid; }
*/
/*
* example: turn off "marquee" element
*
* marquee { -moz-binding: none; }
*
*/
/*
* For more examples see http://www.mozilla.org/unix/customizing.html
*/
*{
font-family: Microsoft YaHei !important;
}

调整了一下字体,设定后的效果
图片

再看看苹果的丽黑:
图片

头像
leo
帖子: 2465
注册时间: 2010-01-21 3:27

帖子 leo » 2010-01-21 13:18

不过话说回来,上面两种字体看来看去我还是觉得不如微软的新宋体好,虽然字体稍微小一点。见下图:
图片

宋体放大也没有问题
图片

最后的主角出现了:
特别推荐文泉驿的字体
文泉驿的字体也相当棒,还是free的,我们先来安装,这里以i386的当前版为例:
在服务器上的位置是
ftp://ftp.openbsd.org/pub/OpenBSD/snaps ... .9-0p0.tgz
ftp://ftp.openbsd.org/pub/OpenBSD/snaps ... 6.26-0.tgz
这两个包我是全安装了
# export PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/snaps ... ages/i386/
# pkg_add wqy-bitmapfont-0.9.9-0p0
# pkg_add wqy-zenhei-ttf-0.6.26-0
激活字体的过程请自行参照上面的步骤,然后你只需要在firefox的设定里选择文泉驿的字体就可以了,看看效果如何?
图片
其他注意事项
字体的版权问题请您自行解决,本例中仅提供更换字体的方法。

天地乾坤
钾 K
帖子: 17
注册时间: 2010-02-27 13:23

帖子 天地乾坤 » 2010-03-01 21:49

打五分是因为本人是中国人,喜欢看见中文,希望看见漂亮的中文字体。对喜欢漂亮的中文字体的人很有用哦。

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 8 访客