分页: 1 / 3

gutsy 下雅黑字体美化

发表于 : 2007-11-01 16:26
dogfox
基本技巧

字体安装的方法是通用的,不仅可以使用它来安装雅黑,也可以安装其他字体

下载相关字体引擎(现在官方源里已经有了,可以直接安装)

sudo apt-get install libxft2 libxft-dev libfreetype6 libfreetype6-dev libcairo2-dev

建立文件夹,移动字体到该文件夹下

sudo mkdir /usr/share/fonts/truetype/ttf-yahei # 当然你也可以直接在/usr/share/fonts下建立
sudo cp *.ttf /usr/share/fonts/truetype/ttf-yahei #*.ttf为你想安装的任意字体

刷新缓存

sudo chmod 755 /usr/share/fonts/truetype/ttf-yahei/*
cd /usr/share/fonts/truetype/ttf-yahei
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv

经过以上几步就可以在你的任一应用程序字体选项里找到该字体了

进一步的微调

修改/etc/fonts/language-selector.conf

具体修改方法参见以上2个ubuntu版本

修改/etc/fonts/fonts.conf

将字体路径修改为(也即将雅黑字体路径提前)

<!-- Font directory list -->
<dir>/usr/share/fonts/yahei</dir>
<dir>/usr/share/fonts</dir>
<dir>/usr/share/X11/fonts</dir> <dir>/usr/local/share/fonts</dir>
<dir>~/.fonts</dir>

说明:如果你只是将字体放在~/.fonts下,那么就应相应的提升~/.fonts的位置。这样做的目的是让fontconfig优先从该字体文件夹路径提取字体

修改系统默认字体

系统默认字体是文鼎字体

sudo gedit /etc/fonts/conf.d/ttf-arphic-ukai

分别把AR PL ZenKai Uni和AR PL ShanHeiSun Uni替换为sans和sans-serif


sudo gedit /etc/fonts/conf.d/ttf-arphic-uming

分别把AR PL ZenKai Uni和AR PL ShanHeiSun Uni替换为sans和sans-serif

这样做的目的是

在/etc/fonts/language-selector.conf具有优先权的字体替换sans等字体

那么在这里,直接打上sans,就是间接引用/etc/fonts/language-selector.conf里优先权字体,从而达到替换的目的

在7.10的/etc/fonts/conf.d/里比上一个版本7.04多了一个CJK_aliases文件

修改此文件sudo gedit /etc/fonts/conf.d/CJK_aliases

在此文件的

<!-- Aliases for Simplified Chinese Windows fonts -->
<alias>

下添加 <family>你安装的雅黑字体</family>

例如

<family>Microsoft YaHei</family>

保存并关闭

很明显在/etc/fonts/conf.d/下CJK_aliases是“主管”中日韩字体的“首领”

而language-selector.conf直接引用的优先字体美化方式就是它了

至于浏览器字体美化可参考forum里更多方法

发表于 : 2007-11-01 16:35
oceanboo
改动太多了,改一个language-selector.conf足矣。

发表于 : 2007-11-01 16:47
dogfox
oceanboo 写了:改动太多了,改一个language-selector.conf足矣。
切~

发表于 : 2007-11-01 16:48
kwindva
为什么这么麻烦,系统选项里直接安装不就行了吗?

发表于 : 2007-11-01 16:52
dogfox
你是说在~/.fonts下?
从linux本身来说它是多用户系统,fontconfig会优先从/下字体文件提取字体来供所有用户使用
在~/.fonts下安装字体弊大于利

发表于 : 2007-11-01 16:57
TsungWu
小兵问个小问题:我把界面切换成韩文后,中文字就会发虚(惨不忍睹)~请问有解决方案么(我现在只是用ubuntu默认字体,没装过其他字体)

发表于 : 2007-11-01 17:06
dogfox
韩文?
理论上说你应该安装韩文美化字体(例如韩文雅黑字体)并提升该字体的优先权

方法和这里的中文雅黑大同小异

发表于 : 2007-11-01 17:10
iblicf

发表于 : 2007-11-01 17:17
kwindva
关于/etc/fonts/fonts.conf的配置,有没有内容给copy一下?

发表于 : 2007-11-01 17:55
dogfox
kwindva 写了:关于/etc/fonts/fonts.conf的配置,有没有内容给copy一下?
例如,默认情况是这样的

代码: 全选

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>

<!--
	DO NOT EDIT THIS FILE.
	IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
	LOCAL CHANGES BELONG IN 'local.conf'.

	The intent of this standard configuration file is to be adequate for
	most environments.  If you have a reasonably normal environment and
	have found problems with this configuration, they are probably
	things that others will also want fixed.  Please submit any
	problems to the fontconfig bugzilla system located at fontconfig.org

	Note that the normal 'make install' procedure for fontconfig is to
	replace any existing fonts.conf file with the new version.  Place
	any local customizations in local.conf which this file references.

	Keith Packard
-->

<!-- Font directory list -->

	<dir>/usr/share/fonts</dir>
	<dir>/usr/share/X11/fonts</dir> <dir>/usr/local/share/fonts</dir>
	<dir>~/.fonts</dir>

<!-- Font cache directory list -->

	<cachedir>/var/cache/fontconfig</cachedir>
	<cachedir>~/.fontconfig</cachedir>

如果你将字体安装到 /usr/share/fonts/truetype/ttf-yahei下
那么就应这样调整

代码: 全选

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>

<!--
	DO NOT EDIT THIS FILE.
	IT WILL BE REPLACED WHEN FONTCONFIG IS UPDATED.
	LOCAL CHANGES BELONG IN 'local.conf'.

	The intent of this standard configuration file is to be adequate for
	most environments.  If you have a reasonably normal environment and
	have found problems with this configuration, they are probably
	things that others will also want fixed.  Please submit any
	problems to the fontconfig bugzilla system located at fontconfig.org

	Note that the normal 'make install' procedure for fontconfig is to
	replace any existing fonts.conf file with the new version.  Place
	any local customizations in local.conf which this file references.

	Keith Packard
-->

<!-- Font directory list -->
	<dir> /usr/share/fonts/truetype/ttf-yahei</dir>
	<dir>/usr/share/fonts</dir>
	<dir>/usr/share/X11/fonts</dir> <dir>/usr/local/share/fonts</dir>
	<dir>~/.fonts</dir>

<!-- Font cache directory list -->

	<cachedir>/var/cache/fontconfig</cachedir>
	<cachedir>~/.fontconfig</cachedir>


发表于 : 2007-11-01 17:56
dogfox
以上内容只是举例
具体实际情况根据个人情况而定

发表于 : 2007-11-01 17:56
xiehuoli
狗胡难得一见的佳作
支持下

发表于 : 2007-11-01 18:02
dogfox
iblicf 写了:有人想知道 WHY and HOW ? 可以看看 :
《Fontconfig 手册/e文》
《Fontconfig手册》
《Fontconfig配置详解》
感谢iblicf的热情提供
遗憾的是以上手册仅是参考
fontconfig在不同的linux系统里都会有不同的设置
我们使用它应依据具体环境而定
按照以上方法进行设置完全可满足GDM、gnome下kde应用程序、gnome应用程序、root下字体的美化

发表于 : 2007-11-01 19:09
TheThirdGhost
神啊,我现在一看到字体配置方面头就晕了,要想有个舒服的界面感觉真是路途漫漫。

Re: gutsy 下雅黑字体美化

发表于 : 2007-11-01 21:17
kwindva
[quote]修改/etc/fonts/language-selector.conf

具体修改方法参见以上2个ubuntu版本
[/quote]
这个在哪儿能找到?