gutsy 下雅黑字体美化

系统字体配置、中文显示和输入法问题
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

gutsy 下雅黑字体美化

#1

帖子 dogfox » 2007-11-01 16:26

基本技巧

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

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

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里更多方法
全世界linux爱好者联合起来 !
oceanboo
帖子: 76
注册时间: 2006-07-26 1:32

#2

帖子 oceanboo » 2007-11-01 16:35

改动太多了,改一个language-selector.conf足矣。
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#3

帖子 dogfox » 2007-11-01 16:47

oceanboo 写了:改动太多了,改一个language-selector.conf足矣。
切~
全世界linux爱好者联合起来 !
头像
kwindva
帖子: 562
注册时间: 2007-05-05 23:30

#4

帖子 kwindva » 2007-11-01 16:48

为什么这么麻烦,系统选项里直接安装不就行了吗?
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#5

帖子 dogfox » 2007-11-01 16:52

你是说在~/.fonts下?
从linux本身来说它是多用户系统,fontconfig会优先从/下字体文件提取字体来供所有用户使用
在~/.fonts下安装字体弊大于利
全世界linux爱好者联合起来 !
TsungWu
帖子: 115
注册时间: 2006-11-26 15:18
来自: 诗山

#6

帖子 TsungWu » 2007-11-01 16:57

小兵问个小问题:我把界面切换成韩文后,中文字就会发虚(惨不忍睹)~请问有解决方案么(我现在只是用ubuntu默认字体,没装过其他字体)
你最珍贵.
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#7

帖子 dogfox » 2007-11-01 17:06

韩文?
理论上说你应该安装韩文美化字体(例如韩文雅黑字体)并提升该字体的优先权

方法和这里的中文雅黑大同小异
全世界linux爱好者联合起来 !
头像
iblicf
帖子: 3766
注册时间: 2007-01-15 17:15

#8

帖子 iblicf » 2007-11-01 17:10

上次由 iblicf 在 2007-11-01 17:21,总共编辑 1 次。
头像
kwindva
帖子: 562
注册时间: 2007-05-05 23:30

#9

帖子 kwindva » 2007-11-01 17:17

关于/etc/fonts/fonts.conf的配置,有没有内容给copy一下?
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#10

帖子 dogfox » 2007-11-01 17:55

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>

全世界linux爱好者联合起来 !
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#11

帖子 dogfox » 2007-11-01 17:56

以上内容只是举例
具体实际情况根据个人情况而定
全世界linux爱好者联合起来 !
头像
xiehuoli
帖子: 5941
注册时间: 2006-06-10 8:43
来自: 中国 CS

#12

帖子 xiehuoli » 2007-11-01 17:56

狗胡难得一见的佳作
支持下
年轻没有失败! ! ! ! ! !
噢!有怪兽,有怪兽!
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

#13

帖子 dogfox » 2007-11-01 18:02

iblicf 写了:有人想知道 WHY and HOW ? 可以看看 :
《Fontconfig 手册/e文》
《Fontconfig手册》
《Fontconfig配置详解》
感谢iblicf的热情提供
遗憾的是以上手册仅是参考
fontconfig在不同的linux系统里都会有不同的设置
我们使用它应依据具体环境而定
按照以上方法进行设置完全可满足GDM、gnome下kde应用程序、gnome应用程序、root下字体的美化
全世界linux爱好者联合起来 !
头像
TheThirdGhost
帖子: 1592
注册时间: 2006-07-23 16:25
来自: 南京

#14

帖子 TheThirdGhost » 2007-11-01 19:09

神啊,我现在一看到字体配置方面头就晕了,要想有个舒服的界面感觉真是路途漫漫。
头像
kwindva
帖子: 562
注册时间: 2007-05-05 23:30

Re: gutsy 下雅黑字体美化

#15

帖子 kwindva » 2007-11-01 21:17

[quote]修改/etc/fonts/language-selector.conf

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