diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex')
-rw-r--r-- | Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex | 72 |
1 files changed, 48 insertions, 24 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex index ea07c78b132..f1be182efd7 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex @@ -7,20 +7,20 @@ \part{General font selection} +\section{Main commands} +\label{sec:main-cmd} + This section concerns the variety of commands that can be used to select fonts. +\bigskip \cmdbox{% - \CMD{\string\fontspec}\marg{font name}\oarg{font features}\\ - \CMD{\string\setmainfont}\marg{font name}\oarg{font features}\\ - \CMD{\string\setsansfont}\marg{font name}\oarg{font features}\\ - \CMD{\string\setmonofont}\marg{font name}\oarg{font features}\\ - \CMD{\string\newfontfamily}\meta{cmd}\marg{font name}\oarg{font features} + \CMD{\string\setmainfont}\marg{font}\oarg{font features}\\ + \CMD{\string\setsansfont}{\color[gray]{0.5}\marg{font}\oarg{font features}}\\ + \CMD{\string\setmonofont}{\color[gray]{0.5}\marg{font}\oarg{font features}} } -These are the main font-selecting commands of this package. -The \cs{fontspec} command selects a font for one-time use only; all -others should be used to define the standard fonts used in a document, as shown in \exref{fontload}. +These are the main font-selecting commands of this package which select the standard fonts used in a document, as shown in \exref{fontload}. Here, the scales of the fonts have been chosen to equalise their lowercase letter heights. The \feat{Scale} font feature will be discussed further in \vref{sec:font-ind-features}, including methods for automatic @@ -28,22 +28,36 @@ scaling. Note that further options may need to be added to select appropriate bold/italic fonts, but this shows the main idea. -\begin{Lexample}{fontload}{Loading the default, sans serif, and monospaced fonts.} - \setmainfont{texgyrebonum-regular.otf} - \setsansfont{lmsans10-regular.otf}[Scale=MatchLowercase] - \setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase] - - \rmfamily Pack my box with five dozen liquor jugs\par - \sffamily Pack my box with five dozen liquor jugs\par - \ttfamily Pack my box with five dozen liquor jugs -\end{Lexample} - Note that while these commands all look and behave largely identically, the default setup for font loading automatically adds the |Ligatures=TeX| feature for the \cs{setmainfont} and \cs{setsansfont} commands. These defaults (and further customisations possible) are discussed in \vref{sec:defaults}. -The font features argument accepts comma separated +\bigskip +\cmdbox{% + \CMD{\string\newfontfamily}\meta{cmd}\marg{font}\oarg{font features}\\ + \CMD{\string\setfontfamily}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}}\\ + \CMD{\string\renewfontfamily}{\color[gray]{0.5}\meta{cmd}\marg{font}\oarg{font features}} +} + +These commands define new font family commands (like \cs{rmfamily}). +The |new| command checks if \meta{cmd} has been defined, and issues an error if so. +The |renew| command checks if \meta{cmd} has been defined, and issues an error if not. +The |set| command never checks; use at your own risk. + +\textbf{NEW:} In previous versions of \pkg{fontspec}, only \cs{newfontfamily} was provided, but it behaved +like \cs{setfontfamily}. You'll have to update your code slightly if this now causes problems; apologies. + + +\bigskip +\cmdbox{% + \CMD{\string\fontspec}\marg{font}\oarg{font features} +} + +The plain \cs{fontspec} command is not generally recommended for document use. It is an +ad hoc commands best suited for testing and loading fonts on a one-off basis. + +All of the commands listed above accept comma-separated \meta{font feature}=\meta{option} lists; these are described later: -\begin{itemize} +\begin{itemize}[nosep] \item For general font features, see \vref{sec:font-ind-features} \item For OpenType fonts, see Part~\vref{sec:opentype-features} \item For \XeTeX-only general font features, see Part~\vref{sec:xetex-features} @@ -51,10 +65,19 @@ The font features argument accepts comma separated \item For features for \AAT\ fonts in \XeTeX, see \vref{sec:aat-features} \end{itemize} +\begin{Lexample}{fontload}{Loading the default, sans serif, and monospaced fonts.} + \setmainfont{texgyrebonum-regular.otf} + \setsansfont{lmsans10-regular.otf}[Scale=MatchLowercase] + \setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase] + + \rmfamily Pack my box with five dozen liquor jugs\par + \sffamily Pack my box with five dozen liquor jugs\par + \ttfamily Pack my box with five dozen liquor jugs +\end{Lexample} + \section{Font selection} -In both \LuaTeX\ and \XeTeX, fonts can be selected either by `font name' or -by `file name', but there are some differences in how each engine finds and selects fonts --- don't be too surprised if a font invocation in one engine needs correction to work in the other. +In both \LuaTeX\ and \XeTeX, fonts can be selected (using the \meta{font} argument in \ref{sec:main-cmd}) either by `font name' or by `file name', but there are some differences in how each engine finds and selects fonts --- don't be too surprised if a font invocation in one engine needs correction to work in the other. \subsection{By font name} @@ -299,7 +322,8 @@ A legacy \TeX\ font. {\unicodefont A unicode font.} \feat{~BoldItalicFont} = \meta{font name} \\ \feat{SlantedFont} = \meta{font name} \\ \feat{BoldSlantedFont} = \meta{font name} \\ - \feat{SmallCapsFont} = \meta{font name} + \feat{SmallCapsFont} = \meta{font name} \\ + \feat{UprightFont} = \meta{font name} } The automatic bold, italic, and bold italic font selections will not be @@ -569,7 +593,7 @@ if it were a `naked' control sequence; \eg, `|M. \fontspec{...} N|' and % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ -% Copyright 2004-2017 Will Robertson, LPPL "maintainer" +% Copyright 2004-2018 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang % Copyright 2013-2016 Joseph Wright |