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.
3
  • 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
    Commented Mar 7, 2011 at 20:15
  • possible duplicate of stackoverflow.com/questions/5109550
    – Philipp
    Commented Mar 8, 2011 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
    Commented Mar 10, 2011 at 8:27

1 Answer 1

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.

13
  • This is perfect. I have too check if the names listed are the names I need in my teX document...
    – towi
    Commented Mar 14, 2011 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
    Commented Aug 15, 2011 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. Commented Aug 16, 2011 at 1:37
  • Can I assume that the fc-list utility is always present on systems with XeTeX installed?
    – pwuertz
    Commented Jun 5, 2013 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. Commented Jun 5, 2013 at 11:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .