如何使用「fc-validate」這個指令

Manpage

執行

$ man fc-validate

可以閱讀「Manpage」的說明。

Help

執行

$ fc-validate -h

或是執行

$ fc-validate --help

顯示

usage: fc-validate [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...
Validate font files and print result

  -i, --index INDEX    display the INDEX face of each font file only
  -l, --lang=LANG      set LANG instead of current locale
  -v, --verbose        show more detailed information
  -V, --version        display font config version and exit
  -h, --help           display this help and exit

Version

執行

$ fc-validate -V

或是執行

$ fc-validate --version

顯示

fontconfig version 2.11.94

操作範例

操作環境

執行

$ cat /etc/default/locale

顯示

#  File generated by update-locale
LANG="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"

執行

$ locale

顯示

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_US.UTF-8
LC_TIME=en_US.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=en_US.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=en_US.UTF-8
LC_NAME=en_US.UTF-8
LC_ADDRESS=en_US.UTF-8
LC_TELEPHONE=en_US.UTF-8
LC_MEASUREMENT=en_US.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=

基本操作

關於「fc-scan」的用法,請參考「如何使用「fc-scan」這個指令」這篇的說明。

先執行

$ fc-scan /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf | grep lang -i

顯示

        familylang: "en"(s)
        stylelang: "en"(s)
        fullnamelang: "en"(s)
        lang: aa|ab|af|av|ay|ba|be|bg|bi|br|bs|bua|ca|ce|ch|chm|co|cs|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|kw|ky|la|lb|lez|lt|lv|mg|mh|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|sco|se|sel|sh|sk|sl|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|kr|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za(s)

再執行

$ fc-scan -f 'lang: %{lang}\n' /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

lang: aa|ab|af|av|ay|ba|be|bg|bi|br|bs|bua|ca|ce|ch|chm|co|cs|cv|cy|da|de|el|en|eo|es|et|eu|fi|fj|fo|fr|fur|fy|gd|gl|gv|ho|hr|hu|ia|id|ie|ik|io|is|it|kaa|ki|kk|kl|kum|kv|kw|ky|la|lb|lez|lt|lv|mg|mh|mk|mo|mt|nb|nds|nl|nn|no|nr|nso|ny|oc|om|os|pl|pt|rm|ro|ru|sah|sco|se|sel|sh|sk|sl|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|tg|tk|tl|tn|tr|ts|tt|tyv|uk|uz|vo|vot|wa|wen|wo|xh|yap|zu|an|crh|csb|fil|hsb|ht|jv|kj|kr|ku-tr|kwm|lg|li|mn-mn|ms|na|ng|pap-an|pap-aw|rn|rw|sc|sg|sn|su|ty|za

執行

$ fc-validate /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Satisfy the coverage for en language

執行

$ fc-validate -l en /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Satisfy the coverage for en language

執行

$ fc-validate -l zh-tw /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Missing 13063 glyph(s) to satisfy the coverage for zh-tw language

執行

$ fc-validate -l zh /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Missing 6763 glyph(s) to satisfy the coverage for zh language

執行

$ LANG=zh_TW.UTF-8 fc-validate /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Missing 13063 glyph(s) to satisfy the coverage for zh-TW language

執行

$ LANG=zh_TW fc-validate /usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf

顯示

/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:0 Missing 13063 glyph(s) to satisfy the coverage for zh-TW language

先執行

$ fc-scan /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf | grep lang -i

顯示

        familylang: "en"(s)
        stylelang: "en"(s)
        fullnamelang: "en"(s)
        lang: ja|zh-tw(s)

再執行

$ fc-scan -f 'lang: %{lang}\n' /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

lang: ja|zh-tw

執行

$ fc-validate /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf:0 Missing 72 glyph(s) to satisfy the coverage for en language

執行

$ fc-validate -l en /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf:0 Missing 72 glyph(s) to satisfy the coverage for en language

執行

$ fc-validate -l zh-tw /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf:0 Satisfy the coverage for zh-tw language

執行

$ LANG=zh_TW.UTF-8 fc-validate /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf:0 Satisfy the coverage for zh-TW language

執行

$ fc-validate -l ja /usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf

顯示

/usr/share/fonts/truetype/droid/DroidSansFallbackFull.ttf:0 Satisfy the coverage for ja language

關於「/usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf」這個檔案, 請參考「手動安裝全字庫字型(CNS11643)」這篇的說明。

先執行

$ fc-scan /usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf | grep lang -i

顯示

        familylang: "zh-tw"(s) "en"(s)
        stylelang: "zh-tw"(s)
        fullnamelang: "zh-tw"(s) "en"(s)
        lang: aa|ab|af|am|ar|as|ast|av|ay|az-az|az-ir|ba|bm|be|bg|bh|bho|bi|bin|bn|bo|br|bs|bua|ca|ce|ch|chm|chr|co|cs|cu|cv|cy|da|de|dz|el|en|eo|es|et|eu|fa|fi|fj|fo|fr|ff|fur|fy|ga|gd|gez|gl|gn|gu|gv|ha|haw|he|hi|ho|hr|hu|hy|ia|ig|id|ie|ik|io|is|it|iu|ja|ka|kaa|ki|kk|kl|km|kn|kok|ku-ir|kum|kv|kw|ky|la|lb|lez|ln|lo|lt|lv|mg|mh|mi|mk|ml|mn-cn|mo|mr|mt|my|nb|nds|ne|nl|nn|no|nr|nso|ny|oc|om|or|os|pa|pl|ps-af|ps-pk|pt|rm|ro|ru|sa|sah|sco|se|sel|sh|shs|si|sk|sl|sm|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|syr|ta|te|tg|th|ti-er|ti-et|tig|tk|tl|tn|to|tr|ts|tt|tw|tyv|ug|uk|ur|uz|ve|vi|vo|vot|wa|wen|wo|xh|yap|yi|yo|zh-tw|zu|ak|an|ber-dz|byn|crh|csb|dv|ee|fat|fil|hne|hsb|ht|hz|ii|jv|kab|kj|ku-iq|ku-tr|kwm|lg|li|mai|mn-mn|ms|na|ng|nv|ota|pa-pk|pap-an|pap-aw|qu|quz|rn|rw|sc|sd|sg|sid|sn|su|ty|wal|za|lah|brx|sat|doi(s)

再執行

$ fc-scan -f 'lang: %{lang}\n' /usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf

顯示

lang: aa|ab|af|am|ar|as|ast|av|ay|az-az|az-ir|ba|bm|be|bg|bh|bho|bi|bin|bn|bo|br|bs|bua|ca|ce|ch|chm|chr|co|cs|cu|cv|cy|da|de|dz|el|en|eo|es|et|eu|fa|fi|fj|fo|fr|ff|fur|fy|ga|gd|gez|gl|gn|gu|gv|ha|haw|he|hi|ho|hr|hu|hy|ia|ig|id|ie|ik|io|is|it|iu|ja|ka|kaa|ki|kk|kl|km|kn|kok|ku-ir|kum|kv|kw|ky|la|lb|lez|ln|lo|lt|lv|mg|mh|mi|mk|ml|mn-cn|mo|mr|mt|my|nb|nds|ne|nl|nn|no|nr|nso|ny|oc|om|or|os|pa|pl|ps-af|ps-pk|pt|rm|ro|ru|sa|sah|sco|se|sel|sh|shs|si|sk|sl|sm|sma|smj|smn|sms|so|sq|sr|ss|st|sv|sw|syr|ta|te|tg|th|ti-er|ti-et|tig|tk|tl|tn|to|tr|ts|tt|tw|tyv|ug|uk|ur|uz|ve|vi|vo|vot|wa|wen|wo|xh|yap|yi|yo|zh-tw|zu|ak|an|ber-dz|byn|crh|csb|dv|ee|fat|fil|hne|hsb|ht|hz|ii|jv|kab|kj|ku-iq|ku-tr|kwm|lg|li|mai|mn-mn|ms|na|ng|nv|ota|pa-pk|pap-an|pap-aw|qu|quz|rn|rw|sc|sd|sg|sid|sn|su|ty|wal|za|lah|brx|sat|doi

執行

$ fc-validate -l en /usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf

顯示

/usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf:0 Satisfy the coverage for en language

執行

$ fc-validate -l zh-tw /usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf

顯示

/usr/local/share/fonts/CNS11643/TW-Kai-98_1.ttf:0 Satisfy the coverage for zh-tw language