在Ubuntu里加上微软雅黑字体

本文介绍了如何在Ubuntu系统中添加并设置微软雅黑字体,包括复制字体文件到指定目录,修改文件权限,更新字体配置,以及调整字体渲染选项,最终实现字体生效。
摘要由CSDN通过智能技术生成

1. 将雅黑字体复制到/usr/share/fonts/truetype里
sudo cp msyhbd.ttf msyh.ttf /usr/share/fonts/truetype
将这2个文件的属性改成755
sudo chmod 755 /usr/share/fonts/truetype/msyh*.ttf

2. 执行如下命令
sudo fontconfig-voodoo -f -s zh_CN
sudo gedit /etc/fonts/language-selector.conf

找到:<family>Bitstream Vera Serif</family>下面一行添加:

<family>Microsoft YaHei</family>
在<family>Bitstream Vera Sans</family>下面一行添加:

<family>Microsoft YaHei</family>

3. sudo fc-cache -f -v

4. 打开"系统-首选项-字体"面板,选择字体为STHeiti,大小为10。然后在"字体渲染"选项中选择"最佳形状"(这个选项由你自己决定,例如LCD可以选择"次象素平滑")。

5. 打开sudo gedit /etc/fonts/fonts.conf文件,找到以<match target="font">的部份(格式最好和它们的一样排列)加入下面一段:
<match target="font">
<test name="family">
<string>Microsoft YaHei</string>
</test>
<edit name="hinting">
<bool>false</bool>
</edit>
</match>

也可以使用sudo fc-cache -f -v命令刷新一下字体缓存,,完成。重启x看效果。

6.注意的问题,在加入第5步操作的时候,一定要注意 原来的语法格式
<?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 nor
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值