我的目标是在 CentOS7 上配置 Courier New 字体,使其看起来像 Windows XP 中的字体(XP 仅作为示例,未使用它)。字体配置文件位于~/.config/fontconfig/fonts.conf:
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>monospace</family>
<prefer><family>Courier New</family></prefer>
</alias>
<match target="font">
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintslight</const>
</edit>
<edit name="lcdfilter" mode="assign">
<const>lcdlight</const>
</edit>
<edit name="rgba" mode="assign">
<const>rgb</const>
</edit>
</match>
</fontconfig>
Courier 安装了新字体。
坏的CentOS 上的结果:
好的Win10上的结果:
尝试使用选项:
<edit name="antialias" mode="assign">
<bool>true</bool>
</edit>
甚至更差:
编辑:
(感谢ftview
@contemplator 的良好提示)我找到了完全匹配的内容,现在的问题是如何将这些设置转换为 xml:
编辑2:
似乎 FreeType 涉及设置:
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
现在试图找到如何设置该值。
答案1
感谢@contemplator指向ftview
,我找到了解决方案:
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias>
<family>monospace</family>
<prefer><family>Courier New</family></prefer>
</alias>
<match target="font">
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="autohint" mode="assign">
<bool>false</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintfull</const>
</edit>
</match>
</fontconfig>
然后在以下位置创建文件/etc/profile.d/freetype2.sh
:
# Subpixel hinting mode can be chosen by setting the right TrueType interpreter
# version. The available settings are:
#
# truetype:interpreter-version=35 # Classic mode (default in 2.6)
# truetype:interpreter-version=38 # Infinality mode
# truetype:interpreter-version=40 # Minimal mode (default in 2.7)
#
# There are more properties that can be set, separated by whitespace. Please
# refer to the FreeType documentation for details.
# Uncomment and configure below
export FREETYPE_PROPERTIES="truetype:interpreter-version=35"
重新登录后,宾果游戏:) 文本现在非常漂亮、干净且易于阅读(使用 Eizo ColorEdge CG243W 高端图形显示器):
答案2
尝试这个:
<match target="font">
<test name="family" qual="any">
<string>Courier New</string>
</test>
<edit name="antialias" mode="assign">
<bool>false</bool>
</edit>
<edit name="hinting" mode="assign">
<bool>true</bool>
</edit>
<edit name="hintstyle" mode="assign">
<const>hintfull</const>
</edit>
</match>