39

Very neat that I can use any available Truetype font on my Windows machine with MikTeX and XeTeX.

%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[]{article}
\usepackage{xltxtra,fontspec,xunicode}
\defaultfontfeatures{Scale=MatchLowercase}
\title{Fonttest}   
\begin{document} 
  \section{Section Title} {
    \setromanfont{Palatino Linotype}
      The quick brown fox jumps over the lazy dog.
  }
  \section{Section Title} {
    \setromanfont{ProggyCleanTTSZBP}
      The quick brown fox jumps over the lazy dog.
  }
\end{document}

Is there a way to automatically generate a font test page for every available font? So that I do not have to type a test page for every available font by hand?

Actually, I do not even know how to get to the Long Font Name required for \setromanfont -- short of typing it from the screen:

  • The Windows directory only lists the file names, obviously.
  • Maybe this can be done in TeX itself, but I could manage it with a Python script or such like.
Kurt Pfeifle
  • 3,791
towi
  • 2,500
  • 2
  • 22
  • 29
  • If you double click a font, Windows should preview it and show the full name (if I remember correctly; it has been a long time since I used Windows for anything but playing games :) ) – Caramdir Mar 07 '11 at 20:15
  • possible duplicate of http://stackoverflow.com/questions/5109550 – Philipp Mar 08 '11 at 16:27
  • Duplicate, yes. Sorry. I first set the bounty on stackoverflow, then after slow reaction found this Tex Board. I will remove the stackoverflow question after the bounty expires, to give everyone the change to earn their points. – towi Mar 10 '11 at 08:27

1 Answers1

53

Running fc-list utility, e.g. fc-list : family should do (you might need to post process the output for fonts that have localized names), but I'm not sure if texlive ships that part of FontConfig (it does not on Linux, but it is part of system tools anyway). You can also use fc-list -f "%{family}\n" for more customisable output. Check fc-list manual (very terse though, FontConfig's user guide can be a bit helpful as well).

Update: using fc-list :outline -f "%{family}\n" avoids listing bitmap only fonts which are unusable for TeX.

  • This is perfect. I have too check if the names listed are the names I need in my teX document... – towi Mar 14 '11 at 17:07
  • 1
    Shouldn't that be fc-list :fontformat=TrueType so that it only lists fonts that are actually usable with fontspec? – Caramdir Aug 15 '11 at 22:22
  • 3
    fontspec is format neutral, it passes whatever the users asks for to the engine. AFAIK both XeTeX and LuaTeX support several other font formats besides TrueType. – خالد حسني Aug 16 '11 at 01:37
  • Can I assume that the fc-list utility is always present on systems with XeTeX installed? – pwuertz Jun 05 '13 at 11:05
  • @user1313312: It should be available on Linux systems (though it is not mandatory for XeTeX), not sure if it is available as part of TeX distributions on Windows or not. We don’t use FontConfig on Mac. – خالد حسني Jun 05 '13 at 11:48
  • Which brings me to my actual question: Is there a way of getting a list of fonts XeTeX or LuaTeX are able to use? Do you think I should open that as a new question? – pwuertz Jun 05 '13 at 11:59
  • @user1313312: Feel free to do so, but XeTeX itself does not provide such a facility. – خالد حسني Jun 05 '13 at 12:03
  • I can use \setCJKsansfont{MicrosoftYaHei} in my TeX file. But fc-list|grep YaHei give no result. So if I can say fc-list doesn't give complete font list? Thanks. – Leo May 16 '18 at 05:40
  • @Chad: Are you on Linux or Windows? – خالد حسني May 22 '18 at 03:10
  • @KhaledHosny on Ubuntu 16.04. – Leo May 26 '18 at 15:59
  • FWIW fc-list is available on macOS using Homebrew package fontconfig. After looking for various solutions to list fonts available to LaTeX on the StackExchange and elsewhere, it appears to be the best answer to date, especially as it give the sometimes non-intuitive font name, while most other solutions will only give the font file name, with problematic situations like Libertine/Biolinum versions. – FGM Jan 12 '19 at 22:15
  • How do I know which ones have small-caps? – Geremia Jun 11 '19 at 17:39
  • miktex-fc-list is the command on my latest MikTeX 2.9 for Windows 10. – Fuhrmanator Jan 21 '20 at 03:17