Manjaro字體+wps字體


manjaro自帶中文字體有缺陷,wps字體自帶宋體等字體需要替換才能使用,因此安裝以下字體內容。

Manjaro默認的中文顯示效果非常差,不美觀也就罷了,還會有很多奇形怪狀的字形(比如“門”,“畫”等字)出現。配置字體效果非常耗費時間,如果想仔細折騰,可以參考如下幾個網頁:

  1. Localization/Simplified Chinese (簡體中文)
  2. Font configuration (簡體中文)
  3. Font Configuration/Chinese (簡體中文)

我參考上面的第3個鏈接中的配置,做了點小修改,效果基本能夠接受。先安裝如下字體:

sudo pacman -S ttf-roboto noto-fonts ttf-dejavu
# 文泉驛
sudo pacman -S wqy-bitmapfont wqy-microhei wqy-microhei-lite wqy-zenhei
# 思源字體
sudo pacman -S noto-fonts-cjk adobe-source-han-sans-cn-fonts adobe-source-han-serif-cn-fonts

創建文件.config/fontconfig/fonts.conf,加入下面的配置:

<?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>Manjaro Font Config</description>

 <!-- Font directory list -->
 <dir>/usr/share/fonts</dir>
 <dir>/usr/local/share/fonts</dir>
 <dir prefix="xdg">fonts</dir>
 <dir>~/.fonts</dir> <!-- this line will be removed in the future -->

 <!-- 自動微調 微調 抗鋸齒 內嵌點陣字體 -->
 <match target="font">
 <edit name="autohint"> <bool>false</bool> </edit>
 <edit name="hinting"> <bool>true</bool> </edit>
 <edit name="antialias"> <bool>true</bool> </edit>
 <edit name="embeddedbitmap" mode="assign"> <bool>false</bool> </edit>
 </match>

 <!-- 英文默認字體使用 Roboto 和 Noto Serif ,終端使用 DejaVu Sans Mono. -->
 <match>
 <test qual="any" name="family">           
<string>serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Noto Serif</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>Roboto</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend" binding="strong">
            <string>DejaVu Sans Mono</string>
        </edit>
    </match>

    <!-- 中文默認字體使用思源宋體,不使用 Noto Sans CJK SC 是因為這個字體會在特定情況下顯示片假字. -->
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>sans-serif</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Source Han Sans CN</string>
        </edit>
    </match>
    <match>
        <test name="lang" compare="contains">
            <string>zh</string>
        </test>
        <test name="family">
            <string>monospace</string>
        </test>
        <edit name="family" mode="prepend">
            <string>Noto Sans Mono CJK SC</string>
        </edit>
    </match>

    <!-- 把Linux沒有的中文字體映射到已有字體,這樣當這些字體未安裝時會有替代字體 -->
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimHei</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Sans CN</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimSun</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    <match target="pattern">
        <test qual="any" name="family">
            <string>SimSun-18030</string>
        </test>
        <edit name="family" mode="assign" binding="same">
            <string>Source Han Serif CN</string>
        </edit>
    </match>
    
    <!-- Load local system customization file -->
    <include ignore_missing="yes">conf.d</include>
    <!-- Font cache directory list -->
    <cachedir>/var/cache/fontconfig</cachedir>
    <cachedir prefix="xdg">fontconfig</cachedir>
    <!-- will be removed in the future -->
    <cachedir>~/.fontconfig</cachedir>

    <config>
        <!-- Rescan in every 30s when FcFontSetList is called -->
        <rescan> <int>30</int> </rescan>
    </config>

</fontconfig>

本文轉自:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM