summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/fontspec/fontspec.dtx')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec.dtx649
1 files changed, 382 insertions, 267 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
index 068ceb64f38..ef3b45c4cc3 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
@@ -62,7 +62,7 @@ This work consists of this file fontspec.dtx
%<fontspec>\ProvidesPackage{fontspec}
%<patches>\ProvidesPackage{fontspec-patches}
%<*fontspec|patches>
- [2010/09/29 v2.1b Advanced font selection for XeLaTeX/LuaLaTeX]
+ [2010/11/07 v2.1d Advanced font selection for XeLaTeX/LuaLaTeX]
%</fontspec|patches>
%
%<*driver>
@@ -138,7 +138,7 @@ This work consists of this file fontspec.dtx
%
% This document is typeset with pdf\LaTeX\ using pre-compiled examples
% that have been generated by either \XeTeX\ or \LuaTeX. You may regenerate
-% the examples by removing the \verb|doc/| subdirectory and typesetting the
+% the examples by removing the \verb|doc-files/| subdirectory and typesetting the
% manual with the following invocation:
% \begin{verbatim}
% pdflatex -shell-escape fontspec.dtx
@@ -561,7 +561,7 @@ This work consists of this file fontspec.dtx
% freezes the maths fonts after this stage of the processing. The \pkg{fontspec}
% package must also be loaded after any maths font packages (\eg, \pkg{euler})
% to be successful. (Actually, it is \emph{only} \pkg{euler} that is the
-% problem.\footnote{Speaking of \pkg{euler}, if you want to use its
+% problem.\note{Speaking of \pkg{euler}, if you want to use its
% \texttt{[mathbf]} option, it won't work, and you'll need to put this after
% \pkg{fontspec} is loaded instead:
% \ttfamily\cmd\AtBeginDocument\char`\{\cmd\DeclareMathAlphabet\cmd\mathbf\char`\{U\char`\}\char`\{eur\char`\}\char`\{b\char`\}\char`\{n\char`\}})
@@ -1100,7 +1100,7 @@ This work consists of this file fontspec.dtx
% with a specially drawn glyph for functional or \ae sthetic reasons.
% The list of options, of which multiple may be selected at one time,
% is shown in \ref{feat:Ligatures}.
-% A demonstration with the Linux Libertine fonts\footnote{\url{http://www.linuxlibertine.org/}} is shown in \exref{lig}.
+% A demonstration with the Linux Libertine fonts\note{\url{http://www.linuxlibertine.org/}} is shown in \exref{lig}.
%
% Note the additional features accessed with \verb|Ligatures=TeX|. These are
% not actually real OpenType features, but additions provided by \pkg{luaotfload} (i.e., \LuaTeX\ only) to emulate \TeX's behaviour for \textsc{ascii} input of curly quotes and punctuation. In \XeTeX\ this is achieved with the \feat{Mapping} feature (see \vref{sec:mapping}) but for consistency \verb|Ligatures=TeX| will perform the same function as \verb|Mapping=tex-text|.
@@ -1211,7 +1211,7 @@ This work consists of this file fontspec.dtx
%
% The \opt{Arabic} option (with tag \verb|anum|) maps regular numerals to their Arabic script or Persian equivalents
% based on the current \opt{Language} setting (see \vref{sec:ot}), shown in
-% \exref{num-arab} using the Zar fonts\footnote{\url{http://wiki.irmug.org/index.php/X_Series_2}}.
+% \exref{num-arab} using the Zar fonts\note{\url{http://wiki.irmug.org/index.php/X_Series_2}}.
% This option is based on a \LuaTeX\ feature of the \pkg{luaotfload} package,
% not an OpenType feature. (Thus, this feature is unavailable in \XeTeX.)
%
@@ -1322,7 +1322,7 @@ This work consists of this file fontspec.dtx
% features |ss01|, |ss02|, etc.
%
% Two demonstrations from the Junicode
-% font\footnote{\url{http://junicode.sf.net}}
+% font\note{\url{http://junicode.sf.net}}
% are shown in \exref{ss} and \exref{ss2}; thanks to Adam
% Buchbinder for the suggestion.
%
@@ -1467,7 +1467,7 @@ This work consists of this file fontspec.dtx
% \end{features}
%
% As briefly mentioned previously at the end of \vref{sec:letters},
-% the \opt{Uppercase} option will add a small amount of tracking between uppercase letters, seen in \exref{kernup}, which uses the Romande fonts\footnote{\url{http://arkandis.tuxfamily.org/adffonts.html}} (thanks to Clea F. Rees for the suggestion).
+% the \opt{Uppercase} option will add a small amount of tracking between uppercase letters, seen in \exref{kernup}, which uses the Romande fonts\note{\url{http://arkandis.tuxfamily.org/adffonts.html}} (thanks to Clea F. Rees for the suggestion).
%
% \begin{Xexample}[firstline=2]{kernup}{Adding extra kerning for uppercase letters. (The difference is usually very small.)}
% \large
@@ -1637,7 +1637,7 @@ This work consists of this file fontspec.dtx
%
% \subsubsection{\feat{Script} and \feat{Language} examples}
%
-% In the following examples, the Code2000 font\footnote{\url{http://www.code2000.net/}}
+% In the following examples, the Code2000 font\note{\url{http://www.code2000.net/}}
% is used to typeset the input with and without the OpenType Script
% applied. The text is only rendered correctly in the second case;
% many examples of incorrect diacritic spacing as
@@ -1734,42 +1734,71 @@ This work consists of this file fontspec.dtx
%
% An OpenType font feature file is a plain text file describing OpenType layout
% feature of a font in a human-readable format. The syntax of OpenType feature
-% files is defined by Adobe\footnote{\url{http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html}}.
+% files is defined by Adobe\note{\url{http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html}}.
%
-% Feature files can be used to add or customise OpenType features of a font on
+% Feature files can be used to add or customize OpenType features of a font on
% the fly without editing the font file itself.
%
-% A feature file is loaded by passing its name or path to \feat{FeatureFile};
-% OpenType features defined in the file can be then be applied as usual to the font.
+% Adding a new OpenType feature is as creating a plain text file defining
+% the new feature and then loading it by passing its name or path to
+% \feat{FeatureFile}, then OpenType features defined in the file can be
+% activated as usual.
+%
+% For example, when adding one of the default features like \texttt{kern}
+% or \texttt{liga}, no special activation is needed. On the other hand,
+% an optional feature like \texttt{onum} or \texttt{smcp} will be
+% activated when old style numbers or small capitals are activated,
+% respectively. However, OpenType feature in the feature file can have any
+% and that can be used to selectively activate the feature; for example
+% defining a ligature feature called \texttt{mlig} and then activating it
+% using \feat{RawFeature} option without activating other ligatures in the
+% font.
%
-% For example, to add OpenType mapping of f-ligatures in the Times New Roman
-% font, one can define a \texttt{times-nr.fea} file with content shown in
-% Figure~\ref{fig:featurefile}.
-% Then the font with the new ligatures can be loaded with:
-% \begin{Verbatim}
-% \setmainfont[FeatureFile=times-nr.fea]{Times New Roman}
-% \end{Verbatim}
+% Figure~\ref{fig:featurefile} shows an example feature file. The first two
+% lines set the script and language under which the defined features will be
+% available, which the default language in both default and Latin scripts,
+% respectively.
+%
+% Then it defines a \texttt{liga} feature, which is a glyph substitution
+% feature. The names starting with backslash are glyph names that is to be
+% substituted and while the leading backslash is optional, it is used to
+% escape glyph names when they interfere with preserved keywords. It should
+% also be noted that glyph names are font specific and the same glyph can be
+% named differently in different fonts.
+%
+% Glyph positioning features like kerning can be defined in a similar way,
+% but instead of the keyword \texttt{sub(stitute)} the keyword
+% \texttt{pos(ition)} is used instead. Figure~\ref{fig:featurefile} shows
+% an example of adding kerning between \texttt{AY} and \texttt{ay}\note{
+% The kerning is expressed in font design units which are fractions of em
+% depending on the \emph{units per em} value of the font, usually 1000 for
+% PostScript fonts and 2048 for TrueType fonts.}.
+%
+% Lines starting with \verb|#| are comments and will be ignored.
+%
+% An OpenType feature file can have any number of features and can have a
+% mix of substitution and positioning features, please refer to the full
+% feature file specification for further documentation.
%
% \begin{figure}
-% \caption{Addition of ligatures to a font via the \feat{FeatureFile} font feature.}
+% \caption{An example font feature file.}
% \label{fig:featurefile}
% \hrule
% \begin{Verbatim}
-% lookup fligatures {
-% lookupflag 0;
-% sub \f \i by \fi;
-% sub \f \l by \fl;
-% } fligatures;
+% languagesystem DFLT dflt;
+% languagesystem latn dflt;
%
+% # Ligatures
% feature liga {
-% script DFLT;
-% language dflt ;
-% lookup fligatures;
-%
-% script latn;
-% language dflt ;
-% lookup fligatures;
+% sub \f \i by \fi;
+% sub \f \l by \fl;
% } liga;
+%
+% # Kerning
+% feature kern {
+% pos \A \Y -200;
+% pos \a \y -80;
+% } kern;
% \end{Verbatim}
% \hrule
% \end{figure}
@@ -2446,7 +2475,7 @@ This work consists of this file fontspec.dtx
\RequirePackage{luatextra}[2010/05/10]
\luatexRequireModule{fontspec}
}{
- \msg_error:nn {fontspec} {not-pdftex}
+ \msg_fatal:nn {fontspec} {not-pdftex}
}
}
% \end{macrocode}
@@ -2477,26 +2506,29 @@ This work consists of this file fontspec.dtx
% \subsection{Bits and pieces}
% \paragraph{Conditionals}
% \begin{macrocode}
-\newif\ifzf@firsttime
-\newif\ifzf@nobf
-\newif\ifzf@noit
-\newif\ifzf@nosc
-\newif\ifzf@tfm
-\newif\ifzf@atsui
-\newif\ifzf@icu
-\newif\ifzf@mm
-\newif\ifzf@graphite
+\bool_new:N \l_fontspec_firsttime_bool
+\bool_new:N \l_fontspec_nobf_bool
+\bool_new:N \l_fontspec_noit_bool
+\bool_new:N \l_fontspec_nosc_bool
+% \end{macrocode}
+%
+% \begin{macrocode}
+\bool_new:N \l_fontspec_tfm_bool
+\bool_new:N \l_fontspec_atsui_bool
+\bool_new:N \l_fontspec_icu_bool
+\bool_new:N \l_fontspec_mm_bool
+\bool_new:N \l_fontspec_graphite_bool
% \end{macrocode}
% For dealing with legacy maths
% \begin{macrocode}
-\newif\ifzf@math@euler
-\newif\ifzf@math@lucida
-\newif\ifzf@package@euler@loaded
+\bool_new:N \g_fontspec_math_euler_bool
+\bool_new:N \g_fontspec_math_lucida_bool
+\bool_new:N \g_fontspec_package_euler_loaded_bool
% \end{macrocode}
% For package options:
% \begin{macrocode}
-\newif\if@zf@configfile
-\newif\if@zf@math
+\bool_new:N \g_fontspec_cfg_bool
+\bool_new:N \g_fontspec_math_bool
% \end{macrocode}
% \paragraph{Counters}
% \begin{macrocode}
@@ -2623,11 +2655,15 @@ This work consists of this file fontspec.dtx
{
Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten.
}
-\msg_new:nnn {fontspec} {script-not-exist}
+\msg_new:nnn {fontspec} {script-not-exist-latn}
{
Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\
'Latin'~ script~ used~ instead.
}
+\msg_new:nnn {fontspec} {script-not-exist}
+{
+ Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.
+}
\msg_new:nnn {fontspec} {aat-feature-not-exist}
{
'\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\
@@ -2686,7 +2722,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\msg_new:nnn {fontspec} {defining-font}
{
- Defining~ font~ family~ for~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1].
+ Defining~ font~ family~'\zf@family'~ for~ font~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1].
}
\msg_new:nnn {fontspec} {defining-raw}
{
@@ -2701,8 +2737,11 @@ This work consists of this file fontspec.dtx
{\bfdefault/\itdefault} {bold~ italic}
{\bfdefault/\sidefault} {bold~ italic~ small~ caps}
} {#1}'~
- with~ NFSS~ specification: \\
+ with~ NFSS~ spec.: \\
\l_fontspec_nfss_tl
+ \tl_if_empty:NF \l_fontspec_postadjust_tl {
+ \\ and~ font~ adjustment~ code: \\ \l_fontspec_postadjust_tl
+ }
}
\msg_new:nnn {fontspec} {no-font-shape}
{
@@ -2746,10 +2785,10 @@ This work consists of this file fontspec.dtx
\DeclareOption{cm-default}{
\fontspec_warning:n {cm-default-obsolete}
}
-\DeclareOption{math}{\@zf@mathtrue}
-\DeclareOption{no-math}{\@zf@mathfalse}
-\DeclareOption{config}{\@zf@configfiletrue}
-\DeclareOption{no-config}{\@zf@configfilefalse}
+\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool}
+\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool}
+\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool}
+\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool}
\DeclareOption{quiet}{
\msg_redirect_module:nnn { fontspec } { warning } { info }
\msg_redirect_module:nnn { fontspec } { info } { none }
@@ -2914,6 +2953,7 @@ This work consists of this file fontspec.dtx
\def\g_fontspec_mathrm_tl{\rmdefault}
\def\g_fontspec_mathsf_tl{\sfdefault}
\def\g_fontspec_mathtt_tl{\ttdefault}
+\tl_clear:N \g_fontspec_bfmathrm_tl
% \end{macrocode}
% \end{macro} \end{macro} \end{macro}
% \end{macro}
@@ -3102,8 +3142,12 @@ This work consists of this file fontspec.dtx
\tl_set:Nn \l_fontspec_script_tl {#2}
\int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int}
}{
- \fontspec_warning:nx {script-not-exist} {#1}
- \setkeys[zf@feat]{Script}{Latin}
+ \fontspec_check_script:nTF {latn} {
+ \fontspec_warning:nx {script-not-exist-latn} {#1}
+ \setkeys[zf@feat]{Script}{Latin}
+ }{
+ \fontspec_warning:nx {script-not-exist} {#1}
+ }
}
}
}
@@ -3172,11 +3216,11 @@ This work consists of this file fontspec.dtx
% Test whether the currently selected font has been loaded by fontspec.
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} {
- \ifcsname zf@family@fontdef\f@family\endcsname
+ \cs_if_exist:cTF {g_fontspec_ \f@family _prop} {
\prg_return_true:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3189,12 +3233,12 @@ This work consists of this file fontspec.dtx
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
- \ifzf@atsui
+ \bool_if:NTF \l_fontspec_atsui_bool {
\fontspec_make_AAT_feature_string:nnTF {#1}{#2}
\prg_return_true: \prg_return_false:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3211,11 +3255,7 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
- \prg_return_true:
- \else
- \prg_return_false:
- \fi
+ \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false:
}{
\prg_return_false:
}
@@ -3233,15 +3273,15 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl}
\int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl}
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl}
\tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl}
- \fontspec_check_ot_feat:nTF {#1} \prg_return_true: \prg_return_false:
- \else
+ \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:}
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3258,13 +3298,13 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1}
\fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2}
\fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3282,11 +3322,11 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3304,13 +3344,13 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl}
\int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl}
\fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3328,13 +3368,13 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nn \l_fontspec_script_tl {#1}
\fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1}
\fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false:
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3351,12 +3391,12 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl}
{\prg_return_true:} {\prg_return_false:}
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3372,12 +3412,12 @@ This work consists of this file fontspec.dtx
\fontspec_if_fontspec_font:TF {
\font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl}
{\prg_return_true:} {\prg_return_false:}
- \else
+ }{
\prg_return_false:
- \fi
+ }
}{
\prg_return_false:
}
@@ -3496,7 +3536,7 @@ This work consists of this file fontspec.dtx
\fontspec_preparse_features:nn {#1}{#2}
\fontspec_set_scriptlang:
\fontspec_get_features:n {}
- \zf@firsttimefalse
+ \bool_set_false:N \l_fontspec_firsttime_bool
% \end{macrocode}
% Check if the family is unique and, if so, save its information.
% (\cs{addfontfeature} and other macros use this data.)
@@ -3614,7 +3654,7 @@ This work consists of this file fontspec.dtx
}
}
\tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl}
- \cs_if_exist:cTF {zf@family@fontname\zf@family}
+ \cs_if_exist:cTF {g_fontspec_ \zf@family _prop}
\prg_return_false: \prg_return_true:
}
% \end{macrocode}
@@ -3626,7 +3666,7 @@ This work consists of this file fontspec.dtx
% none are explicitly requested. Similarly with the language settings.
% \begin{macrocode}
\cs_new:Npn \fontspec_set_scriptlang: {
- \ifzf@icu
+ \bool_if:NT \l_fontspec_firsttime_bool {
\tl_if_empty:NTF \l_fontspec_script_name_tl {
\fontspec_check_script:nTF {latn}
{
@@ -3648,7 +3688,7 @@ This work consists of this file fontspec.dtx
\fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
\fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl}
}
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3657,7 +3697,22 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_save_fontinfo:nn}
% Saves the relevant font information for future processing.
% \begin{macrocode}
+\cs_generate_variant:Nn \prop_gput:Nnn {cnV}
+\cs_generate_variant:Nn \prop_gput:Nnn {cnx}
\cs_new:Npn \fontspec_save_fontinfo:nn #1#2 {
+
+ \prop_new:c {g_fontspec_ \zf@family _prop}
+ \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontname} {#2}
+ \prop_gput:cnx {g_fontspec_ \zf@family _prop} {options} {\g_fontspec_default_fontopts_tl #1}
+ \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontdef} {
+ \fontspec_fullname:n {\l_fontspec_fontname_tl} :
+ \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist
+ }
+ \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-num} \l_fontspec_script_int
+ \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-num} \l_fontspec_language_int
+ \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-tag} \l_fontspec_script_tl
+ \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-tag} \l_fontspec_lang_tl
+
\tl_gset:cx {zf@family@fontname\zf@family} {#2}
\tl_gset:cx {zf@family@options\zf@family} {\g_fontspec_default_fontopts_tl #1}
\tl_gset:cx {zf@family@fontdef\zf@family} {
@@ -3696,7 +3751,7 @@ This work consists of this file fontspec.dtx
% undefined) or with the font specified with the \feat{BoldFont} feature.
% \begin{macrocode}
\cs_new:Npn \fontspec_set_bold: {
- \unless\ifzf@nobf
+ \bool_if:NF \l_fontspec_nobf_bool {
\tl_if_empty:NTF \l_fontspec_fontname_bf_tl {
\fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/B}
\bfdefault \updefault \l_fontspec_fontfeat_bf_clist
@@ -3704,7 +3759,7 @@ This work consists of this file fontspec.dtx
\fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl
\bfdefault \updefault \l_fontspec_fontfeat_bf_clist
}
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3713,12 +3768,12 @@ This work consists of this file fontspec.dtx
% And italic in the same way:
% \begin{macrocode}
\cs_new:Npn \fontspec_set_italic: {
- \unless\ifzf@noit
+ \bool_if:NF \l_fontspec_noit_bool {
\tl_if_empty:NTF \l_fontspec_fontname_it_tl
{ \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} }
{ \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl }
\mddefault \itdefault \l_fontspec_fontfeat_it_clist
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3743,11 +3798,7 @@ This work consists of this file fontspec.dtx
% bold italic font.
% \begin{macrocode}
\cs_new:Npn \fontspec_set_bold_italic: {
- \@tempswatrue
- \ifzf@nobf\@tempswafalse\fi
- \ifzf@noit\@tempswafalse\fi
- \bool_if:NT \l_fontspec_external_bool \@tempswafalse
- \if@tempswa
+ \bool_if:nF {\l_fontspec_nobf_bool || \l_fontspec_nobf_bool} {
\tl_if_empty:NTF \l_fontspec_fontname_bfit_tl
{
\tl_if_empty:NTF \l_fontspec_fontname_bf_tl
@@ -3768,7 +3819,7 @@ This work consists of this file fontspec.dtx
\fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl
}
\bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -3800,23 +3851,27 @@ This work consists of this file fontspec.dtx
% Now check if the font is to be rendered with \ATSUI\ or \ICU. This will either
% be automatic (based on the font type), or specified by the user via a font feature.
%
-% This macro sets \cs{zf@atsui} or \cs{zf@icu} or \cs{zf@mm} booleans
+% This macro sets booleans
% accordingly depending if the font in \cmd\zf@basefont\ is an \AAT\
% font or an OpenType font or a font with feature axes (either \AAT\ or
% Multiple Master), respectively.
% \begin{macrocode}
\xetex_or_luatex:nnn { \cs_new:Npn \fontspec_set_font_type: }
{
- \zf@tfmfalse \zf@atsuifalse \zf@icufalse \zf@mmfalse \zf@graphitefalse
+ \bool_set_false:N \l_fontspec_tfm_bool
+ \bool_set_false:N \l_fontspec_atsui_bool
+ \bool_set_false:N \l_fontspec_icu_bool
+ \bool_set_false:N \l_fontspec_mm_bool
+ \bool_set_false:N \l_fontspec_graphite_bool
\ifcase\XeTeXfonttype\zf@basefont
- \zf@tfmtrue
+ \bool_set_true:N \l_fontspec_tfm_bool
\or
- \zf@atsuitrue
+ \bool_set_true:N \l_fontspec_atsui_bool
\ifnum\XeTeXcountvariations\zf@basefont > \c_zero
- \zf@mmtrue
+ \bool_set_true:N \l_fontspec_mm_bool
\fi
\or
- \zf@icutrue
+ \bool_set_true:N \l_fontspec_icu_bool
\fi
% \end{macrocode}
% If automatic, the \cmd{\l_fontspec_renderer_tl} token list will still be
@@ -3825,15 +3880,17 @@ This work consists of this file fontspec.dtx
% other weights of the font are specifically loaded with the same renderer.
% \begin{macrocode}
\tl_if_empty:NT \l_fontspec_renderer_tl {
- \ifzf@atsui
+ \bool_if:NTF \l_fontspec_atsui_bool {
\tl_set:Nn \l_fontspec_renderer_tl {/AAT}
- \else\ifzf@icu
- \tl_set:Nn \l_fontspec_renderer_tl {/ICU}
- \fi\fi
+ }{
+ \bool_if:NT \l_fontspec_icu_bool {
+ \tl_set:Nn \l_fontspec_renderer_tl {/ICU}
+ }
+ }
}
}
{
- \zf@icutrue
+ \bool_set_true:N \l_fontspec_icu_bool
}
% \end{macrocode}
% \end{macro}
@@ -3879,13 +3936,13 @@ This work consists of this file fontspec.dtx
\font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt}
\fontspec_declare_shape:nnnn {}{#2}{#3}{#4}
\tl_if_empty:NTF \l_fontspec_fontname_sc_tl {
- \unless\ifzf@nosc
+ \bool_if:NF \l_fontspec_nosc_bool {
\fontspec_make_smallcaps:T {
\fontspec_declare_shape:nnnn {\l_fontspec_sc_featstr_sclist} {#2}
{ \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault }
{ #4 \l_fontspec_fontfeat_sc_clist }
}
- \fi
+ }
}{
\tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl}
\fontspec_declare_shape:nnnn {}{#2}
@@ -3957,10 +4014,12 @@ This work consists of this file fontspec.dtx
}
% \end{macrocode}
% This extra stuff for the slanted shape substitution is a little bit awkward,
-% but I'd rather have it here than break out yet another macro. Alternatively,
-% one day I might just redefine \cmd\slshape. Why not, eh?
+% but I'd rather have it here than break out yet another macro.
% \begin{macrocode}
- \str_if_eq:xxT {#3} {\itdefault}
+ \bool_if:nT {
+ \str_if_eq_p:xx {#3} {\itdefault} &&
+ !(\str_if_eq_p:xx {\itdefault} {\sldefault})
+ }
{
\use:x {
\exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault}
@@ -3977,13 +4036,13 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\xetex_or_luatex:nnn { \tl_set:Nn \l_fontspec_pre_feat_sclist }
{
- \ifzf@icu
+ \bool_if:NT \l_fontspec_icu_bool {
\tl_if_empty:NF \l_fontspec_script_tl
{
script = \l_fontspec_script_tl ;
language = \l_fontspec_lang_tl ;
}
- \fi
+ }
}
{
mode = \l_fontspec_mode_tl ;
@@ -4002,14 +4061,14 @@ This work consists of this file fontspec.dtx
% This macro is used to build up a complex family name based on its
% features.
%
-% \cmd{\zf@firsttime} is set true in \cmd{\fontspec_select:nn} only the first
+% The \meta{firsttime} boolean is set true in \cmd{\fontspec_select:nn} only the first
% time \cmd{zf@get@feature@requests} is called, so that the family
% name is only created once.
% \begin{macrocode}
\cs_new:Nn \fontspec_update_fontid:n {
- \ifzf@firsttime
+ \bool_if:NT \l_fontspec_firsttime_bool {
\tl_gput_right:Nx \l_fontspec_fontid_tl {#1}
- \fi
+ }
}
% \end{macrocode}
% \end{macro}
@@ -4031,8 +4090,10 @@ This work consists of this file fontspec.dtx
\tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl
\tl_clear:N \l_fontspec_postadjust_tl
\fontspec_setkeys:xx {options} {\l_fontspec_fontfeat_clist #1}
- \tl_if_empty:NF \XKV@rm {
- \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
+ \bool_if:NT \l_fontspec_firsttime_bool {
+ \tl_if_empty:NF \XKV@rm {
+ \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
+ }
}
% \end{macrocode}
% Finish the colour specification.
@@ -4080,8 +4141,8 @@ This work consists of this file fontspec.dtx
% Check whether they're assigned to globally or not.)
% \begin{macrocode}
\newcommand*\fontspec_init:{
- \zf@icufalse
- \zf@firsttimetrue
+ \bool_set_false:N \l_fontspec_icu_bool
+ \bool_set_true:N \l_fontspec_firsttime_bool
\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_namewrap:n ##1 }
{ ##1 }
{ name:##1 }
@@ -4113,16 +4174,18 @@ This work consists of this file fontspec.dtx
\xetex_or_luatex:nn
{
\cs_set:Nn \fontspec_make_smallcaps:T {
- \ifzf@atsui
- \tl_clear:N \l_fontspec_sc_featstr_sclist
- \fontspec_make_AAT_feature_string:nnT {3}{3} {
- \tl_set:Nx \l_fontspec_sc_featstr_sclist {\l_fontspec_feature_string_tl;}
- #1
- }
- \fi
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\fontspec_make_ot_smallcaps:T {#1}
- \fi
+ }{
+ \bool_if:NT \l_fontspec_atsui_bool {
+ \tl_clear:N \l_fontspec_sc_featstr_sclist
+ \fontspec_make_AAT_feature_string:nnT {3}{3} {
+ \tl_set:Nx \l_fontspec_sc_featstr_sclist
+ {\l_fontspec_feature_string_tl;}
+ #1
+ }
+ }
+ }
}
}
{
@@ -4155,9 +4218,9 @@ This work consists of this file fontspec.dtx
% separated by semicolons.
% \begin{macrocode}
\cs_new:Nn \fontspec_update_featstr:n {
- \unless\ifzf@firsttime
- \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1}
- \fi
+ \bool_if:NF \l_fontspec_firsttime_bool {
+ \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1;}
+ }
}
% \end{macrocode}
% \end{macro}
@@ -4171,12 +4234,13 @@ This work consists of this file fontspec.dtx
\cs_new:Npn \fontspec_make_feature:nnn #1#2#3 {
\xetex_or_luatex:nn
{
- \ifzf@atsui
- \fontspec_make_AAT_feature:nn {#1}{#2}
- \fi
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\fontspec_make_ICU_feature:n {#3}
- \fi
+ }{
+ \bool_if:NT \l_fontspec_atsui_bool {
+ \fontspec_make_AAT_feature:nn {#1}{#2}
+ }
+ }
}
{
\fontspec_make_ICU_feature:n {#3}
@@ -4280,11 +4344,11 @@ This work consists of this file fontspec.dtx
\tl_if_empty:NTF \l_tmpa_tl
{ \prg_return_false: }
{
- \intexpr_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 }
+ \int_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 }
{
\tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2}
}{
- \intexpr_if_even:nTF {#2}
+ \int_if_even:nTF {#2}
{
\tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2}
}{
@@ -4359,7 +4423,7 @@ This work consists of this file fontspec.dtx
\int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts\zf@basefont }
\int_zero:N \l_tmpa_int
\@tempswafalse
- \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
+ \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
{
\ifnum \XeTeXOTscripttag\zf@basefont \l_tmpa_int = \l_fontspec_strnum_int
\@tempswatrue
@@ -4392,7 +4456,7 @@ This work consists of this file fontspec.dtx
}
\int_zero:N \l_tmpa_int
\@tempswafalse
- \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
+ \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
{
\ifnum\XeTeXOTlanguagetag\zf@basefont\l_fontspec_script_int \l_tmpa_int =\l_fontspec_strnum_int
\@tempswatrue
@@ -4433,7 +4497,7 @@ This work consists of this file fontspec.dtx
\fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1}
\int_zero:N \l_tmpa_int
\@tempswafalse
- \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
+ \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int }
{
\ifnum\XeTeXOTfeaturetag\zf@basefont\l_fontspec_script_int\l_fontspec_language_int
\l_tmpa_int =\l_fontspec_strnum_int
@@ -4475,8 +4539,8 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\bool_new:N \l_fontspec_external_bool
\define@key[zf]{preparse-external}{ExternalLocation}[]{
- \zf@nobftrue
- \zf@noittrue
+ \bool_set_true:N \l_fontspec_nobf_bool
+ \bool_set_true:N \l_fontspec_noit_bool
\bool_set_true:N \l_fontspec_external_bool
\xetex_or_luatex:nnn { \cs_gset:Npn \fontspec_namewrap:n ##1 }
{ [ #1 ##1 ] }
@@ -4511,7 +4575,7 @@ This work consists of this file fontspec.dtx
\define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num]
{AAT,ICU,Graphite,Full,Basic}{
\fontspec_update_fontid:n {+rend:#1}
- \intexpr_compare:nTF {\l_tmpa_num < 3} {
+ \int_compare:nTF {\l_tmpa_num < 3} {
\xetex_or_luatex:nn
{
\tl_set:Nv \l_fontspec_renderer_tl {g_fontspec_renderer_tag_\l_tmpa_tl}
@@ -4569,11 +4633,11 @@ This work consists of this file fontspec.dtx
\define@key[zf]{preparse-external}{BoldFont}{
\tl_if_empty:nTF {#1}
{
- \zf@nobftrue
+ \bool_set_true:N \l_fontspec_nobf_bool
\fontspec_update_fontid:n {nobf}
}
{
- \zf@nobffalse
+ \bool_set_false:N \l_fontspec_nobf_bool
\fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1}
\fontspec_update_fontid:n {bf:#1}
}
@@ -4584,10 +4648,10 @@ This work consists of this file fontspec.dtx
\define@key[zf]{preparse-external}{ItalicFont}{
\tl_if_empty:nTF {#1}
{
- \zf@noittrue
+ \bool_set_true:N \l_fontspec_noit_bool
\fontspec_update_fontid:n {noit}
}{
- \zf@noitfalse
+ \bool_set_false:N \l_fontspec_noit_bool
\fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1}
\fontspec_update_fontid:n {it:#1}
}
@@ -4613,10 +4677,10 @@ This work consists of this file fontspec.dtx
\define@key[zf]{options}{SmallCapsFont}{
\tl_if_empty:nTF {#1}
{
- \zf@nosctrue
+ \bool_set_true:N \l_fontspec_nosc_bool
\fontspec_update_fontid:n {nosc}
}{
- \zf@noscfalse
+ \bool_set_true:N \l_fontspec_nosc_bool
\fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1}
\fontspec_update_fontid:n {sc:\zap@space #1~\@empty}
}
@@ -4669,7 +4733,9 @@ This work consists of this file fontspec.dtx
% Note that small caps features can vary by shape, so these in fact \emph{aren't} pre-parsed.
% \begin{macrocode}
\define@key[zf]{options}{SmallCapsFeatures}{
- \unless\ifzf@firsttime\def\l_fontspec_fontfeat_sc_clist{, #1}\fi
+ \bool_if:NF \l_fontspec_firsttime_bool {
+ \def\l_fontspec_fontfeat_sc_clist{, #1}
+ }
\fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty}
}
% \end{macrocode}
@@ -4766,9 +4832,9 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\define@key[zf]{options}{WordSpace}{
\fontspec_update_fontid:n {+wordspace:#1}
- \unless\ifzf@firsttime
+ \bool_if:NF \l_fontspec_firsttime_bool {
\_fontspec_parse_wordspace:w #1,,,\q_stop
- \fi
+ }
}
% \end{macrocode}
%
@@ -4788,8 +4854,7 @@ This work consists of this file fontspec.dtx
\dim_set:Nn \@tempdimb {#2\fontdimen3\zf@basefont}
\dim_set:Nn \@tempdimc {#3\fontdimen4\zf@basefont}
}
- \tl_set:Nx \l_fontspec_postadjust_tl {
- \l_fontspec_postadjust_tl
+ \tl_put_right:Nx \l_fontspec_postadjust_tl {
\fontdimen2\font\the\@tempdima
\fontdimen3\font\the\@tempdimb
\fontdimen4\font\the\@tempdimc
@@ -4804,7 +4869,16 @@ This work consists of this file fontspec.dtx
\define@key[zf]{options}{PunctuationSpace}{
\fontspec_update_fontid:n {+punctspace:#1}
\setlength\@tempdima{#1\fontdimen7\zf@basefont}
- \tl_set:Nx \l_fontspec_postadjust_tl {\l_fontspec_postadjust_tl\fontdimen7\font\the\@tempdima}
+ \tl_put_right:Nx \l_fontspec_postadjust_tl {\fontdimen7\font\the\@tempdima}
+}
+% \end{macrocode}
+%
+% \paragraph{Secret hook into the font-adjustment code}
+%
+% \begin{macrocode}
+\define@key[zf]{options}{FontAdjustment}{
+ \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}}
+ \tl_put_right:Nx \l_fontspec_postadjust_tl {#1}
}
% \end{macrocode}
%
@@ -4855,15 +4929,15 @@ This work consists of this file fontspec.dtx
\convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
}
{
- \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 }
+ \int_compare:nTF { \tl_elt_count:n {#1} == 6 }
{ \tl_set:Nn \l_fontspec_hexcol_tl {#1} }
{
- \intexpr_compare:nTF { \tl_elt_count:n {#1} == 8 }
+ \int_compare:nTF { \tl_elt_count:n {#1} == 8 }
{ \fontspec_parse_colour:viii #1 }
{
- \ifzf@firsttime\else
+ \bool_if:NF \l_fontspec_firsttime_bool {
\fontspec_warning:nx {bad-colour} {#1}
- \fi
+ }
}
}
}
@@ -4872,9 +4946,9 @@ This work consists of this file fontspec.dtx
\tl_set:Nn \l_fontspec_hexcol_tl {#1#2#3#4#5#6}
\tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
{
- \ifzf@firsttime\else
+ \bool_if:NF \l_fontspec_firsttime_bool {
\fontspec_warning:nx {opa-twice-col} {#7#8}
- \fi
+ }
}
\tl_set:Nn \l_fontspec_opacity_tl {#7#8}
}
@@ -4887,9 +4961,9 @@ This work consists of this file fontspec.dtx
\setcounter {fontspec_tmp_int} { 255*\real{#1} }
\tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
{
- \ifzf@firsttime\else
+ \bool_if:NF \l_fontspec_firsttime_bool {
\fontspec_warning:nx {opa-twice} {#1}
- \fi
+ }
}
\tl_set:Nx \l_fontspec_opacity_tl
{ \nhex2 { \value{fontspec_tmp_int} } }
@@ -4937,21 +5011,20 @@ This work consists of this file fontspec.dtx
}
\define@key[zf]{options}{OpticalSize}{
\xetex_or_luatex:nn {
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
\fontspec_update_fontid:n {+size:#1}
- \fi
- \ifzf@mm
- \fontspec_update_fontid:n {+size:#1}
- \fontspec_update_featstr:n{optical size=#1}
- \fi
- \ifzf@icu\else
- \ifzf@mm\else
- \ifzf@firsttime
- \fontspec_warning:n {no-opticals}
- \fi
- \fi
- \fi
+ }{
+ \bool_if:NT \l_fontspec_mm_bool {
+ \fontspec_update_fontid:n {+size:#1}
+ \fontspec_update_featstr:n{optical size=#1}
+ }
+ }
+ \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool }{
+ \bool_if:NT \l_fontspec_firsttime_bool {
+ \fontspec_warning:n {no-opticals}
+ }
+ }
}{
\tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
\fontspec_update_fontid:n {+size:#1}
@@ -4987,7 +5060,7 @@ This work consists of this file fontspec.dtx
% \pkg{fontspec}.)
% \begin{macrocode}
\define@key[zf]{options}{AutoFakeSlant}[0.2]{
- \ifzf@firsttime
+ \bool_if:NT \l_fontspec_firsttime_bool {
\tl_set:Nn \l_fontspec_fake_slant_tl {#1}
\clist_put_right:Nn \l_fontspec_fontfeat_it_clist {,FakeSlant=#1}
\tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl
@@ -4997,13 +5070,13 @@ This work consists of this file fontspec.dtx
{,FakeBold=\l_fontspec_fake_embolden_tl,FakeSlant=#1}
\tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl
}
- \fi
+ }
}
% \end{macrocode}
% Same but reversed:
% \begin{macrocode}
\define@key[zf]{options}{AutoFakeBold}[1.5]{
- \ifzf@firsttime
+ \bool_if:NT \l_fontspec_firsttime_bool {
\tl_set:Nn \l_fontspec_fake_embolden_tl {#1}
\tl_put_right:Nn \l_fontspec_fontfeat_bf_clist {,FakeBold=#1}
\tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl
@@ -5013,7 +5086,7 @@ This work consists of this file fontspec.dtx
{,FakeSlant=\l_fontspec_fake_slant_tl,FakeBold=#1}
\tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl
}
- \fi
+ }
}
% \end{macrocode}
%
@@ -5193,7 +5266,7 @@ This work consists of this file fontspec.dtx
%
% \begin{macrocode}
\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_salt:n #1 }
- {+salt=#1} { +salt= \intexpr_eval:n {#1+1} }
+ {+salt=#1} { +salt= \int_eval:n {#1+1} }
% \end{macrocode}
%
% \begin{macrocode}
@@ -5221,6 +5294,31 @@ This work consists of this file fontspec.dtx
}
% \end{macrocode}
%
+%
+% \subsubsection{OpenType maths font features}
+% Used internally by \pkg{unicode-math}; their names might change:
+% \begin{macrocode}
+\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptStyle}[]}
+{
+ \fontspec_update_fontid:n {+ssty=0}
+ \fontspec_update_featstr:n{+ssty=0}
+}
+{
+ \fontspec_update_fontid:n {+ssty=1}
+ \fontspec_update_featstr:n{+ssty=1}
+}
+\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptScriptStyle}[]}
+{
+ \fontspec_update_fontid:n {+ssty=1}
+ \fontspec_update_featstr:n{+ssty=1}
+}
+{
+ \fontspec_update_fontid:n {+ssty=2}
+ \fontspec_update_featstr:n{+ssty=2}
+}
+% \end{macrocode}
+%
+%
% \subsubsection{Style}
% \begin{macrocode}
\fontspec_define_font_feature:n{Style}
@@ -5292,21 +5390,21 @@ This work consists of this file fontspec.dtx
%
% \begin{macrocode}
\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_nalt:n #1 }
- {+nalt=#1} { +nalt= \intexpr_eval:n {#1+1} }
+ {+nalt=#1} { +nalt= \int_eval:n {#1+1} }
% \end{macrocode}
%
% \subsubsection{Vertical}
% \begin{macrocode}
\fontspec_define_font_feature:n{Vertical}
\define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{
- \ifzf@icu
+ \bool_if:NTF \l_fontspec_icu_bool {
\fontspec_make_feature:nnn{}{}{+vrt2}
\fontspec_update_fontid:n {+vert}
\fontspec_update_featstr:n{vertical}
- \else
+ }{
\fontspec_update_fontid:n {+vert}
\fontspec_update_featstr:n{vertical}
- \fi
+ }
}
% \end{macrocode}
%
@@ -5676,19 +5774,22 @@ This work consists of this file fontspec.dtx
% maths font package has been loaded.
%
% \begin{macrocode}
-\@ifpackageloaded{euler}{\zf@package@euler@loadedtrue}
- {\zf@package@euler@loadedfalse}
+\@ifpackageloaded{euler}{
+ \bool_set_true:N \g_fontspec_package_euler_loaded_bool
+}{
+ \bool_set_false:N \g_fontspec_package_euler_loaded_bool
+}
\cs_set:Nn \fontspec_setup_maths: {
\@ifpackageloaded{euler}{
- \ifzf@package@euler@loaded
- \zf@math@eulertrue
- \else
+ \bool_if:NTF \g_fontspec_package_euler_loaded_bool {
+ \bool_set_true:N \g_fontspec_math_euler_bool
+ }{
\fontspec_error:n {euler-too-late}
- \fi
+ }
}{}
- \@ifpackageloaded{lucbmath}{\zf@math@lucidatrue}{}
- \@ifpackageloaded{lucidabr}{\zf@math@lucidatrue}{}
- \@ifpackageloaded{lucimatx}{\zf@math@lucidatrue}{}
+ \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{}
+ \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{}
+ \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{}
% \end{macrocode}
% Knuth's CM fonts fonts are all squashed together, combining letters,
% accents, text symbols and maths symbols all in the one font,
@@ -5751,7 +5852,7 @@ This work consists of this file fontspec.dtx
% The following symbols are only defined specifically in \pkg{euler}, so skip them
% if that package is loaded.
% \begin{macrocode}
- \ifzf@math@euler\else
+ \bool_if:NF \g_fontspec_math_euler_bool {
\DeclareMathSymbol{!}{\mathclose}{legacymaths}{33}
\DeclareMathSymbol{:}{\mathrel} {legacymaths}{58}
\DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59}
@@ -5761,7 +5862,7 @@ This work consists of this file fontspec.dtx
% so we only need to run this code if no extra maths package has been
% loaded.
% \begin{macrocode}
- \ifzf@math@lucida\else
+ \bool_if:NF \g_fontspec_math_lucida_bool {
\DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0}
\DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1}
\DeclareMathSymbol{2}{\mathalpha}{legacymaths}{`2}
@@ -5791,8 +5892,8 @@ This work consists of this file fontspec.dtx
\DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3}
\DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14}
\DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36}
- \fi
- \fi
+ }
+ }
% \end{macrocode}
% Finally, we change the font definitions for \cmd\mathrm\ and so
% on. These are defined using the \cmd\g_fontspec_mathrm_tl\ (\dots) macros,
@@ -5812,14 +5913,14 @@ This work consists of this file fontspec.dtx
\SetMathAlphabet\mathsf{normal}\zf@enc\g_fontspec_mathsf_tl\mddefault\updefault
\SetMathAlphabet\mathtt{normal}\zf@enc\g_fontspec_mathtt_tl\mddefault\updefault
\SetSymbolFont{operators}{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault
- \ifdefined\g_fontspec_bfmathrm_tl
+ \tl_if_empty:NTF \g_fontspec_bfmathrm_tl {
+ \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault
+ \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault
+ }{
\SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\updefault
\SetMathAlphabet\mathbf{bold}\zf@enc\g_fontspec_bfmathrm_tl\bfdefault\updefault
\SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\itdefault
- \else
- \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault
- \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault
- \fi
+ }
\SetMathAlphabet\mathsf{bold}\zf@enc\g_fontspec_mathsf_tl\bfdefault\updefault
\SetMathAlphabet\mathtt{bold}\zf@enc\g_fontspec_mathtt_tl\bfdefault\updefault
}
@@ -5829,37 +5930,37 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_maybe_setup_maths:}
% We're a little less sophisticated about not executing the maths setup if various other maths font packages are loaded. This list is based on the wonderful `\LaTeX Font Catalogue': \url{http://www.tug.dk/FontCatalogue/mathfonts.html}. I'm sure there are more I've missed. Do the \TeX\ Gyre fonts have maths support yet?
%
-% Untested: would |\unless\ifnum\Gamma=28672\relax\@zf@mathfalse\fi| be a better test?
+% Untested: would |\unless\ifnum\Gamma=28672\relax\bool_set_false:N \g_fontspec_math_bool\fi| be a better test?
% This needs more cooperation with euler and lucida, I think.
% \begin{macrocode}
\cs_new:Nn \fontspec_maybe_setup_maths: {
\@ifpackageloaded{anttor}{
- \ifx\define@antt@mathversions a\@zf@mathfalse\fi}{}
- \@ifpackageloaded{arev}{\@zf@mathfalse}{}
- \@ifpackageloaded{eulervm}{\@zf@mathfalse}{}
- \@ifpackageloaded{mathdesign}{\@zf@mathfalse}{}
- \@ifpackageloaded{concmath}{\@zf@mathfalse}{}
- \@ifpackageloaded{cmbright}{\@zf@mathfalse}{}
- \@ifpackageloaded{mathesf}{\@zf@mathfalse}{}
- \@ifpackageloaded{gfsartemisia}{\@zf@mathfalse}{}
- \@ifpackageloaded{gfsneohellenic}{\@zf@mathfalse}{}
+ \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{}
+ \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{}
\@ifpackageloaded{iwona}{
- \ifx\define@iwona@mathversions a\@zf@mathfalse\fi}{}
- \@ifpackageloaded{kpfonts}{\@zf@mathfalse}{}
- \@ifpackageloaded{kmath}{\@zf@mathfalse}{}
+ \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{}
+ \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{}
\@ifpackageloaded{kurier}{
- \ifx\define@kurier@mathversions a\@zf@mathfalse\fi}{}
- \@ifpackageloaded{fouriernc}{\@zf@mathfalse}{}
- \@ifpackageloaded{fourier}{\@zf@mathfalse}{}
- \@ifpackageloaded{mathpazo}{\@zf@mathfalse}{}
- \@ifpackageloaded{mathptmx}{\@zf@mathfalse}{}
- \@ifpackageloaded{MinionPro}{\@zf@mathfalse}{}
- \@ifpackageloaded{unicode-math}{\@zf@mathfalse}{}
- \@ifpackageloaded{breqn}{\@zf@mathfalse}{}
- \if@zf@math
+ \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{}
+ \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{fourier}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{}
+ \bool_if:NT \g_fontspec_math_bool {
\fontspec_info:n {setup-math}
\fontspec_setup_maths:
- \fi
+ }
}
\AtBeginDocument{\fontspec_maybe_setup_maths:}
% \end{macrocode}
@@ -5869,11 +5970,11 @@ This work consists of this file fontspec.dtx
% \subsection{Finishing up}
% Now we just want to set up loading the \texttt{.cfg} file, if it exists.
% \begin{macrocode}
-\if@zf@configfile
+\bool_if:NT \g_fontspec_cfg_bool {
\InputIfFileExists{fontspec.cfg}
{}
{\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}}
-\fi
+}
% \end{macrocode}
%
% The end! Thanks for coming.
@@ -5889,7 +5990,6 @@ This work consists of this file fontspec.dtx
% First we define some metadata.
% \begin{macrocode}
fontspec = { }
-
fontspec.module = {
name = "fontspec",
version = 2.0,
@@ -5899,26 +5999,18 @@ fontspec.module = {
copyright = "Khaled Hosny",
license = "LPPL"
}
-
luatexbase.provides_module(fontspec.module)
-
% \end{macrocode}
% Some utility functions
% \begin{macrocode}
-
-utf = unicode.utf8
-
function fontspec.log (...) luatexbase.module_log (fontspec.module.name, string.format(...)) end
function fontspec.warning(...) luatexbase.module_warning(fontspec.module.name, string.format(...)) end
function fontspec.error (...) luatexbase.module_error (fontspec.module.name, string.format(...)) end
-
function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-package'], ...) end
-
% \end{macrocode}
% The following functions check for exsitence of certain script, language or
% feature in a given font.
% \begin{macrocode}
-
local function check_script(id, script)
local s = string.lower(script)
if id and id > 0 then
@@ -5937,7 +6029,9 @@ local function check_script(id, script)
end
end
end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
local function check_language(id, language, script)
local s = string.lower(script)
local l = string.lower(language)
@@ -5957,7 +6051,9 @@ local function check_language(id, language, script)
end
end
end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
local function check_feature(id, feature, language, script)
local s = string.lower(script)
local l = string.lower(language)
@@ -5978,14 +6074,14 @@ local function check_feature(id, feature, language, script)
end
end
end
-
% \end{macrocode}
% The following are the function that get called from \TeX\ end.
% \begin{macrocode}
-
local function tempswatrue() fontspec.sprint([[\@tempswatrue]]) end
local function tempswafalse() fontspec.sprint([[\@tempswafalse]]) end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
function fontspec.check_ot_script(fnt, script)
if check_script(font.id(fnt), script) then
tempswatrue()
@@ -5993,7 +6089,9 @@ function fontspec.check_ot_script(fnt, script)
tempswafalse()
end
end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
function fontspec.check_ot_lang(fnt, lang, script)
if check_language(font.id(fnt), lang, script) then
tempswatrue()
@@ -6001,7 +6099,9 @@ function fontspec.check_ot_lang(fnt, lang, script)
tempswafalse()
end
end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
function fontspec.check_ot_feat(fnt, feat, lang, script)
for _, f in ipairs { "+trep", "+tlig", "+anum" } do
if feat == f then
@@ -6015,7 +6115,23 @@ function fontspec.check_ot_feat(fnt, feat, lang, script)
tempswafalse()
end
end
-
+% \end{macrocode}
+%
+% \begin{macrocode}
+function fontspec.mathfontdimen(fnt, str)
+ local mathdimens = fonts.ids[font.id(fnt)].MathConstants
+ if mathdimens then
+ local m = mathdimens[str]
+ if m then
+ fontspec.sprint(mathdimens[str])
+ fontspec.sprint("sp")
+ else
+ fontspec.sprint("0pt")
+ end
+ else
+ fontspec.sprint("0pt")
+ end
+end
% \end{macrocode}
%
% \iffalse
@@ -6445,11 +6561,11 @@ If you want to run just a single test, use
\def\prefix{#4}
\refstepcounter{example}%
\label{ex:\filename}%
- \IfFileExists{doc/\theexample-\prefix-\filename.tex}{}{%
- \immediate\write18{cd doc && rm -f \theexample-* ;}%
+ \IfFileExists{doc-files/\theexample-\prefix-\filename.tex}{}{%
+ \immediate\write18{cd doc-files && rm -f \theexample-* ;}%
}%
\VerbatimEnvironment
- \begin{VerbatimOut}{doc/\theexample-\prefix-\filename.tex}}
+ \begin{VerbatimOut}{doc-files/\theexample-\prefix-\filename.tex}}
% text in the environment
{\end{VerbatimOut}
\begin{figure}
@@ -6457,12 +6573,12 @@ If you want to run just a single test, use
\edef\@tempa{[gobble=0,fontsize=\noexpand\small,\options]}%
\savebox\X{%
\expandafter\BVerbatimInput
- \@tempa{doc/\theexample-\prefix-\filename.tex}%
+ \@tempa{doc-files/\theexample-\prefix-\filename.tex}%
}%
- \IfFileExists{doc/\theexample-\prefix-\filename.pdf}{}
+ \IfFileExists{doc-files/\theexample-\prefix-\filename.pdf}{}
{%
\edef\1{%
- cd doc; \csname prog@\prefix\endcsname
+ cd doc-files; \csname prog@\prefix\endcsname
"%
\unexpanded{%
\documentclass{article}%
@@ -6474,16 +6590,16 @@ If you want to run just a single test, use
"
}%
\immediate\write18{
- mkdir -p doc;
- cp -a fontspec.dtx doc/;
- cd doc;
+ mkdir -p doc-files/;
+ cp -a fontspec.dtx doc-files/;
+ cd doc-files;
tex fontspec.dtx > /dev/null ;
}
\immediate\write18{\unexpanded\expandafter{\1}}%
}%
\savebox\Y{%
- \IfFileExists{doc/\theexample-\prefix-\filename.pdf}
- {\includegraphics{doc/\theexample-\prefix-\filename.pdf}}
+ \IfFileExists{doc-files/\theexample-\prefix-\filename.pdf}
+ {\includegraphics{doc-files/\theexample-\prefix-\filename.pdf}}
{Graphic not generated.}%
}
% TYPESETTING
@@ -6540,7 +6656,6 @@ If you want to run just a single test, use
\def\AAT{\textsc{aat}}
\def\ATSUI{\textsc{atsui}}
\def\ICU{\textsc{icu}}
-\def\LuaTeX{L\kern-0.08emu\kern-0.03ema\kern-0.12em\TeX}
%% (La)TeX font-related declarations:
\linespread{1.05} % Pagella needs more space between lines