latextruetypemiktexxetex

How to get a list of all available (TTF-) Fonts with XeTeX?


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.


Solution

  • Not a worked out answer, but an idea. All you have to do is iterate over all installed font families, for which an API function exists: EnumFontFamiliesEx.