[Tex/LaTex] How to list all the Chinese fonts I have installed? (Ubuntu, TexLive)

fontslanguagestexlive

I am using package xeCJK and I need to do a \setCJKmainfont{} command but I don't even know which fonts I have available on my system. I have quickly installed a bunch of Chinese fonts but I can't recall what I have installed…

Best Answer

To find out what Chinese font you have in your laptop, bring up the terminal and execute

fc-list :lang=zh-cn > chinese.txt

a text file named chinese.txt will be produced in current directory, with all Chinese font listed.

If a utf8 ignorance error is reported, run the following first

export LC_CTYPE="en_US.UTF-8"

Finally, if you feel like sorting the font names

fc-list :lang=zh-cn | awk -F ": " '{for (f = 2; f <= NF; ++f) { if (f != 2) {printf("%s", OFS);} printf("%s", $f)}; printf "\n"}' | sort -d > chinese.txt