分页: 1 / 1

[分享]: 如何在字体配置文件中按名称替换字体。

发表于 : 2009-08-31 23:27
longinus4ubuntu
经 EE 同学提醒,现提醒大家:
1、如果你要想让这个修改对所有用户包括 root 起效,修改 /etc/fonts/conf.avail/ 下的文件;
2、如果你只要这些修改对自己的帐户有效,请修改自己用户目录下的对应位置。
(1 的风险大于 2)
修改有风险,保存需谨慎。


我有些 windows 下的文档,里面的字体设置一般以 win 下所有的字体为准。

于是我的要求:
1、在 ubuntu 下的编辑软件里(abiword、openoffice),显示为相对接近的字体。
2、不能在编辑软件里修改这些字体名称,这样在 windows 下就不能正确显示。
3、最好能在 ubuntu 下建立一些伪字体,有和 windows 下常用字体一样的名字,指向的却是其他的字体(外形相似)。

摸索了一下,现在给出基本的工作过程
1、下载 fontforge 制作一些假字体
名称要和 windows 下的保持一致,比如 simsun 里包含了“宋体”“新宋体”以及“宋体-PUA”,楷体则是 simkai 显示名称为“楷体_GB2312”
2、在 /etc/fonts/conf.avail/ 下,随便找一以 CN 结尾的文件,修改之
比如我找的就是 69-language-selector-zh-cn.conf ,在末尾加上这些:

代码: 全选

	<match target="pattern">
		<test qual="any" name="family">
			<string>宋体</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正大标宋_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>黑体</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正黑体_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>幼圆</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正准圆_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>宋体-PUA</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正大标宋_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>新宋体</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正大标宋_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>仿宋_GB2312</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正仿宋_GBK</string>
		</edit>
	</match>
	<match target="pattern">
		<test qual="any" name="family">
			<string>楷体_GB2312</string>
		</test>
		<edit name="family" mode="assign" binding="strong">
			<string>方正楷体_GBK</string>
		</edit>
	</match>
把 windows 下常用的字体替换成了我机器上的方正字体。

Re: [分享]: 如何在字体配置文件中按名称替换字体。

发表于 : 2009-09-01 8:53
eexpress
你应该改~/.fonts.conf吧。
别教人到处乱改哦。

Re: [分享]: 如何在字体配置文件中按名称替换字体。

发表于 : 2009-09-01 16:04
longinus4ubuntu
eexpress 写了:你应该改~/.fonts.conf吧。
别教人到处乱改哦。
已经修正。