Fedora 24 Linux 环境下实现 Infinality 字体渲染增强及(2)

# cp /usr/share/doc/freetype-infinality-ultimate/infinality-settings-generic /etc/profile.d/infinality-settings-generic.sh
# cp /usr/share/doc/freetype-infinality-ultimate/infinality-settings.sh /etc/X11/xinit/xinitrc.d
# chmod a+x /etc/X11/xinit/xinitrc.d/infinality-settings.sh

上述两个是关键的字体渲染效果配置文件,具体的配置说明可以打开这两个文件看里面的描述。一般而言,比较合适的配置是将 /etc/profile.d/infinality-settings-generic.sh 文件中第 74 行的 XFT_SETTINGS 变量中的 Xft.autohint 设置为 0,Xft.hinting 设置为 1,将 Xft.hintstyle 设置为 hintfull(好像默认值就是这个),将第 715 行的 USE_STYLE 设置为 INFINALITY(作者推荐设置),将 /etc/X11/xinit/xinitrc.d/infinality-settings.sh 文件中第 35 行的 INFINALITY_FT 设置为 ultimate3(作者推荐的就是 ultimate3,作为默认值 )。这里注意,之所以将 Xft.hintstyle 设置为 hintfull,是因为 Infinality 优化后的字体渲染引擎内部对 full 级别的微调指令做了更好的优化,特别是搭配 google 官方的 noto cjk 字体(官方是 hinted 过的)能够达到最好效果,比 hintslight 要好很多!这个情况 Infinality 作者也在 /etc/profile.d/infinality-settings-generic.sh 文件注释中解释得比较清楚了。

这里要注意,Noto Sans CJK 字体基线高度和 DejaVu Sans 字体不同,如果采用混用方式,即拉丁字母采用 DejaVu,中文采用 Noto,会导致文字行间隔太小,影响美观。所以最好的办法是,所有字符全都用 Noto Sans CJK 字体来显示,包括 Mono 等宽字符情况。虽然 Infinality 优化字体渲染软件包安装后会自带一些 fontconfig 配置,但是对于中文字体来说,我们希望 Infinality 提供的 Noto Sans CJK SC 中文字体能够具有最高优先级,我们可以创建一个名为 65-0-nonlatin-custom.conf 的文本文件,放置于 /etc/fonts/conf.d 目录下,该文件的内容如下:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <match>
    <test compare="contains">
      <string>zh-cn</string>
    </test>
    <test>
      <string>monospace</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans Mono CJK SC</string>
    </edit>
  </match>

  <match>
    <test compare="contains">
      <string>zh-tw</string>
    </test>
    <test>
      <string>monospace</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans Mono CJK TC</string>
    </edit>
  </match>

  <match>
    <test compare="contains">
      <string>jp</string>
    </test>
    <test>
      <string>monospace</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans Mono CJK JP</string>
    </edit>
  </match>

  <match>
    <test compare="contains">
      <string>zh-cn</string>
    </test>
    <test>
      <string>serif</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans CJK SC</string>
    </edit>
  </match>

  <match>
    <test compare="contains">
      <string>zh-tw</string>
    </test>
    <test>
      <string>serif</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans CJK TC</string>
    </edit>
  </match>

  <match>
    <test compare="contains">
      <string>jp</string>
    </test>
    <test>
      <string>serif</string>
    </test>
    <edit mode="prepend">
      <string>Noto Sans CJK JP</string>
    </edit>
  </match>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/14901.html