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.
Setting fonts for different LaTeX elements\setromanfont{Times New Roman} This is the normal font used in most of the document, Times New Roman in the example. The elements that require a sans font, explicitly declared by the \ssfamily in the example, will be typeset with Arial font.
Changing default font typeface The font can also be changed for a specific element in the document. The command \fontfamily{qcr}\selectfont will set the TeX gyre cursor font typeface, whose fontcode is qcr , for the text inside the braces.
fc-list | cut -d\ -f2-99 | cut -d: -f1 | sort -u
A two-step-approach
For this one can use albatross
, a command line tool included in tex distributions like texlive. It is designed to find fonts which include certain glyphs, e.g. if you want to typeset a text in English, you can use something like
albatross -b 3 T h e
(replace T h e
with whatever glyphs your font should be able to typeset)
This will give you a list of font names
You can take the list of font names produced in step 1 and let latex iterate over them
% !TeX TS-program = xelatex
\documentclass{article}
\usepackage{pgffor}
\usepackage{fontspec}
\newcommand{\testphrase}{The quick brown fox jumps over the lazy dog.}
\begin{document}
\foreach \x in {
Adobe Caslon Pro,
Adobe Garamond Pro,
% many more fonts here
Zapfino}{
\section{\x}
\begingroup
\setmainfont{\x}
\testphrase
\endgroup
}
\end{document}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With