danstoner / pandoc_samples

sample pandoc-generated PDF font examples
30 stars 5 forks source link

more concise way to generate the list font families #1

Closed jdhao closed 7 years ago

jdhao commented 7 years ago

After looking up the fontconfig manual, I find that you can generat a list of available font family in you system by using the following command:

fc-list -f "%{family[0]}\n" | sort |uniq

In my CentOS system, it generates the following output:

AR PL UMing CN AR PL UMing HK AR PL UMing TW AR PL UMing TW MBE Abyssinica SIL Caladea Cantarell Carlito Century Schoolbook L Clean DejaVu Sans DejaVu Sans Mono DejaVu Serif Dingbats Fixed FreeMono FreeSans FreeSerif Jomolhari Khmer OS Khmer OS Content Khmer OS System LKLUG Liberation Mono Liberation Sans Liberation Serif Lohit Assamese Lohit Bengali Lohit Devanagari Lohit Gujarati Lohit Kannada Lohit Malayalam Lohit Marathi Lohit Nepali Lohit Oriya Lohit Punjabi Lohit Tamil Lohit Telugu Madan2 Meera NanumGothic Nimbus Mono L Nimbus Roman No9 L Nimbus Sans L Nuosu SIL Open Sans OpenSymbol Overpass PT Sans PT Sans Narrow Padauk PakType Naskh Basic STIX Source Han Serif SC Standard Symbols L URW Bookman L URW Chancery L URW Gothic L URW Palladio L Utopia VL Gothic Waree WenQuanYi Micro Hei WenQuanYi Micro Hei Mono WenQuanYi Zen Hei WenQuanYi Zen Hei Mono WenQuanYi Zen Hei Sharp

Then you don't need cut any more.

danstoner commented 7 years ago

Good tip.

On my systems the results had no line endings. The man fc-list man page has SEE ALSO section where I found the formatter help... FcPatternFormat(3).

https://linux.die.net/man/3/fcpatternformat

Adding a \n to the formatter does the trick.

fc-list -f "%{family[0]}\n" | sort | uniq

jdhao commented 7 years ago

Yes, I missed a \n in my original comment.