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...
Asked
Active
Viewed 4,097 times
8
Romain Picot
- 6,730
- 4
- 28
- 58
Yan King Yin
- 1,743
- 1
- 19
- 26
1 Answers
9
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
zyy
- 2,146
-
How to use this command in the current directory and display only the font file name (with or without full path) ? – DevonDahon Jul 11 '19 at 10:23
-
@maxagaz What do you mean by current directory? I think this can be used in any directory. As for the displaying only the font name, I have updated in the answer. – zyy Jul 11 '19 at 19:52
;-)– Romain Picot Nov 16 '15 at 07:52/usr/share/fontsand foundukai.ttc, then I use/setCJKmainfont{ukai.ttc}and it worked. At first the error was because I didn't use full file-name with extension. – Yan King Yin Nov 16 '15 at 08:06fc-list :lang=zh– Thérèse Nov 16 '15 at 11:20