XiZi's Blog

CentOS 修改系统字体

1、添加字体

 

#创建新的字体存放文件夹
mkdir /usr/share/fonts/chinese
#拷贝新字体到新文件夹
cp newfont.ttf /usr/share/fonts/chinese
cd /usr/share/fonts/chinese
#修复字体字体权限(这里比较重要,否则可能字体访问出错)
chmod 644 *.ttf
#更新字体
mkfontscale
mkfontdir
fc-cache -fv

2、配置字体,下面是/etc/fonts/local.conf的一个示例,这里替换字体为微软雅黑

 

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
	<match target="pattern">
		<test qual="any" name="family">
			<string>serif</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>DejaVu Serif</string>
			<string>YaHei Consolas Hybrid</string>
			<string>AR PL UMing CN</string>
			<string>AR PL ShanHeiSun Uni</string>
			<string>WenQuanYi Bitmap Song</string>
			<string>Bitstream Vera Serif</string>
			<string>AR PL UKai CN</string>
			<string>AR PL ZenKai Uni</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>sans-serif</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>DejaVu Sans</string>
			<string>YaHei Consolas Hybrid</string>
			<string>Bitstream Vera Sans</string>
			<string>WenQuanYi Zen Hei</string>
			<string>AR PL UMing CN</string>
			<string>AR PL ShanHeiSun Uni</string>
			<string>WenQuanYi Bitmap Song</string>
			<string>AR PL UKai CN</string>
			<string>AR PL ZenKai Uni</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>monospace</string>
		</test>
		<edit name="family" mode="prepend" binding="strong">
			<string>DejaVu Sans Mono</string>
			<string>YaHei Consolas Hybrid</string>
			<string>Bitstream Vera Sans Mono</string>
			<string>WenQuanYi Zen Hei</string>
			<string>AR PL UMing CN</string>
			<string>AR PL ShanHeiSun Uni</string>
			<string>WenQuanYi Bitmap Song</string>
			<string>AR PL UKai CN</string>
			<string>AR PL ZenKai Uni</string>
		</edit>
	</match>
</fontconfig>




Host by is-Programmer.com | Power by Chito 1.3.3 beta | © 2007 LinuxGem | Design by Matthew "Agent Spork" McGee