如何在Linux(fontconfig)下正确设置monospace字体映射关系?
黄舟
黄舟 2017-04-17 13:11:29
0
1
629

我所使用的fontconfig文件(~/.config/fontconfig/fonts.conf)如下:

xml<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match>
        <test name="family"><string>serif</string></test>
        <edit name="family" mode="assign" binding="strong">
            <string>DejaVu Serif</string>
        </edit>
    </match>
    <match>
        <test name="family"><string>sans-serif</string></test>
        <edit name="family" mode="assign" binding="strong">
            <string>DejaVu Sans</string>
        </edit>
    </match>
    <match>
        <test name="family"><string>monospace</string></test>
        <edit name="family" mode="assign" binding="strong">
            <string>DejaVu Mono</string>
        </edit>
    </match>
    <match>
        <test name="family"><string>Arial</string></test>
        <edit name="family" mode="assign" binding="strong">
            <string>Liberation Sans</string>
        </edit>
    </match>
    <!-- ... -->
</fontconfig>

fc-match命令显示,sans和serif字体设置均正确(使用上述配置前输出为文泉驿字体)。

$ fc-match serif
DejaVuSerif.ttf: "DejaVu Serif" "Book"
$ fc-match sans
DejaVuSans.ttf: "DejaVu Sans" "Book"
$ fc-match monospace
odokai.ttf: "文鼎PL新中楷" "Regular"

我设置了monospace为DejaVu Mono,为什么实际上是其他字体?

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

全員に返信(1)
黄舟

因为没有叫 DejaVu Mono 的字体。这是我的:

>>> fc-match monospace
DejaVuSansMono.ttf: "DejaVu Sans Mono" "Book"
いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!