如何在debian中对不同语言设置不同字体

系统信息

    uname -a
    Linux debian 5.10.0-18-amd64 #1 SMP Debian 5.10.140-1 (2022-09-02) x86_64 GNU/Linux
    sudo dpkg -s lxde | grep Version
    Version: 11
    sudo dpkg -s lxappearance | grep Version
    Version: 0.6.3-1+b1

字体设置文件 /etc/fonts/fonts.conf,设置的意图:英文用 DejaVu Sans Mono显示,中文用 Noto Sans CJK SC 显示。

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0">
        <its:translateRule translate="no" selector="/fontconfig/*[not(self::description)]"/>
    </its:rules>
    <description>Default configuration file</description>
    <dir>/usr/share/fonts</dir>
    <dir>/usr/local/share/fonts</dir>
    <dir prefix="xdg">fonts</dir>
    <dir>~/.fonts</dir>
    <match target="pattern">
        <test qual="any" name="family">
            <string>mono</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>monospace</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans serif</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>sans-serif</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>sans-serif</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="eq">
        <string>en_US</string>
        </test>
        <edit name="family" mode="assign">
        <string>DejaVu Sans Mono Book</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="eq">
        <string>zh_CN</string>
        </test>
        <edit name="family" mode="assign">
        <string>Noto Sans CJK SC</string>
        </edit>
    </match>
    <selectfont>
        <rejectfont>
            <glob>*.dpkg-tmp</glob>
        </rejectfont>
    </selectfont>
    <selectfont>
        <rejectfont>
            <glob>*.dpkg-new</glob>
        </rejectfont>
    </selectfont>
    <include ignore_missing="yes">conf.d</include>
    <cachedir>/var/cache/fontconfig</cachedir>
    <cachedir prefix="xdg">fontconfig</cachedir>
    <cachedir>~/.fontconfig</cachedir>
    <config>
        <rescan>
            <int>30</int>
        </rescan>
    </config>
</fontconfig>

重新启动后,在桌面建立一个名为" 增 "文件夹,显示效果

img

你可以发现它不是用 Noto Sans CJK SC 显示的,意图没有实现。

img

朋友说系统调用了vlgothic font family来显示。

fc-list |grep  vlgothic
/usr/share/fonts/truetype/vlgothic/VL-PGothic-Regular.ttf: VL PGothic,VL Pゴシック:style=regular
/usr/share/fonts/truetype/vlgothic/VL-Gothic-Regular.ttf: VL Gothic,VL ゴシック:style=regular

于是我删除这个字体家族

sudo rm -rf   /usr/share/fonts/truetype/vlgothic

重新启动系统,再次显示。

img

这次的显示效果和上次不同,但也不是我指定的字体。请问,如何解决呢?

Mark,
我要mark一下这个问题,我觉得这个问题是好问题,并且对我有用,mark期待大佬回答学习一波