summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r--Master/texmf-dist/source/latex/fontspec/Makefile20
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec.dtx1640
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx15
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx9
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx12
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx11
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F003a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F003b.ltx)5
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx18
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx11
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F006a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F001b-emph.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F001a-basic-loading.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx22
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx19
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F002a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F004a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx8
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx10
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx12
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F005a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F200a-test-prog.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F100e.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F100d.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F100c.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F100a.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx (renamed from Master/texmf-dist/source/latex/fontspec/testsuite/F100b.ltx)0
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx20
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx11
-rw-r--r--Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex39
31 files changed, 1190 insertions, 692 deletions
diff --git a/Master/texmf-dist/source/latex/fontspec/Makefile b/Master/texmf-dist/source/latex/fontspec/Makefile
index d45e10b100c..2a0b321947e 100644
--- a/Master/texmf-dist/source/latex/fontspec/Makefile
+++ b/Master/texmf-dist/source/latex/fontspec/Makefile
@@ -20,7 +20,8 @@ help:
@echo ' world - all & ctan'
@echo ' clean - remove all generated and built files'
@echo ' '
- @echo ' install - install the package into your home texmf tree'
+ @echo ' install - install the complete package into your home texmf tree'
+ @echo ' sty-install - install the package code only'
@echo ' install TEXMFROOT=<texmf> - install the package into the path <texmf>'
@echo ' '
@echo ' check - run the test suite'
@@ -41,7 +42,7 @@ REDIRECT = > /dev/null
# Files grouped by generation mode
COMPILED = $(DOC) fontspec-testsuite.pdf
EXAMPLES = fontspec-example.tex
-UNPACKED = fontspec.sty fontspec-patches.sty fontspec.lua fontspec.cfg $(EXAMPLES)
+UNPACKED = fontspec.sty fontspec-xetex.sty fontspec-luatex.sty fontspec-patches.sty fontspec.lua fontspec.cfg $(EXAMPLES)
SOURCE = $(DTX) Makefile README
GENERATED = $(COMPILED) $(UNPACKED)
@@ -112,6 +113,10 @@ define run-install
@mkdir -p $(SRCDIR)/testsuite/ && cp $(TESTS) $(SRCDIR)/testsuite/
endef
+define run-sty-install
+@mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR)
+endef
+
$(TDS_ZIP): TEXMFROOT=./tmp-texmf
$(TDS_ZIP): $(ALL_FILES)
@echo "Making TDS-ready archive $@."
@@ -140,6 +145,14 @@ install: $(ALL_FILES)
@echo "Installing in '$(TEXMFROOT)'."
$(run-install)
+sty-install: $(RUNFILES)
+ @if test ! -n "$(TEXMFROOT)" ; then \
+ echo "Cannot locate your home texmf tree. Specify manually with\n\n make install TEXMFROOT=/path/to/texmf\n" ; \
+ false ; \
+ fi ;
+ @echo "Installing in '$(TEXMFROOT)'."
+ $(run-install)
+
manifest:
@echo "Source files:"
@for f in $(SOURCE); do echo $$f; done
@@ -150,6 +163,7 @@ manifest:
clean:
@$(RM) -- *.log *.aux *.toc *.idx *.ind *.ilg *.glo *.gls *.example *.out *.synctex* *.tmp fontspec-style.sty *.ins fontspec*.pdf
@$(RM) -- $(GENERATED) $(ZIPS)
+ @$(RM) -- $(builddir)/*
#############
@@ -168,7 +182,7 @@ COPY = cp -a
MOVE = mv -f
COMPARE_OPTS = -density 300x300 -metric ae -fuzz 35%
-LTXSOURCE = $(NAME).sty $(NAME).cfg $(NAME)-patches.sty
+LTXSOURCE = $(NAME).sty $(NAME)-xetex.sty $(NAME)-luatex.sty $(NAME).cfg $(NAME)-patches.sty
TESTLIST = testsuite-listing.tex
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
index e020f651bed..759f5f291f9 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
@@ -42,6 +42,8 @@ This work consists of this file fontspec.dtx
\let\MetaPrefix\DoubleperCent
\generate{\file{fontspec.sty} {\from{fontspec.dtx}{fontspec}}}
+\generate{\file{fontspec-xetex.sty} {\from{fontspec.dtx}{fontspec,xetexx}}}
+\generate{\file{fontspec-luatex.sty} {\from{fontspec.dtx}{fontspec,luatex}}}
\generate{\file{fontspec-patches.sty} {\from{fontspec.dtx}{patches}}}
\generate{\file{fontspec-testsuite.tex}{\from{fontspec.dtx}{testsuite}}}
@@ -59,10 +61,12 @@ This work consists of this file fontspec.dtx
%<*driver>
\ProvidesFile{fontspec.dtx}
%</driver>
-%<fontspec>\ProvidesPackage{fontspec}
+%<fontspec&!xetexx&!luatex>\ProvidesPackage{fontspec}
+%<fontspec&xetexx>\ProvidesPackage{fontspec-xetex}
+%<fontspec&luatex>\ProvidesPackage{fontspec-luatex}
%<patches>\ProvidesPackage{fontspec-patches}
%<*fontspec|patches>
- [2011/02/26 v2.1f Advanced font selection for XeLaTeX/LuaLaTeX]
+ [2011/09/13 v2.2 Advanced font selection for XeLaTeX/LuaLaTeX]
%</fontspec|patches>
%
%<*driver>
@@ -140,9 +144,9 @@ This work consists of this file fontspec.dtx
% that have been generated by either \XeTeX\ or \LuaTeX. You may regenerate
% the examples by removing the \verb|doc-files/| subdirectory and typesetting the
% manual with the following invocation:
-% \begin{verbatim}
+% \begin{Verbatim}
% pdflatex -shell-escape fontspec.dtx
-% \end{verbatim}
+% \end{Verbatim}
% Note that many of the examples use fonts that are not included in \TeX~Live
% or MiKTeX, and some of them are non-free fonts that must be purchased.
%
@@ -164,8 +168,9 @@ This work consists of this file fontspec.dtx
% feedback over the years on feature requests, documentation queries, bug reports, font suggestions, and so on from lots of people all around the world.
% Many thanks to you all.
%
-% Thanks to David Perry for numerous documentation improvements and
-% contributing the text for one of the sections of this manual.
+% Thanks to David Perry and Markus Böhning for numerous documentation
+% improvements and David Perry again for contributing the text for one of the
+% sections of this manual.
%
% Special thanks to Khaled Hosny, who had been the driving force behind the support for \LuaLaTeX, ultimately leading to version 2.0 of the package.
%
@@ -457,7 +462,7 @@ This work consists of this file fontspec.dtx
% The commands defined by \cs{newfontface} and \cs{newfontfamily} include
% their encoding information, so even if the document is set to use a
% legacy \TeX\ encoding, such commands will still work correctly. For example,
-% \begin{verbatim}
+% \begin{Verbatim}
% \documentclass{article}
% \usepackage{fontspec}
% \newfontfamily\unicodefont{Lucida Grande}
@@ -466,7 +471,7 @@ This work consists of this file fontspec.dtx
% \begin{document}
% A legacy \TeX\ font. {\unicodefont A unicode font.}
% \end{document}
-% \end{verbatim}
+% \end{Verbatim}
%
% \subsection{More control over font shape selection}
% \label{sec:bfitfonts}
@@ -537,6 +542,18 @@ This work consists of this file fontspec.dtx
% ]{Minion MM Roman}
% Roman 123 \\ \textsc{Small caps 456}
% \end{Verbatim}
+% In fact, you may specify the small caps font for each individual bold and
+% italic shape as in
+% \begin{Verbatim}
+% \fontspec[
+% UprightFeatures = { SmallCapsFont={ <sc> } } ,
+% BoldFeatures = { SmallCapsFont={ <bf sc> } } ,
+% ItalicFeatures = { SmallCapsFont={ <it sc> } } ,
+% BoldItalicFeatures = { SmallCapsFont={ <bf it sc> } } ,
+% ]{ <upright> }
+% Roman 123 \\ \textsc{Small caps 456}
+% \end{Verbatim}
+%
% For most modern fonts that have small caps as a font feature, this level of
% control isn't generally necessary, but you may still occasionally find font
% families in which the small caps are in a separate font.
@@ -566,6 +583,11 @@ This work consists of this file fontspec.dtx
% \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`\}})
%
+% Note that \pkg{fontspec} will not change the font for general mathematics;
+% only the upright and bold shapes will be affected.
+% To change the font used for the mathematical symbols, see either the
+% \pkg{mathspec} package or the \pkg{unicode-math} package.
+%
% Note that you may find that loading some maths packages won't be as smooth as
% you expect since \pkg{fontspec} (and \XeTeX\ in general) breaks many of the
% assumptions of \TeX\ as to where maths characters and accents can be found.
@@ -628,7 +650,7 @@ This work consists of this file fontspec.dtx
% \section{Selecting font features}
% \label{sec:selectingfeature}
%
-% The commands discussed so far such as \cmd{fontspec} each take an optional argument for
+% The commands discussed so far such as \cs{fontspec} each take an optional argument for
% accessing the font features of the requested font.
% Commands are provided to set default features to be applied for all fonts, and even to change the features that a font is presently loaded with.
% Different font shapes can be loaded with separate features, and different features can even be selected for different sizes that the font appears in.
@@ -809,11 +831,11 @@ This work consists of this file fontspec.dtx
%
% If additional features are only required for a single size, the other sizes
% must still be specified. As in:
-% \begin{verbatim}
+% \begin{Verbatim}
% SizeFeatures={
% {Size=-10,Numbers=Uppercase},
% {Size=10-}}
-% \end{verbatim}
+% \end{Verbatim}
% Otherwise, the font sizes greater than 10 won't be defined!
%
% \begin{table}
@@ -851,7 +873,7 @@ This work consists of this file fontspec.dtx
% {\addfontfeature{Color=DDBB2299}P}\kern-0.8ex
% {\addfontfeature{Color=00BB3399}R}
% \end{Xexample}
-% Transparency is supported by \LuaLaTeX and by \XeLaTeX\ with the \texttt{xdv2pdf}
+% Transparency is supported by \LuaLaTeX\ and by \XeLaTeX\ with the \texttt{xdv2pdf}
% driver (\MacOSX\ only); \XeLaTeX\ with the \texttt{xdvipdfmx} driver
% does not support this feature.
%
@@ -867,10 +889,13 @@ This work consists of this file fontspec.dtx
% The \pkg{color} package is \emph{not} supported; use \pkg{xcolor} instead.
%
% You may specify the transparency with a named colour using the \feat{Opacity}
-% feature:
+% feature which takes an decimal from zero to one corresponding to
+% transparent to opaque respectively:
% \begin{Verbatim}
% \fontspec[Color=red,Opacity=0.7]{Verdana} ...
% \end{Verbatim}
+% It is still possible to specify a colour in six-char hexadecimal form
+% while defining opacity in this way, if you like.
%
% \subsection{Scale}
%
@@ -887,7 +912,7 @@ This work consists of this file fontspec.dtx
% measure the correct dimensions of the fonts loaded and
% calculate values to scale them automatically.
%
-% As well as a numerical argument, \feat{Scale} feature
+% As well as a numerical argument, the \feat{Scale} feature
% also accepts options \opt{MatchLowercase}
% and \opt{MatchUppercase}, which will scale the font being selected to match
% the current default roman font to either the height of the lowercase or
@@ -1004,6 +1029,7 @@ This work consists of this file fontspec.dtx
%
% OpenType fonts with optical scaling will exist in
% several discrete sizes, and these will be selected by \XeTeX\
+% and Lua\TeX\
% \emph{automatically} determined by the current font size as in
% \exref{optsize}, in which we've scaled down some large text in order to be
% able to compare the difference for equivalent font sizes.
@@ -1036,7 +1062,7 @@ This work consists of this file fontspec.dtx
% The \feat{SizeFeatures} feature (\vref*{sec:sizefeature}) can be
% used to specify exactly which optical sizes will be used for ranges
% of font size. For example, something like:
-% \begin{verbatim}
+% \begin{Verbatim}
% \fontspec[
% SizeFeatures={
% {Size=-10, OpticalSize=8 },
@@ -1044,7 +1070,7 @@ This work consists of this file fontspec.dtx
% {Size= 14-18, OpticalSize=14},
% {Size= 18-, OpticalSize=18}}
% ]{Latin Modern Roman}
-% \end{verbatim}
+% \end{Verbatim}
%
% \part{OpenType}
% \label{sec:opentype-features}
@@ -1161,7 +1187,7 @@ This work consists of this file fontspec.dtx
% not actually map letters to uppercase.
% \note{If you want automatic uppercase letters, look to \LaTeX's
% \cmd\MakeUppercase\ command.}
-% It is designed select various
+% It is designed to select various
% uppercase forms for glyphs such as accents and dashes, such as shown
% in \exref{letters-uppercase}; note the raised position of the hyphen
% to better match the surrounding letters.
@@ -1286,10 +1312,12 @@ This work consists of this file fontspec.dtx
% \end{Lexample}
%
% The \pkg{realscripts} package
-% (which is also loaded \pkg{xltxtra} for \XeTeX)
+% (which is also loaded by \pkg{xltxtra} for \XeTeX)
% redefines the \cmd\textsubscript\ and
% \cmd\textsuperscript\ commands to use the above font features automatically,
% including for use in footnote labels.
+% If this is the only feature of \pkg{xltxtra} you wish to use, consider
+% loading \pkg{realscripts} on its own instead.
%
%
% \subsection{Fractions}
@@ -1351,12 +1379,36 @@ This work consists of this file fontspec.dtx
% numerically to adjust the output of (usually) a single character for the
% particular font. These correspond to the OpenType features |cv01| to |cv99|.
%
-% I don't have a font to demonstrate this with (please suggest one if you
-% know of a free font with this feature!), but the syntax is similar to that
-% above:
-% \begin{verbatim}
-% \fontspec[CharacterVariant={1,3,5}]{...}
-% \end{verbatim}
+% For each character that can be varied, it is possible to select among
+% possible options for that particular glyph.
+% For example, in \exref{cv} a variety of glyphs for the character `v' are
+% selected, in which |5| corresponds to the character `v' for this font feature,
+% and the trailing |:|\meta{n} corresponds to which variety to choose.
+% Georg Duffner's open source Garamond revival font\footnote{\url{http://www.georgduffner.at/ebgaramond/}} is used in this example.
+% Character variants are specifically designed not to conflict with each
+% other, so you can enable them individually per character as shown in
+% \exref{cv2}. (Unlike stylistic alternates, say.)
+%
+% Note that the indexing starts from zero, which is compatible with \XeTeX\
+% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+%
+% \begin{Lexample}[firstline=2]{cv}{The \feat{CharacterVariant} feature showing off Georg Duffner's open source Garamond revival font.}
+% \huge
+% \fontspec{EB Garamond Italic} very \\
+% \fontspec[CharacterVariant=5]{EB Garamond Italic} very \\
+% \fontspec[CharacterVariant=5:0]{EB Garamond Italic} very \\
+% \fontspec[CharacterVariant=5:1]{EB Garamond Italic} very \\
+% \fontspec[CharacterVariant=5:2]{EB Garamond Italic} very \\
+% \fontspec[CharacterVariant=5:3]{EB Garamond Italic} very
+% \end{Lexample}
+%
+% \begin{Lexample}[firstline=2]{cv2}{The \feat{CharacterVariant} feature selecting multiple variants simultaneously.}
+% \huge
+% \fontspec{EB Garamond Italic} \& violet \\
+% \fontspec[CharacterVariant={4}]{EB Garamond Italic} \& violet \\
+% \fontspec[CharacterVariant={5:2}]{EB Garamond Italic} \& violet \\
+% \fontspec[CharacterVariant={4,5:2}]{EB Garamond Italic} \& violet
+% \end{Lexample}
%
% \subsection{Alternates}
%
@@ -1373,6 +1425,9 @@ This work consists of this file fontspec.dtx
% \textsc{a} \& h
% \end{Xexample}
%
+% Note that the indexing starts from zero, which is compatible with \XeTeX\
+% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+%
% See \vref{sec:newfeatures} for a way to assign names to alternates,
% which must be done on a per-font basis.
%
@@ -1509,10 +1564,10 @@ This work consists of this file fontspec.dtx
% to be slanted automatically, use the \feat{AutoFakeBold} and
% \feat{AutoFakeSlant} features. For example, the following two invocations
% are equivalent:
-% \begin{verbatim}
+% \begin{Verbatim}
% \fontspec[AutoFakeBold=1.5]{Charis SIL}
% \fontspec[BoldFeatures={FakeBold=1.5}]{Charis SIL}
-% \end{verbatim}
+% \end{Verbatim}
%
% If both of the \feat{AutoFake...} features are used, then the bold italic
% font will also be faked.
@@ -1534,6 +1589,9 @@ This work consists of this file fontspec.dtx
% \x0\x1\x2\x3\x4\x5\x6\x7\x7\x8\x9
% \end{Xexample}
%
+% Note that the indexing starts from zero, which is compatible with \XeTeX\
+% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+%
% \subsection{CJK shape}
%
% \begin{features}{CJKShape}
@@ -1628,7 +1686,7 @@ This work consists of this file fontspec.dtx
% When multilingual fonts are used, it is important to select which language
% they are being used for, and more importantly what script is being used.
%
-% The `script' refers to the alphabet in used; for example, both English
+% The `script' refers to the alphabet in use; for example, both English
% and French use the Latin script. Similarly, the Arabic script can be used
% to write in both the Arabic and Persian languages.
%
@@ -1920,9 +1978,9 @@ This work consists of this file fontspec.dtx
% \MacOSX\ are still in the \AAT\ format, such as `Skia'. Documents
% that use these fonts should be compiled with \XeLaTeX\ using the
% \texttt{xdv2pdf} driver, as opposed to the default \texttt{xdvipdfmx}. E.g.,
-% \begin{verbatim}
+% \begin{Verbatim}
% xelatex -output-driver="xdv2pdf" filename.tex
-% \end{verbatim}
+% \end{Verbatim}
%
% \MacOSX\ also supports Multiple Master fonts, which are discussed
% in \ref{sec:mm}.
@@ -1959,7 +2017,7 @@ This work consists of this file fontspec.dtx
%
% \subsection{Contextuals} \label{sec:contextuals}
% This feature refers to glyph substitution that vary by their position;
-% things like contextual swashes are implemented here
+% things like contextual swashes are implemented here.
% The options for \AAT\ fonts are
% \opt{WordInitial}, \opt{WordFinal} (\exref{wordcx}), \opt{LineInitial},
% \opt{LineFinal}, and \opt{Inner} (\exref{longsaat}, also called `non-final' sometimes). As
@@ -2189,6 +2247,8 @@ This work consists of this file fontspec.dtx
% variation along font parameters. For example, they don't have just
% regular and bold weights, they can have any bold weight you like between
% the two extremes.
+% Note these features can only be used when your document is compiled using
+% the \verb|xdv2pdf| driver for Mac~OS~X.
%
% \opt{Weight}, \opt{Width}, and \opt{OpticalSize} are supported by this
% package. Skia, which is distributed with
@@ -2333,16 +2393,16 @@ This work consists of this file fontspec.dtx
%
% In some cases, it is useful to know what the \LaTeX\ font family
% of a specific \pkg{fontspec} font is. After a \cmd\fontspec-like
-% command, this is stored inside the \cmd\zf@family\ macro.
+% command, this is stored inside the \cmd\l_fontspec_family_tl\ macro.
% Otherwise, \LaTeX's own \cmd\f@family\ macro can be useful here,
% too.
% The raw \TeX\ font that is defined is stored temporarily
-% in \cmd{\zf@basefont}.
+% in \cmd{\l_fontspec_font}.
%
% The following commands in \pkg{expl3} syntax may be used
% for writing codes that interface with fontspec-loaded fonts.
% All of the following conditionals also exist with |T| and |F|
-% suffices as well as |TF|.
+% as well as |TF| suffixes.
%
% \begin{macro}{\fontspec_if_fontspec_font:TF}
% Test whether the currently selected font has been loaded by fontspec.
@@ -2415,6 +2475,19 @@ This work consists of this file fontspec.dtx
% function.
% \end{macro}
%
+% \begin{macro}{\fontspec_set_fontface:NNnn}
+% \darg{primitive font}
+% \darg{family}
+% \darg{fontspec features}
+% \darg{font name}
+% Variant of the above in which the primitive \TeX\ font command is stored in
+% meta{primitive font}.
+% If a family is loaded (with bold and italic shapes) the primitive font
+% command will only select the regular face.
+% This feature is designed for \LaTeX\ programmers who need to
+% perform subsequent font-related tests on the \meta{primitive font}.
+% \end{macro}
+%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \part{The patching/improvement of \LaTeXe\ and other packages}
@@ -2455,26 +2528,37 @@ This work consists of this file fontspec.dtx
% makes it easy to change the hyphenation character on a per font basis, it would
% be nice if \cmd\-\ adjusted automatically --- and now it does.
%
+% \section{Commands for old-style and lining numbers}
+%
+% \DescribeMacro{\oldstylenums}
+% \DescribeMacro{\liningnums}
+% \LaTeX's definition of \cs{oldstylenums} relies on strange font encodings.
+% We provide a \pkg{fontspec}-compatible alternative and while we're at it
+% also throw in the reverse option as well. Use \cs{oldstylenums}\marg{text}
+% to explicitly use old-style (or lowercase) numbers in \meta{text}, and
+% the reverse for \cs{liningnums}\marg{text}.
+%
% \StopEventually{}
%
% \clearpage
-% \part{fontspec.sty}
+% \part{fontspec.sty and friends}
%
-% \section{Implementation}
% Herein lie the implementation details of this package. Welcome!
% It was my first.
%
-% For some reason, I decided to prefix all the package internal
-% command names and variables with |zf|. I don't know why I chose
-% those letters, but I guess I just liked the look/feel of them
-% together at the time. (Possibly inspired by Hermann \emph{Z}ap\emph{f}.)
+% \section{`Header' code}
%
-% \iffalse
-%<*fontspec>
-% \fi
+% We will eventually load the correct version of the code according to which
+% engine we're running. As we'll see later, there are some minor differences
+% between what we have to do in \XeLaTeX\ and \LuaLaTeX.
+%
+% \begin{macrocode}
+%<*fontspec&!xetexx&!luatex>
+% \end{macrocode}
+% But for now, this is the shared code.
% \begin{macrocode}
-\RequirePackage{expl3,xparse}
-\input binhex.tex % before expl syntax!
+\RequirePackage{expl3}[2011/09/05]
+\RequirePackage{xparse}
\ExplSyntaxOn
% \end{macrocode}
%
@@ -2500,28 +2584,11 @@ This work consists of this file fontspec.dtx
}
% \end{macrocode}
%
-% \begin{macro}{\xetex_or_luatex:nn}
-% Use |#1| if \XeTeX\ or |#2| if \LuaTeX.
-% \begin{macrocode}
-\xetex_if_engine:TF
- { \cs_new_eq:NN \xetex_or_luatex:nn \use_i:nn }
- { \luatex_if_engine:T
- { \cs_new_eq:NN \xetex_or_luatex:nn \use_ii:nn }
- }
-% \end{macrocode}
-% \end{macro}
%
-% \begin{macro}{\xetex_or_luatex:nnn}
-% Use |#1| and (|{#2}| if \XeTeX) or (|{#3}| if \LuaTeX).
-% \begin{macrocode}
-\xetex_if_engine:TF
- { \cs_new:Npn \xetex_or_luatex:nnn #1#2#3 {#1{#2}} }
- {
- \luatex_if_engine:T
- { \cs_new:Npn \xetex_or_luatex:nnn #1#2#3 {#1{#3}} }
- }
-% \end{macrocode}
-% \end{macro}
+% \subsection{expl3 tools}
+%
+%
+%
%
% \subsection{Bits and pieces}
% \paragraph{Conditionals}
@@ -2556,23 +2623,17 @@ This work consists of this file fontspec.dtx
\int_new:N \l_fontspec_language_int
\int_new:N \l_fontspec_strnum_int
% \end{macrocode}
-% Temporary definition until expl3 has been updated to include this:
+% \paragraph{Other variables}
% \begin{macrocode}
-\cs_set:Npn \use:x #1 { \edef\@tempa{#1}\@tempa }
-
-\cs_if_exist:NF \str_if_eq:xxTF {
- \cs_set_eq:NN \str_if_eq_p:xx \tl_if_eq_p:xx
- \cs_set_eq:NN \str_if_eq:xxTF \tl_if_eq:xxTF
- \cs_set_eq:NN \str_if_eq:xxT \tl_if_eq:xxT
- \cs_set_eq:NN \str_if_eq:xxF \tl_if_eq:xxF
- \cs_set_eq:NN \str_if_eq_p:nn \tl_if_eq_p:nn
- \cs_set_eq:NN \str_if_eq:nnTF \tl_if_eq:nnTF
- \cs_set_eq:NN \str_if_eq:nnT \tl_if_eq:nnT
- \cs_set_eq:NN \str_if_eq:nnF \tl_if_eq:nnF
-}
+\fp_new:N \l_fontspec_tmpa_fp
+\fp_new:N \l_fontspec_tmpb_fp
+\dim_new:N \l_fontspec_tmpa_dim
+\dim_new:N \l_fontspec_tmpb_dim
+\dim_new:N \l_fontspec_tmpc_dim
% \end{macrocode}
%
% \begin{macrocode}
+\tl_set:Nx \c_colon_str { \tl_to_str:N : }
\cs_set:Npn \use_v:nnnnn #1#2#3#4#5 {#5}
\cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4}
% \end{macrocode}
@@ -2582,20 +2643,10 @@ This work consists of this file fontspec.dtx
\cs_generate_variant:Nn \str_if_eq:nnTF {nv}
\cs_generate_variant:Nn \int_set:Nn {Nv}
\cs_generate_variant:Nn \tl_gset:Nn {cV}
+\cs_generate_variant:Nn \keys_set:nn {nx}
% \end{macrocode}
%
%
-% \begin{macrocode}
-\cs_new:Npn \fontspec_setkeys:xx #1#2
- {
- \use:x { \exp_not:N \setkeys*[zf]{#1}{#2} }
- }
-\cs_new:Npn \fontspec_setkeys:xxx #1#2#3
- {
- \use:x { \exp_not:N \setkeys*[zf@#1]{#2}{#3} }
- }
-% \end{macrocode}
-%
% \subsection{Error/warning/info messages}
%
% Shorthands for messages:
@@ -2638,22 +2689,14 @@ This work consists of this file fontspec.dtx
{
'\l_fontspec_fontname_tl'~ does~ not~ contain~ glyph~ #1.
}
-\msg_new:nnnn {fontspec} {unknown-options}
-{
- The~ following~ font~ options~ are~ not~ recognised:\\
- \space\space\space\space #1
-}
-{
- There~ is~ probably~ a~ typo~ in~ the~ font~ feature~ selection.
-}
\msg_new:nnnn {fontspec} {euler-too-late}
{
The~ euler~ package~ must~ be~ loaded~ BEFORE~ fontspec.
}
{
- fontspec~ only~ overwrites~ euler's~ attempt~ to\\
- define~ the~ maths~ text~ fonts~ if~ fontspec~ is\\
- loaded~ after~ euler.~ Type~ <return>~ to~ proceed\\
+ fontspec~ only~ overwrites~ euler's~ attempt~ to~
+ define~ the~ maths~ text~ fonts~ if~ fontspec~ is~
+ loaded~ after~ euler.~ Type~ <return>~ to~ proceed~
with~ incorrect~ \string\mathit,~ \string\mathbf,~ etc.
}
\msg_new:nnnn {fontspec} {no-xcolor}
@@ -2661,7 +2704,7 @@ This work consists of this file fontspec.dtx
Cannot~ load~ named~ colours~ without~ the~ xcolor~ package.
}
{
- Sorry,~ I~ can't~ do~ anything~ to~ help.~ Instead~ of~ loading\\
+ Sorry,~ I~ can't~ do~ anything~ to~ help.~ Instead~ of~ loading~
the~ color~ package,~ use~ xcolor~ instead.~ It's~ better.
}
\msg_new:nnnn {fontspec} {unknown-color-model}
@@ -2669,7 +2712,7 @@ This work consists of this file fontspec.dtx
Error~ loading~ colour~ `#1';~ unknown~ colour~ model.
}
{
- Sorry,~ I~ can't~ do~ anything~ to~ help.~ Please~ report~ this~ error\\
+ Sorry,~ I~ can't~ do~ anything~ to~ help.~ Please~ report~ this~ error~
to~ my~ developer~ with~ a~ minimal~ example~ that~ causes~ the~ problem.
}
% \end{macrocode}
@@ -2677,7 +2720,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\msg_new:nnn {fontspec} {addfontfeatures-ignored}
{
- \string\addfontfeature (s)~ ignored;\\
+ \string\addfontfeature (s)~ ignored;~
it~ cannot~ be~ used~ with~ a~ font~ that~ wasn't~ selected~ by~ fontspec.
}
\msg_new:nnn {fontspec} {feature-option-overwrite}
@@ -2695,24 +2738,24 @@ This work consists of this file fontspec.dtx
}
\msg_new:nnn {fontspec} {aat-feature-not-exist}
{
- '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\
+ '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~
for~ AAT~ font~ '\l_fontspec_fontname_tl'.
}
\msg_new:nnn {fontspec} {aat-feature-not-exist-in-font}
{
- AAT~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\
+ AAT~ feature~ '\l_keys_key_tl=\l_keys_value_tl'~ (#1)~ not~ available~
in~ font~ '\l_fontspec_fontname_tl'.
}
\msg_new:nnn {fontspec} {icu-feature-not-exist}
{
- '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\
+ '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~
for~ ICU~ font~ '\l_fontspec_fontname_tl'
}
\msg_new:nnn {fontspec} {icu-feature-not-exist-in-font}
{
- OpenType~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\
- for~ font~ '\l_fontspec_fontname_tl', \\
- with~ script~ '\l_fontspec_script_name_tl',~ and~ language~ '\l_fontspec_lang_name_tl'.
+ OpenType~ feature~ '\l_keys_key_tl=\l_keys_value_tl'~ (#1)~ not~ available~
+ for~ font~ '\l_fontspec_fontname_tl'~
+ with~ script~ '\l_fontspec_script_name_tl'~ and~ language~ '\l_fontspec_lang_name_tl'.
}
\msg_new:nnn {fontspec} {no-opticals}
{
@@ -2720,7 +2763,7 @@ This work consists of this file fontspec.dtx
}
\msg_new:nnn {fontspec} {language-not-exist}
{
- Language~ '#1'~ not~ available\\
+ Language~ '#1'~ not~ available~
for~ font~ '\l_fontspec_fontname_tl'~
with~ script~ '\l_fontspec_script_name_tl'.\\
'Default'~ language~ used~ instead.
@@ -2751,26 +2794,11 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\msg_new:nnn {fontspec} {defining-font}
{
- Defining~ font~ family~'\zf@family'~ for~ font~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1].
-}
-\msg_new:nnn {fontspec} {defining-raw}
-{
- Defining~ shape~
- '\prg_case_str:nnn {#1} {
- {\mddefault/\updefault} {normal}
- {\mddefault/\scdefault} {small~ caps}
- {\bfdefault/\updefault} {bold}
- {\bfdefault/\scdefault} {bold~ small~ caps}
- {\mddefault/\itdefault} {italic}
- {\mddefault/\sidefault} {italic~ small~ caps}
- {\bfdefault/\itdefault} {bold~ italic}
- {\bfdefault/\sidefault} {bold~ italic~ small~ caps}
- } {#1}'~
- with~ NFSS~ spec.: \\
- \l_fontspec_nfss_tl
- \tl_if_empty:NF \l_fontspec_postadjust_tl {
- \\ and~ font~ adjustment~ code: \\ \l_fontspec_postadjust_tl
- }
+ Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~
+ with~ options~ [\g_fontspec_default_fontopts_tl #1].\\
+ \\
+ This~ font~ family~ consists~ of~ the~ following~ shapes:
+ \l_fontspec_defined_shapes_tl
}
\msg_new:nnn {fontspec} {no-font-shape}
{
@@ -2831,12 +2859,6 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
%
% \subsection{Packages}
-% We require the \pkg{calc} package for autoscaling and a recent version of the
-% \pkg{xkeyval} package for option processing.
-% \begin{macrocode}
-\RequirePackage{calc}
-\RequirePackage{xkeyval}[2005/05/07]
-% \end{macrocode}
%
% New for \LuaTeX, we load a new package called `\pkg{fontspec-patches}'
% designed to incorporate the hidden but useful parts of the old \pkg{xltxtra}
@@ -2845,6 +2867,22 @@ This work consists of this file fontspec.dtx
\RequirePackage{fontspec-patches}
% \end{macrocode}
%
+% \begin{macrocode}
+\luatex_if_engine:T { \usepackage{fontspec-luatex} \endinput }
+\xetex_if_engine:T { \usepackage{fontspec-xetex} \endinput }
+% \end{macrocode}
+%
+% \begin{macrocode}
+%</fontspec&!xetexx&!luatex>
+% \end{macrocode}
+%
+% \section{The main package code}
+%
+% That was the driver, and now the fun starts.
+% \begin{macrocode}
+%<*fontspec&(xetexx|luatex)>
+\ExplSyntaxOn
+% \end{macrocode}
%
% \subsection{Encodings}
% Frank Mittelbach has recommended using the `\texttt{EU}$x$' family of font encodings
@@ -2852,20 +2890,21 @@ This work consists of this file fontspec.dtx
% Now that \XeTeX\ can find fonts in the |texmf| tree, the Latin Modern OpenType fonts
% can be used as the defaults. See the |euenc| collection of files for how this is implemented.
% \begin{macrocode}
-\xetex_or_luatex:nnn {\tl_set:Nn \zf@enc} {EU1} {EU2}
+%<xetexx>\tl_set:Nn \g_fontspec_encoding_tl {EU1}
+%<luatex>\tl_set:Nn \g_fontspec_encoding_tl {EU2}
\tl_set:Nn \rmdefault {lmr}
\tl_set:Nn \sfdefault {lmss}
\tl_set:Nn \ttdefault {lmtt}
-\RequirePackage[\zf@enc]{fontenc}
-\tl_set_eq:NN \UTFencname \zf@enc % for xunicode
+\RequirePackage[\g_fontspec_encoding_tl]{fontenc}
+\tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode
% \end{macrocode}
% Dealing with a couple of the problems introduced by \pkg{babel}:
% \begin{macrocode}
-\tl_set_eq:NN \cyrillicencoding \zf@enc
-\tl_set_eq:NN \latinencoding \zf@enc
-\g@addto@macro \document {
- \tl_set_eq:NN \cyrillicencoding \zf@enc
- \tl_set_eq:NN \latinencoding \zf@enc
+\tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
+\tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
+\tl_put_right:Nn \document {
+ \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl
+ \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
}
% \end{macrocode}
% That latin encoding definition is repeated to suppress font warnings.
@@ -2876,16 +2915,13 @@ This work consists of this file fontspec.dtx
% Now we load \pkg{xunicode}, working around its internal \XeTeX\ check
% when under \LuaTeX.
% \begin{macrocode}
-\xetex_or_luatex:nn
-{
- \RequirePackage{xunicode}
-}
-{
- \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
- \cs_set:Npn \XeTeXpicfile {}
- \RequirePackage{xunicode}
- \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
-}
+%<xetexx>\RequirePackage{xunicode}
+%<*luatex>
+\cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
+\cs_set:Npn \XeTeXpicfile {}
+\RequirePackage{xunicode}
+\cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
+%</luatex>
% \end{macrocode}
%
%
@@ -2899,14 +2935,11 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec}
% This is the main command of the package that
% selects fonts with various features. It takes two arguments: the
-% \MacOSX\ font name and the optional requested features of that
-% font. It simply runs \cs{zf@fontspec}, which takes the same
-% arguments as the top level macro and puts the new-fangled font
-% family name into the global \cmd{\zf@family}. Then this new font
-% family is selected.
+% font name and the optional requested features of that
+% font. Then this new font family is selected.
% \begin{macrocode}
\DeclareDocumentCommand \fontspec { O{} m } {
- \fontencoding {\zf@enc}
+ \fontencoding {\g_fontspec_encoding_tl}
\fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
@@ -2918,8 +2951,7 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\setsansfont}
% \begin{macro}{\setmonofont}
% The following three macros perform equivalent operations setting
-% the default font (using \cs{let} rather than \cs{renewcommand}
-% because \cs{zf@family} will change in the future) for a
+% the default font for a
% particular family: `roman', sans serif, or typewriter
% (monospaced). I end them with |\normalfont| so that if they're
% used in the document, the change registers immediately.
@@ -2994,19 +3026,19 @@ This work consists of this file fontspec.dtx
% by \name{Scott Pakin}'s \textsf{newcommand.py}). This command is used
% when a specific font instance needs to be referred to repetitively
% (\eg, in a section heading) since continuously calling
-% \cs{zf@fontspec} is inefficient because it must parse the
+% \cs{fontspec_select:nn} is inefficient because it must parse the
% option arguments every time.
%
% \cs{fontspec_select:nn} defines a font family and saves its name in
-% \cs{zf@family}. This family is then used in a typical NFSS \cmd\fontfamily\
+% \cs{l_fontspec_family_tl}. This family is then used in a typical NFSS \cmd\fontfamily\
% declaration, saved in the macro name specified.
% \begin{macrocode}
\DeclareDocumentCommand \newfontfamily { m O{} m } {
\fontspec_select:nn{#2}{#3}
\use:x {
\exp_not:N \DeclareRobustCommand \exp_not:N #1 {
- \exp_not:N \fontencoding {\zf@enc}
- \exp_not:N \fontfamily {\zf@family} \exp_not:N \selectfont
+ \exp_not:N \fontencoding {\g_fontspec_encoding_tl}
+ \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont
}
}
}
@@ -3053,7 +3085,7 @@ This work consists of this file fontspec.dtx
%
% The default options are \emph{not} applied (which is why
% \cs{g_fontspec_default_fontopts_tl} is emptied inside the group; this is allowed
-% as \cmd\zf@family\ is globally defined in \cmd\fontspec_select:nn), so this
+% as \cmd\l_fontspec_family_tl\ is globally defined in \cmd\fontspec_select:nn), so this
% means that the only added features to the font are strictly those
% specified by this command.
%
@@ -3070,7 +3102,7 @@ This work consists of this file fontspec.dtx
{\csname zf@family@fontname\f@family\endcsname}
}
\group_end:
- \fontfamily\zf@family\selectfont
+ \fontfamily\l_fontspec_family_tl\selectfont
\else
\fontspec_warning:n {addfontfeatures-ignored}
\fi
@@ -3088,12 +3120,16 @@ This work consists of this file fontspec.dtx
% tag by which to reference it, and the string that is used to
% select the font feature.
% \begin{macrocode}
-\DeclareDocumentCommand \newfontfeature {mm} {
- \define@key[zf]{options}{#1}[]{
- \fontspec_update_fontid:n {+zf-#1}
- \fontspec_update_featstr:n {#2}
+\DeclareDocumentCommand \newfontfeature {mm}
+ {
+ \keys_define:nn { fontspec }
+ {
+ #1 .code:n = {
+ \fontspec_update_fontid:n {+zf-#1}
+ \fontspec_update_featstr:n {#2}
+ }
+ }
}
-}
% \end{macrocode}
% \end{macro}
%
@@ -3104,12 +3140,10 @@ This work consists of this file fontspec.dtx
% font it's being used for.
% \begin{macrocode}
\DeclareDocumentCommand \newAATfeature {mmmm} {
- \unless\ifcsname zf@options@#1\endcsname
- \fontspec_define_font_feature:n{#1}
- \fi
- \key@ifundefined[zf]{#1}{#2}{}{
- \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2}
- }
+ \keys_if_exist:nnF { fontspec } {#1}
+ { \fontspec_define_font_feature:n {#1} }
+ \keys_if_choice_exist:nnnT {fontspec} {#1} {#2}
+ { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} }
\fontspec_define_feature_option:nnnnn{#1}{#2}{#3}{#4}{}
}
% \end{macrocode}
@@ -3122,12 +3156,10 @@ This work consists of this file fontspec.dtx
% font it's being used for.
% \begin{macrocode}
\DeclareDocumentCommand \newICUfeature {mmm} {
- \unless\ifcsname zf@options@#1\endcsname
- \fontspec_define_font_feature:n{#1}
- \fi
- \key@ifundefined[zf]{#1}{#2}{}{
- \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2}
- }
+ \keys_if_exist:nnF { fontspec / options } {#1}
+ { \fontspec_define_font_feature:n{#1} }
+ \keys_if_choice_exist:nnnT {fontspec} {#1} {#2}
+ { \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} }
\fontspec_define_feature_option:nnnnn{#1}{#2}{}{}{#3}
}
\cs_set_eq:NN \newopentypefeature \newICUfeature
@@ -3139,12 +3171,38 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\aliasfontfeature}
% \begin{macro}{\aliasfontfeatureoption}
% User commands for renaming font features and font feature options.
-% Provided I've been consistent, they should work for everything.
% \begin{macrocode}
-\DeclareDocumentCommand \aliasfontfeature {mm} {\multi@alias@key{#1}{#2}}
-\DeclareDocumentCommand \aliasfontfeatureoption {mmm} {
- \keyval@alias@key[zf@feat]{#1}{#2}{#3}
-}
+\DeclareDocumentCommand \aliasfontfeature {mm}
+ {
+ \keys_if_exist:nnTF {fontspec} {#1}
+ {
+ \keys_define:nn {fontspec}
+ { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } }
+ }
+ {
+ \keys_if_exist:nnTF {fontspec-preparse} {#1}
+ {
+ \keys_define:nn {fontspec-preparse}
+ { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } }
+ }
+ {
+ \keys_if_exist:nnTF {fontspec-preparse-external} {#1}
+ {
+ \keys_define:nn {fontspec-preparse-external}
+ {
+ #2 .code:n =
+ { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } }
+ }
+ }
+ { \fontspec_warning:nx {rename-feature-not-exist} {#1} }
+ }
+ }
+ }
+\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
+ {
+ \cs_set_eq:cc { \c_keys_code_root_tl fontspec/#1/#3 }
+ { \c_keys_code_root_tl fontspec/#1/#2 }
+ }
% \end{macrocode}
% \end{macro} \end{macro}
%
@@ -3163,9 +3221,10 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new:Npn \fontspec_new_script:nn #1#2
+\keys_define:nn { fontspec } { Script .choice: }
+\cs_new:Nn \fontspec_new_script:nn
{
- \define@key[zf@feat]{Script}{#1}[]{
+ \keys_define:nn { fontspec } { Script / #1 .code:n =
\fontspec_check_script:nTF {#2} {
\fontspec_update_fontid:n {+script=#1}
\tl_set:Nn \l_fontspec_script_tl {#2}
@@ -3173,7 +3232,7 @@ This work consists of this file fontspec.dtx
}{
\fontspec_check_script:nTF {latn} {
\fontspec_warning:nx {script-not-exist-latn} {#1}
- \setkeys[zf@feat]{Script}{Latin}
+ \keys_set:nn {fontspec} {Script=Latin}
}{
\fontspec_warning:nx {script-not-exist} {#1}
}
@@ -3198,16 +3257,17 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new:Npn \fontspec_new_lang:nn #1#2
+\keys_define:nn { fontspec } { Language .choice: }
+\cs_new:Nn \fontspec_new_lang:nn
{
- \define@key[zf@feat]{Lang}{#1}[]{
+ \keys_define:nn { fontspec } { Language / #1 .code:n =
\fontspec_check_lang:nTF {#2} {
\fontspec_update_fontid:n {+lang=#1}
\tl_set:Nn \l_fontspec_lang_tl {#2}
\int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int}
}{
\fontspec_warning:nx {language-not-exist} {#1}
- \setkeys[zf@feat]{Lang}{Default}
+ \keys_set:nn { fontspec } { Language = Default }
}
}
}
@@ -3220,7 +3280,8 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\DeclareDocumentCommand \DeclareFontsExtensions {m}
{
- \tl_set:Nx \l_fontspec_extensions_clist { \zap@space #1~\@empty }
+ \tl_set:Nn \l_fontspec_extensions_clist { #1 }
+ \tl_remove_all:Nn \l_fontspec_extensions_clist {~}
}
\DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont}
% \end{macrocode}
@@ -3261,7 +3322,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
\bool_if:NTF \l_fontspec_atsui_bool {
\fontspec_make_AAT_feature_string:nnTF {#1}{#2}
\prg_return_true: \prg_return_false:
@@ -3282,7 +3343,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false:
}{
@@ -3300,7 +3361,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl}
@@ -3325,7 +3386,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1}
@@ -3349,7 +3410,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
@@ -3371,7 +3432,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl}
@@ -3395,7 +3456,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nn \l_fontspec_script_tl {#1}
@@ -3418,7 +3479,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl}
@@ -3439,7 +3500,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} {
\fontspec_if_fontspec_font:TF {
- \fontspec_font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
+ \fontspec_font_set:Nnn \l_fontspec_font {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\bool_if:NTF \l_fontspec_icu_bool {
\str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl}
@@ -3471,19 +3532,31 @@ This work consists of this file fontspec.dtx
% Please use |\fontspec_set_family:Nnn| instead of |\fontspec_select:nn|,
% which may change in the future.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_family:Nnn #1#2#3 {
+\cs_new:Nn \fontspec_set_family:Nnn {
\fontspec_select:nn {#2}{#3}
- \tl_set_eq:NN #1 \zf@family
+ \tl_set_eq:NN #1 \l_fontspec_family_tl
}
% \end{macrocode}
% \end{macro}
%
%
+% \begin{macro}{\fontspec_set_fontface:NNnn}
+% \begin{macrocode}
+\cs_new:Nn \fontspec_set_fontface:NNnn
+ {
+ \fontspec_select:nn {#3}{#4}
+ \tl_set_eq:NN #1 \l_fontspec_font
+ \tl_set_eq:NN #2 \l_fontspec_family_tl
+ }
+% \end{macrocode}
+% \end{macro}
+%
+%
+%
% \subsection{expl3 interface for font loading}
%
% \begin{macrocode}
-\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} }
-\cs_set:Npn \fontspec_fontwrap:n #1 { "#1" }
+\cs_set:Nn \fontspec_fontwrap:n { "#1" }
% \end{macrocode}
%
% Beginnings of an `l3font', I guess:
@@ -3496,9 +3569,9 @@ This work consists of this file fontspec.dtx
\cs_set:Npn \font_gset:Nnn #1#2#3 {
\global \font #1 = #2 ~at~ #3 \scan_stop:
}
- \xetex_or_luatex:nnn {\cs_set:Npn \font_suppress_not_found_error:}
- {\suppressfontnotfounderror=1}
- {\luatexsuppressfontnotfounderror=1}
+ \cs_set:Npn \font_suppress_not_found_error:
+%<xetexx> {\suppressfontnotfounderror=1}
+%<luatex> {\luatexsuppressfontnotfounderror=1}
\prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} {
\ifx #1 \nullfont
\prg_return_true:
@@ -3550,12 +3623,13 @@ This work consists of this file fontspec.dtx
% procedure of all \cmd\fontspec-like commands. Given a
% list of font features (|#1|) for a requested font (|#2|),
% it will define an NFSS
-% family for that font and put the family name (globally) into \cs{zf@family}.
-% The \TeX\ `\cs{font}' command is (globally) stored in \cs{zf@basefont}.
+% family for that font and put the family name (globally) into \cs{l_fontspec_family_tl}.
+% The \TeX\ `\cs{font}' command is (globally) stored in \cs{l_fontspec_font}.
%
-% This macro does its processing inside a group to attempt to restrict the scope of its internal processing. This works to some degree to insulate the internal commands from having to be manually cleared.
+% This macro does its processing inside a group to attempt to restrict the scope of its internal processing.
+% This works to some degree to insulate the internal commands from having to be manually cleared.
% \begin{macrocode}
-\cs_set:Npn \fontspec_select:nn #1#2 {
+\cs_set:Nn \fontspec_select:nn {
\group_begin:
\font_suppress_not_found_error:
\fontspec_init:
@@ -3566,9 +3640,7 @@ This work consists of this file fontspec.dtx
% \cmd{\l_fontspec_fontname_up_tl} is the font specifically to be used as the upright font.
% \begin{macrocode}
\tl_set:Nx \l_fontspec_fontname_tl {#2}
- \luatex_if_engine:T {
- \tl_replace_all_in:Nnn \l_fontspec_fontname_tl {~} {}
- }
+%<luatex> \tl_remove_all:Nn \l_fontspec_fontname_tl {~}
\tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl
\tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl
% \end{macrocode}
@@ -3579,22 +3651,22 @@ This work consists of this file fontspec.dtx
%
% Then the mapping from user features to low-level features occurs.
% This is performed with \cs{fontspec_get_features:n}, in
-% which \cs{setkeys} retrieves the requested font features and
-% processes them. As \cs{setkeys} is run multiple times, some of its
+% which \cs{keys_set:nn} retrieves the requested font features and
+% processes them. As \cs{keys_set:nn} is run multiple times, some of its
% information storing only occurs once while we decide if the font family
% has been defined or not. When the later processing is occuring per-shape
% this no longer needs to happen; this is indicated by the `firsttime'
% conditional.
% \begin{macrocode}
- \fontspec_preparse_features:nn {#1}{#2}
+ \exp_args:NnV \fontspec_preparse_features:nn {#1} \l_fontspec_fontname_tl
% \end{macrocode}
% Finally save the `confirmed' font definition.
% \begin{macrocode}
- \fontspec_font_set:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt}
- \font_if_null:NT \zf@basefont { \fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} }
+ \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt}
+ \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} }
\fontspec_set_font_type:
- \fontspec_font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt}
- \zf@basefont % this is necessary for LuaLaTeX to check the scripts properly
+ \fontspec_font_gset:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt}
+ \l_fontspec_font % this is necessary for LuaLaTeX to check the scripts properly
% \end{macrocode}
% Continue:
% \begin{macrocode}
@@ -3612,9 +3684,8 @@ This work consists of this file fontspec.dtx
% bold shapes defined by this package will also be assigned to |b|.
% \begin{macrocode}
\fontspec_save_family:nT {#2} {
- \fontspec_info:nxx {defining-font} {#1} {#2}
\fontspec_save_fontinfo:nn {#1} {#2}
- \DeclareFontFamily{\zf@enc}{\zf@family}{}
+ \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{}
\fontspec_set_upright:
\fontspec_set_bold:
\fontspec_set_italic:
@@ -3622,38 +3693,34 @@ This work consists of this file fontspec.dtx
\fontspec_set_bold_italic:
\fontspec_set_bold_slanted:
}
+ \fontspec_info:nxx {defining-font} {#1} {#2}
\group_end:
}
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\zf@fontspec}
-% For backwards compatibility. Do not use this from now on!
-% \begin{macrocode}
-\cs_set_eq:NN \zf@fontspec \fontspec_select:nn
-% \end{macrocode}
-% \end{macro}
%
%
% \begin{macro}{\fontspec_preparse_features:nn}
% Perform the (multi-step) feature parsing process.
% \begin{macrocode}
-\cs_new:Npn \fontspec_preparse_features:nn #1#2 {
+\cs_new:Nn \fontspec_preparse_features:nn {
% \end{macrocode}
% Detect if external fonts are to be used, possibly automatically, and
% parse fontspec features for bold/italic fonts and their features.
% \begin{macrocode}
\fontspec_if_detect_external:nT {#2}
- { \setkeys[zf]{preparse-external}{ExternalLocation} }
- \fontspec_setkeys:xx {preparse-external} {\g_fontspec_default_fontopts_tl #1}
+ { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} }
+ \keys_set_known:nxN {fontspec-preparse-external}
+ {\g_fontspec_default_fontopts_tl #1} \l_fontspec_keys_leftover_clist
% \end{macrocode}
% When \cmd{\l_fontspec_fontname_tl} is augmented with a prefix or whatever to create
% the name of the upright font (\cmd{\l_fontspec_fontname_up_tl}), this latter is the new `general
% font name' to use.
% \begin{macrocode}
\tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl
- \fontspec_setkeys:xx {preparse} {\XKV@rm}
- \clist_set_eq:NN \l_fontspec_fontfeat_clist \XKV@rm
+ \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist}
+ \l_fontspec_fontfeat_clist
}
% \end{macrocode}
% \end{macro}
@@ -3678,7 +3745,7 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_fullname:n}
% Constructs the complete font name based on a common piece of info.
% \begin{macrocode}
-\cs_set:Npn \fontspec_fullname:n #1 {
+\cs_set:Nn \fontspec_fullname:n {
\fontspec_namewrap:n { #1 \l_fontspec_extension_tl }
\l_fontspec_renderer_tl
\l_fontspec_optical_size_tl
@@ -3704,14 +3771,15 @@ This work consists of this file fontspec.dtx
}{
\int_new:c {g_fontspec_family_#1_int}
}
- \edef\@tempa{#1~}
- \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl} {
- \expandafter\zap@space\@tempa\@empty
- ( \int_use:c {g_fontspec_family_#1_int} )
- }
+ \tl_set:Nx \l_fontspec_tmp_tl {#1}
+ \tl_remove_all:Nn \l_fontspec_tmp_tl {~}
+ \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl}
+ {
+ \l_fontspec_tmp_tl ( \int_use:c {g_fontspec_family_#1_int} )
+ }
}
- \tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl}
- \cs_if_exist:cTF {g_fontspec_ \zf@family _prop}
+ \tl_gset:Nv \l_fontspec_family_tl {g_fontspec_UID_\l_fontspec_fontid_tl}
+ \cs_if_exist:cTF {g_fontspec_ \l_fontspec_family_tl _prop}
\prg_return_false: \prg_return_true:
}
% \end{macrocode}
@@ -3722,7 +3790,7 @@ This work consists of this file fontspec.dtx
% First check if the font supports scripts, then apply defaults if
% none are explicitly requested. Similarly with the language settings.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_scriptlang: {
+\cs_new:Nn \fontspec_set_scriptlang: {
\bool_if:NT \l_fontspec_firsttime_bool {
\tl_if_empty:NTF \l_fontspec_script_name_tl {
\fontspec_check_script:nTF {latn}
@@ -3731,8 +3799,8 @@ This work consists of this file fontspec.dtx
\tl_if_empty:NT \l_fontspec_lang_name_tl {
\tl_set:Nn \l_fontspec_lang_name_tl {Default}
}
- \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
- \fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl}
+ \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl}
+ \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl}
}
{
\fontspec_info:n {no-scripts}
@@ -3742,8 +3810,8 @@ This work consists of this file fontspec.dtx
\tl_if_empty:NT \l_fontspec_lang_name_tl {
\tl_set:Nn \l_fontspec_lang_name_tl {Default}
}
- \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl}
- \fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl}
+ \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl}
+ \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl}
}
}
}
@@ -3756,30 +3824,30 @@ This work consists of this file fontspec.dtx
% \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 {
+\cs_new:Nn \fontspec_save_fontinfo:nn {
- \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} {
+ \prop_new:c {g_fontspec_ \l_fontspec_family_tl _prop}
+ \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {fontname} {#2}
+ \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _prop} {options} {\g_fontspec_default_fontopts_tl #1}
+ \prop_gput:cnx {g_fontspec_ \l_fontspec_family_tl _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
+ \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int
+ \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int
+ \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl
+ \prop_gput:cnV {g_fontspec_ \l_fontspec_family_tl _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} {
+ \tl_gset:cx {zf@family@fontname\l_fontspec_family_tl} {#2}
+ \tl_gset:cx {zf@family@options\l_fontspec_family_tl} {\g_fontspec_default_fontopts_tl #1}
+ \tl_gset:cx {zf@family@fontdef\l_fontspec_family_tl} {
\fontspec_fullname:n {\l_fontspec_fontname_tl} :
\l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist
}
- \tl_gset:cV {g_fontspec_script_num_(\zf@family)_tl} \l_fontspec_script_int
- \tl_gset:cV {g_fontspec_lang_num_(\zf@family)_tl} \l_fontspec_language_int
- \tl_gset_eq:cN {g_fontspec_script_(\zf@family)_tl} \l_fontspec_script_tl
- \tl_gset_eq:cN {g_fontspec_lang_(\zf@family)_tl} \l_fontspec_lang_tl
+ \tl_gset:cV {g_fontspec_script_num_(\l_fontspec_family_tl)_tl} \l_fontspec_script_int
+ \tl_gset:cV {g_fontspec_lang_num_(\l_fontspec_family_tl)_tl} \l_fontspec_language_int
+ \tl_gset_eq:cN {g_fontspec_script_(\l_fontspec_family_tl)_tl} \l_fontspec_script_tl
+ \tl_gset_eq:cN {g_fontspec_lang_(\l_fontspec_family_tl)_tl} \l_fontspec_lang_tl
}
% \end{macrocode}
% \end{macro}
@@ -3788,7 +3856,7 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_set_upright:}
% Sets the upright shape.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_upright: {
+\cs_new:Nn \fontspec_set_upright: {
\fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl
\mddefault \updefault \l_fontspec_fontfeat_up_clist
}
@@ -3807,7 +3875,7 @@ This work consists of this file fontspec.dtx
% there actually is one; if not, the bold NFSS series is left
% undefined) or with the font specified with the \feat{BoldFont} feature.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_bold: {
+\cs_new:Nn \fontspec_set_bold: {
\bool_if:NF \l_fontspec_nobf_bool {
\tl_if_empty:NTF \l_fontspec_fontname_bf_tl {
\fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/B}
@@ -3824,7 +3892,7 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_set_italic:}
% And italic in the same way:
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_italic: {
+\cs_new:Nn \fontspec_set_italic: {
\bool_if:NF \l_fontspec_noit_bool {
\tl_if_empty:NTF \l_fontspec_fontname_it_tl
{ \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} }
@@ -3838,12 +3906,15 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_set_slanted:}
% And slanted but only if requested:
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_slanted: {
- \tl_if_empty:NF \l_fontspec_fontname_sl_tl {
- \fontspec_make_font_shapes:nnnn
- \l_fontspec_fontname_sl_tl \mddefault \sldefault \l_fontspec_fontfeat_sl_clist
+\cs_new:Nn \fontspec_set_slanted:
+ {
+ \tl_if_empty:NF \l_fontspec_fontname_sl_tl
+ {
+ \fontspec_make_font_shapes:nnnn
+ \l_fontspec_fontname_sl_tl \mddefault \sldefault
+ \l_fontspec_fontfeat_sl_clist
+ }
}
-}
% \end{macrocode}
% \end{macro}
%
@@ -3854,8 +3925,8 @@ This work consists of this file fontspec.dtx
% occurance, presumably), the new bold font is used to define the new
% bold italic font.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_bold_italic: {
- \bool_if:nF {\l_fontspec_nobf_bool || \l_fontspec_nobf_bool} {
+\cs_new:Nn \fontspec_set_bold_italic: {
+ \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} {
\tl_if_empty:NTF \l_fontspec_fontname_bfit_tl
{
\tl_if_empty:NTF \l_fontspec_fontname_bf_tl
@@ -3884,17 +3955,19 @@ This work consists of this file fontspec.dtx
% \begin{macro}{\fontspec_set_bold_slanted:}
% And bold slanted, again, only if requested:
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_bold_slanted: {
- \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl {
- \tl_if_empty:NF \l_fontspec_fontname_sl_tl {
- \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B}
- \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist
- }
- }{
- \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl
- \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist
+\cs_new:Nn \fontspec_set_bold_slanted:
+ {
+ \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl
+ {
+ \tl_if_empty:NF \l_fontspec_fontname_sl_tl {
+ \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B}
+ \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist
+ }
+ }{
+ \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl
+ \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist
+ }
}
-}
% \end{macrocode}
% \end{macro}
%
@@ -3909,22 +3982,23 @@ This work consists of this file fontspec.dtx
% be automatic (based on the font type), or specified by the user via a font feature.
%
% This macro sets booleans
-% accordingly depending if the font in \cmd\zf@basefont\ is an \AAT\
+% accordingly depending if the font in \cmd\l_fontspec_font\ 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: }
+\cs_new:Nn \fontspec_set_font_type:
+%<*xetexx>
{
\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
+ \ifcase\XeTeXfonttype\l_fontspec_font
\bool_set_true:N \l_fontspec_tfm_bool
\or
\bool_set_true:N \l_fontspec_atsui_bool
- \ifnum\XeTeXcountvariations\zf@basefont > \c_zero
+ \ifnum\XeTeXcountvariations\l_fontspec_font > \c_zero
\bool_set_true:N \l_fontspec_mm_bool
\fi
\or
@@ -3946,9 +4020,12 @@ This work consists of this file fontspec.dtx
}
}
}
+%</xetexx>
+%<*luatex>
{
\bool_set_true:N \l_fontspec_icu_bool
}
+%</luatex>
% \end{macrocode}
% \end{macro}
%
@@ -3978,34 +4055,39 @@ This work consists of this file fontspec.dtx
% italic small caps by their own identifier. See \vref{sec:sishape}
% for the code that enables this usage.
% \begin{macrocode}
-\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn {
- \fontspec_font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt}
- \fontspec_font_set:Nnn \l_tmpb_font {\fontspec_fullname:n {#1#2}} {\f@size pt}
- \str_if_eq:xxTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font }
- { \fontspec_info:nx {no-font-shape} {#1#2} }
+\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn
{
- \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5}
+ \bool_if:NF \l_fontspec_external_bool
+ {
+ \fontspec_font_set:Nnn \l_tmpa_font
+ { \fontspec_fullname:n {#1} } {\f@size pt}
+ \fontspec_font_set:Nnn \l_tmpb_font
+ { \fontspec_fullname:n {#1#2} } {\f@size pt}
+ \str_if_eq:xxTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font }
+ { \fontspec_info:nx {no-font-shape} {#1#2} }
+ { \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5} }
+ }
}
-}
\cs_new:Nn \fontspec_make_font_shapes:nnnn {
\group_begin:
\tl_set:Nx \l_fontspec_fontname_tl {#1}
- \fontspec_font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt}
- \font_if_null:NT \zf@basefont { \fontspec_error:nx {font-not-found} {#1} }
- \fontspec_declare_shape:nnnn {}{#2}{#3}{#4}
+ \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {#1}} {\f@size pt}
+ \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} }
+ \fontspec_declare_shape:nnn {#2}{#3}{#4}
\tl_if_empty:NTF \l_fontspec_fontname_sc_tl {
\bool_if:NF \l_fontspec_nosc_bool {
\fontspec_make_smallcaps:T {
- \fontspec_declare_shape:nnnn {\l_fontspec_sc_featstr_sclist} {#2}
+ \fontspec_declare_shape:nnn {#2}
{ \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault }
- { #4 \l_fontspec_fontfeat_sc_clist }
+ { #4 , Letters=SmallCaps, \l_fontspec_fontfeat_sc_clist }
}
}
}{
+ \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_sc_tl}} {\f@size pt}
\tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl}
- \fontspec_declare_shape:nnnn {}{#2}
+ \fontspec_declare_shape:nnn {#2}
{ \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault }
- { #4 \l_fontspec_fontfeat_sc_clist }
+ { #4 , \l_fontspec_fontfeat_sc_clist }
}
\group_end:
}
@@ -4014,22 +4096,22 @@ This work consists of this file fontspec.dtx
% only works while \cmd\fontspec_select:nn\ passes single tokens to this macro\dots
% \end{macro}
%
-% \begin{macro}{\fontspec_declare_shape:nnnn}
+% \begin{macro}{\fontspec_declare_shape:nnn}
% \darg{Raw appended font features}
% \darg{Font series}
% \darg{Font shape}
% \darg{Font features}
% Wrapper for \cmd\DeclareFontShape.
% \begin{macrocode}
-\cs_new:Npn \fontspec_declare_shape:nnnn #1#2#3#4 {
+\cs_new:Nn \fontspec_declare_shape:nnn {
\clist_if_empty:NTF \l_fontspec_sizefeat_clist
{
- \fontspec_get_features:n {#4}
+ \fontspec_get_features:n {#3}
\tl_set:Nx \l_fontspec_nfss_tl {
<-> \l_fontspec_scale_tl
\fontspec_fontwrap:n {
\fontspec_fullname:n {\l_fontspec_fontname_tl} :
- \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist #1
+ \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist
}
}
}
@@ -4046,15 +4128,17 @@ This work consists of this file fontspec.dtx
\tl_clear:N \l_fontspec_size_tl
\tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl
- \fontspec_setkeys:xx {sizing} { \expandafter \use:n ##1 }
+ \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 }
+ \l_fontspec_keys_leftover_clist
+
\tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} }
- \fontspec_get_features:n{ #4 , \XKV@rm }
+ \fontspec_get_features:n{ #3 , \l_fontspec_keys_leftover_clist }
\tl_put_right:Nx \l_fontspec_nfss_tl {
<\l_fontspec_size_tl> \l_fontspec_scale_tl
\fontspec_fontwrap:n {
\fontspec_fullname:n { \l_fontspec_sizedfont_tl }
- : \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist #1
+ : \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist
}
}
@@ -4065,9 +4149,8 @@ This work consists of this file fontspec.dtx
% \cmd\l_fontspec_postadjust_tl\ is defined in various places to deal with things like the hyphenation
% character and interword spacing.
% \begin{macrocode}
- \fontspec_info:nx {defining-raw} {#2/#3}
\use:x{
- \exp_not:N\DeclareFontShape{\zf@enc}{\zf@family}{#2}{#3}
+ \exp_not:N\DeclareFontShape{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{#2}
{\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl}
}
% \end{macrocode}
@@ -4075,15 +4158,36 @@ This work consists of this file fontspec.dtx
% but I'd rather have it here than break out yet another macro.
% \begin{macrocode}
\bool_if:nT {
- \str_if_eq_p:xx {#3} {\itdefault} &&
+ \str_if_eq_p:xx {#2} {\itdefault} &&
!(\str_if_eq_p:xx {\itdefault} {\sldefault})
}
{
\use:x {
- \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault}
- {<->ssub*\zf@family/#2/\itdefault}{\l_fontspec_postadjust_tl}
+ \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#2}{\sldefault}
+ {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl}
}
}
+% \end{macrocode}
+% Lastly some informative messaging.
+% \begin{macrocode}
+ \tl_gput_right:Nx \l_fontspec_defined_shapes_tl
+ { \exp_not:n { \\ \\ }
+ *~ '\exp_not:N \prg_case_str:nnn {#1/#2} {
+ {\mddefault/\updefault} {normal}
+ {\mddefault/\scdefault} {small~ caps}
+ {\bfdefault/\updefault} {bold}
+ {\bfdefault/\scdefault} {bold~ small~ caps}
+ {\mddefault/\itdefault} {italic}
+ {\mddefault/\sidefault} {italic~ small~ caps}
+ {\bfdefault/\itdefault} {bold~ italic}
+ {\bfdefault/\sidefault} {bold~ italic~ small~ caps}
+ } {#2/#3}'~
+ with~ NFSS~ spec.: \exp_not:N \\
+ \l_fontspec_nfss_tl
+ \tl_if_empty:NF \l_fontspec_postadjust_tl {
+ \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_fontspec_postadjust_tl
+ }
+ }
}
% \end{macrocode}
% \end{macro}
@@ -4092,7 +4196,8 @@ This work consists of this file fontspec.dtx
% These are the features always applied to a font selection before other
% features.
% \begin{macrocode}
-\xetex_or_luatex:nnn { \tl_set:Nn \l_fontspec_pre_feat_sclist }
+\tl_set:Nn \l_fontspec_pre_feat_sclist
+%<*xetexx>
{
\bool_if:NT \l_fontspec_icu_bool {
\tl_if_empty:NF \l_fontspec_script_tl
@@ -4102,6 +4207,8 @@ This work consists of this file fontspec.dtx
}
}
}
+%</xetexx>
+%<*luatex>
{
mode = \l_fontspec_mode_tl ;
\tl_if_empty:NF \l_fontspec_script_tl
@@ -4110,6 +4217,7 @@ This work consists of this file fontspec.dtx
language = \l_fontspec_lang_tl ;
}
}
+%</luatex>
% \end{macrocode}
% \end{macro}
%
@@ -4120,7 +4228,7 @@ This work consists of this file fontspec.dtx
% features.
%
% 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
+% time \cs{fontspec_update_featstr:n} is called, so that the family
% name is only created once.
% \begin{macrocode}
\cs_new:Nn \fontspec_update_fontid:n {
@@ -4135,7 +4243,7 @@ This work consists of this file fontspec.dtx
% \subsubsection{Features}
%
% \begin{macro}{\fontspec_get_features:n}
-% This macro is a wrapper for |\setkeys| which expands and adds a
+% This macro is a wrapper for |\keys_set:nn| which expands and adds a
% default specification to the original passed options. It begins by
% initialising the commands used to hold font-feature specific
% strings.
@@ -4147,12 +4255,7 @@ This work consists of this file fontspec.dtx
\tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl
\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}
- \bool_if:NT \l_fontspec_firsttime_bool {
- \tl_if_empty:NF \XKV@rm {
- \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
- }
- }
+ \keys_set:nx {fontspec} {\l_fontspec_fontfeat_clist #1}
% \end{macrocode}
% Finish the colour specification.
% Do not set the colour if not explicitly spec'd else \verb|\color| (using
@@ -4191,64 +4294,57 @@ This work consists of this file fontspec.dtx
\tl_clear:N \l_fontspec_lang_name_tl
\tl_clear:N \l_fontspec_lang_tl
\clist_clear:N \l_fontspec_sizefeat_clist
-\tl_new:Nn \g_fontspec_hexcol_tl {000000}
-\tl_new:Nn \g_fontspec_opacity_tl {FF~}
+\tl_new:N \g_fontspec_hexcol_tl
+\tl_new:N \g_fontspec_opacity_tl
+\tl_set:Nn \g_fontspec_hexcol_tl {000000}
+\tl_set:Nn \g_fontspec_opacity_tl {FF~}
% \end{macrocode}
% Or once per fontspec font invocation:
% (Some of these may be redundant.
% Check whether they're assigned to globally or not.)
% \begin{macrocode}
-\newcommand*\fontspec_init:{
+\cs_set:Npn \fontspec_init: {
\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 }
+ \cs_set:Npn \fontspec_namewrap:n ##1
+%<xetexx> { ##1 }
+%<luatex> { name:##1 }
\tl_clear:N \l_fontspec_optical_size_tl
\tl_clear:N \l_fontspec_renderer_tl
- \luatex_if_engine:T {
- \tl_set:Nn \l_fontspec_mode_tl {node}
- \luatexprehyphenchar =`\- % fixme
- \luatexposthyphenchar = 0 % fixme
- \luatexpreexhyphenchar = 0 % fixme
- \luatexpostexhyphenchar= 0 % fixme
- }
+ \tl_clear:N \l_fontspec_defined_shapes_tl
+%<*luatex>
+ \tl_set:Nn \l_fontspec_mode_tl {node}
+ \luatexprehyphenchar =`\- % fixme
+ \luatexposthyphenchar = 0 % fixme
+ \luatexpreexhyphenchar = 0 % fixme
+ \luatexpostexhyphenchar= 0 % fixme
+%</luatex>
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fontspec_make_smallcaps:T}
-% \label{mac:zf@make@smallcaps}
-% This macro checks if the font contains small caps, and if so
-% creates the string for accessing them in \cmd{\l_fontspec_sc_featstr_sclist}.
+% \label{mac:makesmallcaps}
+% This macro checks if the font contains small caps.
% \begin{macrocode}
\cs_set:Nn \fontspec_make_ot_smallcaps:T {
- \tl_clear:N \l_fontspec_sc_featstr_sclist
- \fontspec_check_ot_feat:nT {+smcp} {
- \tl_set:Nx \l_fontspec_sc_featstr_sclist {+smcp;}
- #1
- }
+ \fontspec_check_ot_feat:nT {+smcp} { #1 }
}
-\xetex_or_luatex:nn
-{
- \cs_set:Nn \fontspec_make_smallcaps:T {
+%<*xetexx>
+\cs_set:Nn \fontspec_make_smallcaps:T
+ {
\bool_if:NTF \l_fontspec_icu_bool {
\fontspec_make_ot_smallcaps:T {#1}
}{
\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
- }
+ \fontspec_make_AAT_feature_string:nnT {3}{3} { #1 }
}
}
}
-}
-{
- \cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T
-}
+%</xetexx>
+%<*luatex>
+\cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T
+%</luatex>
% \end{macrocode}
% \end{macro}
%
@@ -4261,7 +4357,7 @@ This work consists of this file fontspec.dtx
% sclists without worrying about it.
% \begin{macrocode}
\cs_set_eq:NN \sclist_clear:N \tl_clear:N
-\cs_new:Npn \sclist_gput_right:Nn #1#2 {
+\cs_new:Nn \sclist_gput_right:Nn {
\tl_gput_right:Nn #1 {#2;}
}
\cs_generate_variant:Nn \sclist_gput_right:Nn {Nx}
@@ -4290,8 +4386,8 @@ This work consists of this file fontspec.dtx
% This macro is called by each feature key selected, and runs
% according to which type of font is selected.
% \begin{macrocode}
-\cs_new:Npn \fontspec_make_feature:nnn #1#2#3 {
- \xetex_or_luatex:nn
+\cs_new:Nn \fontspec_make_feature:nnn
+%<*xetexx>
{
\bool_if:NTF \l_fontspec_icu_bool {
\fontspec_make_ICU_feature:n {#3}
@@ -4301,15 +4397,17 @@ This work consists of this file fontspec.dtx
}
}
}
+%</xetexx>
+%<*luatex>
{
\fontspec_make_ICU_feature:n {#3}
}
-}
+%</luatex>
\cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx}
% \end{macrocode}
%
% \begin{macrocode}
-\cs_new:Npn \fontspec_make_AAT_feature:nn #1#2 {
+\cs_new:Nn \fontspec_make_AAT_feature:nn {
\tl_if_empty:nTF {#1}
{ \fontspec_warning:n {aat-feature-not-exist} }
{
@@ -4321,7 +4419,7 @@ This work consists of this file fontspec.dtx
{ \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} }
}
}
-\cs_new:Npn \fontspec_make_ICU_feature:n #1 {
+\cs_new:Nn \fontspec_make_ICU_feature:n {
\tl_if_empty:nTF {#1}
{ \fontspec_warning:n {icu-feature-not-exist} }
{
@@ -4333,59 +4431,52 @@ This work consists of this file fontspec.dtx
{ \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} }
}
}
+\cs_new_protected:Nn \fontspec_make_numbered_feature:nn
+ {
+ \fontspec_check_ot_feat:nTF {#1}
+ {
+ \fontspec_update_fontid:n {#1=#2}
+%<xetexx> \fontspec_update_featstr:n { #1 = #2 }
+%<luatex> \fontspec_update_featstr:n { #1 = \int_eval:n {#2+1} }
+ }
+ { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} }
+ }
+\cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\fontspec_define_font_feature:n}
% \begin{macro}{\fontspec_define_feature_option:nnnnn}
+% \begin{macro}{\fontspec_define_numbered_feat:nnnn}
% These macros are used in order to simplify font feature definition later on.
% \begin{macrocode}
\cs_new:Nn \fontspec_define_font_feature:n {
- \define@key[zf]{options}{#1}{{\setkeys[zf@feat]{#1}{##1}}}
+ \keys_define:nn {fontspec} { #1 .multichoice: }
}
\cs_new:Nn \fontspec_define_feature_option:nnnnn {
- \define@key[zf@feat]{#1}{#2}[]{\fontspec_make_feature:nnn{#3}{#4}{#5}}
-}
-% \end{macrocode}
-% \end{macro}
-% \end{macro}
-%
-% \begin{macro}{\keyval@alias@key}
-% This macro maps one \pkg{xkeyval} key to another.
-% \begin{macrocode}
-\newcommand*\keyval@alias@key[4][KV]{
- \cs_set_eq:cc{#1@#2@#4}{#1@#2@#3}
- \cs_set_eq:cc{#1@#2@#4@default}{#1@#2@#3@default}
+ \keys_define:nn {fontspec} {
+ #1/#2 .code:n = { \fontspec_make_feature:nnn{#3}{#4}{#5} }
+ }
}
-% \end{macrocode}
-% \end{macro}
-%
-% \begin{macro}{\multi@alias@key}
-% This macro iterates through families to map one key to another,
-% regardless of which family it's contained within.
-% \begin{macrocode}
-\newcommand*\multi@alias@key[2]{
- \key@ifundefined[zf]{options}{#1}
- {
- \key@ifundefined[zf]{preparse}{#1}
+\cs_new:Nn \fontspec_define_numbered_feat:nnnn
+ {
+ \keys_define:nn {fontspec}
{
- \key@ifundefined[zf]{preparse-external}{#1}
- { \fontspec_warning:nx {rename-feature-not-exist} {#1} }
- { \keyval@alias@key[zf]{preparse-external}{#1}{#2} }
+ #1/#2 .code:n =
+ { \fontspec_make_numbered_feature:nn {#3}{#4} }
}
- { \keyval@alias@key[zf]{preparse}{#1}{#2} }
- }
- { \keyval@alias@key[zf]{options}{#1}{#2} }
-}
+ }
% \end{macrocode}
% \end{macro}
+% \end{macro}
+% \end{macro}
%
% \begin{macro}{\fontspec_make_AAT_feature_string:nnTF}
% This macro takes the numerical codes for a font feature and
% creates a specified macro containing the string required in the
% font definition to turn that feature on or off. Used primarily in
% [...], but also used to check if small caps
-% exists in the requested font (see page~\pageref{mac:zf@make@smallcaps}).
+% exists in the requested font (see page~\pageref{mac:makesmallcaps}).
%
% For exclusive selectors, it's easy; just grab the string:
% For \emph{non}-exclusive selectors, it's a little more complex.
@@ -4399,20 +4490,20 @@ This work consists of this file fontspec.dtx
% Finally, save out the complete feature string in \cmd\l_fontspec_feature_string_tl.
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_make_AAT_feature_string:nn {TF,T,F} {
- \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \zf@basefont #1 }
+ \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \l_fontspec_font #1 }
\tl_if_empty:NTF \l_tmpa_tl
{ \prg_return_false: }
{
- \int_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 }
+ \int_compare:nTF { \XeTeXisexclusivefeature\l_fontspec_font #1 > 0 }
{
- \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2}
+ \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2}
}{
\int_if_even:nTF {#2}
{
- \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2}
+ \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\l_fontspec_font #1\space #2}
}{
\tl_set:Nx \l_tmpb_tl {
- \XeTeXselectorname\zf@basefont #1\space \numexpr#2-1\relax
+ \XeTeXselectorname\l_fontspec_font #1\space \numexpr#2-1\relax
}
\tl_if_empty:NF \l_tmpb_tl { \tl_put_left:Nn \l_tmpb_tl {!} }
}
@@ -4446,14 +4537,14 @@ This work consists of this file fontspec.dtx
% simply strips off the first char of the input before calling the normal \cmd\fontspec_iv_str_to_num:n.
% \begin{macrocode}
\cs_set:Npn \fontspec_iv_str_to_num:Nn #1#2 {
- \fontspec_iv_str_to_num:w #1 \q_nil #2 \@empty \@empty \q_nil
+ \fontspec_iv_str_to_num:w #1 \q_nil #2 \c_empty_tl \c_empty_tl \q_nil
}
\cs_set:Npn \fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil {
\int_set:Nn #1 {
`#2 * "1000000
+ `#3 * "10000
- + \ifx \@empty #4 32 \else `#4 \fi * "100
- + \ifx \@empty #5 32 \else `#5 \fi
+ + \ifx \c_empty_tl #4 32 \else `#4 \fi * "100
+ + \ifx \c_empty_tl #5 32 \else `#5 \fi
}
}
\cs_generate_variant:Nn \fontspec_iv_str_to_num:Nn {No}
@@ -4476,15 +4567,16 @@ This work consists of this file fontspec.dtx
% font. The output boolean is \cmd\@tempswatrue. \cmd\l_fontspec_strnum_int\ is used to store
% the number corresponding to the script tag string.
% \begin{macrocode}
-\xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_script:n {TF}}
+\prg_new_conditional:Nnn \fontspec_check_script:n {TF}
+%<*xetexx>
{
\fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1}
- \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts\zf@basefont }
+ \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts\l_fontspec_font }
\int_zero:N \l_tmpa_int
\@tempswafalse
\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
+ \ifnum \XeTeXOTscripttag\l_fontspec_font \l_tmpa_int = \l_fontspec_strnum_int
\@tempswatrue
\int_set:Nn \l_tmpa_int {\l_tmpb_int}
\else
@@ -4493,10 +4585,13 @@ This work consists of this file fontspec.dtx
}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</xetexx>
+%<*luatex>
{
- \directlua{fontspec.check_ot_script("zf@basefont", "#1")}
+ \directlua{fontspec.check_ot_script("l_fontspec_font", "#1")}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</luatex>
% \end{macrocode}
% \end{macro}
%
@@ -4507,17 +4602,18 @@ This work consists of this file fontspec.dtx
% The script used is whatever's held in \cmd\l_fontspec_script_int. By default, that's the
% number corresponding to `|latn|'.
% \begin{macrocode}
-\xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_lang:n {TF}}
+\prg_new_conditional:Nnn \fontspec_check_lang:n {TF}
+%<*xetexx>
{
\fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1}
\int_set:Nn \l_tmpb_int {
- \XeTeXOTcountlanguages \zf@basefont \l_fontspec_script_int
+ \XeTeXOTcountlanguages \l_fontspec_font \l_fontspec_script_int
}
\int_zero:N \l_tmpa_int
\@tempswafalse
\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
+ \ifnum\XeTeXOTlanguagetag\l_fontspec_font\l_fontspec_script_int \l_tmpa_int =\l_fontspec_strnum_int
\@tempswatrue
\int_set:Nn \l_tmpa_int {\l_tmpb_int}
\else
@@ -4526,12 +4622,15 @@ This work consists of this file fontspec.dtx
}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</xetexx>
+%<*luatex>
{
\directlua{
- fontspec.check_ot_lang( "zf@basefont", "#1", "\l_fontspec_script_tl" )
+ fontspec.check_ot_lang( "l_fontspec_font", "#1", "\l_fontspec_script_tl" )
}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</luatex>
% \end{macrocode}
% \end{macro}
%
@@ -4545,11 +4644,11 @@ This work consists of this file fontspec.dtx
% number corresponding to `|latn|'. The language used is \cmd\l_fontspec_language_int,
% by default |0|, the `default language'.
% \begin{macrocode}
-\xetex_or_luatex:nnn
- { \prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} }
+\prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T}
+%<*xetexx>
{
\int_set:Nn \l_tmpb_int {
- \XeTeXOTcountfeatures \zf@basefont
+ \XeTeXOTcountfeatures \l_fontspec_font
\l_fontspec_script_int
\l_fontspec_language_int
}
@@ -4558,7 +4657,7 @@ This work consists of this file fontspec.dtx
\@tempswafalse
\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
+ \ifnum\XeTeXOTfeaturetag\l_fontspec_font\l_fontspec_script_int\l_fontspec_language_int
\l_tmpa_int =\l_fontspec_strnum_int
\@tempswatrue
\int_set:Nn \l_tmpa_int {\l_tmpb_int}
@@ -4568,15 +4667,18 @@ This work consists of this file fontspec.dtx
}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</xetexx>
+%<*luatex>
{
\directlua{
fontspec.check_ot_feat(
- "zf@basefont", "#1",
+ "l_fontspec_font", "#1",
"\l_fontspec_lang_tl", "\l_fontspec_script_tl"
)
}
\if@tempswa \prg_return_true: \else: \prg_return_false: \fi:
}
+%</luatex>
% \end{macrocode}
% \end{macro}
% \end{macro}
@@ -4586,10 +4688,14 @@ This work consists of this file fontspec.dtx
% This is the tedious section where we correlate all possible
% (eventually) font feature requests with their \XeTeX\ representations.
%
+% \begin{macrocode}
+\cs_generate_variant:Nn \keys_set:nn {nx}
+\cs_generate_variant:Nn \keys_set_known:nnN {nx}
+% \end{macrocode}
+%
% \subsubsection{Pre-parsing naming information}
%
-% These features are extracted from the font feature list before all others, using
-% \pkg{xkeyval}'s \cmd\setkeys|*|.
+% These features are extracted from the font feature list before all others.
%
% \paragraph{\feat{ExternalLocation}}
% For fonts that aren't installed in the system. If no argument is given, the font is located
@@ -4597,14 +4703,18 @@ This work consists of this file fontspec.dtx
% argument given defines the file path of the font.
% \begin{macrocode}
\bool_new:N \l_fontspec_external_bool
-\define@key[zf]{preparse-external}{ExternalLocation}[]{
+\keys_define:nn {fontspec-preparse-external} {
+ ExternalLocation .code:n = {
\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 ] }
- { file: #1 ##1 }
- \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
+ \cs_gset:Npn \fontspec_namewrap:n ##1
+%<xetexx> { [ #1 ##1 ] }
+%<luatex> { file: #1 ##1 }
+%<*xetexx>
+ \keys_set:nn {fontspec-preparse} {Renderer=ICU}
+%</xetexx>
+ }
}
\aliasfontfeature{ExternalLocation}{Path}
% \end{macrocode}
@@ -4613,12 +4723,14 @@ This work consists of this file fontspec.dtx
% For fonts that aren't installed in the system. Specifies the font extension
% to use.
% \begin{macrocode}
-\define@key[zf]{preparse-external}{Extension}{
+\keys_define:nn {fontspec-preparse-external} {
+ Extension .code:n = {
\tl_set:Nn \l_fontspec_extension_tl {#1}
\bool_if:NF \l_fontspec_external_bool {
- \setkeys*[zf]{preparse-external}{ExternalLocation}
+ \keys_set:nn {fontspec-preparse-external} {ExternalLocation}
}
}
+}
\tl_clear:N \l_fontspec_extension_tl
% \end{macrocode}
%
@@ -4631,22 +4743,29 @@ This work consists of this file fontspec.dtx
% \paragraph{\feat{Renderer}}
% This feature must be processed before all others (the other font shape and features options are also pre-parsed for convenience) because the renderer determines the format of the features and even whether certain features are available.
% \begin{macrocode}
-\define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num]
- {AAT,ICU,Graphite,Full,Basic}{
- \fontspec_update_fontid:n {+rend:#1}
- \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}
- }
- {
+\keys_define:nn {fontspec-preparse} {
+ Renderer .choice_code:n = {
+ \fontspec_update_fontid:n {+rend:\l_keys_choice_tl}
+ \int_compare:nTF {\l_keys_choice_int < 3} {
+%<*xetexx>
+ \tl_set:Nv \l_fontspec_renderer_tl
+ { g_fontspec_renderer_tag_ \l_keys_choice_tl }
+%</xetexx>
+%<*luatex>
\fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/ICU/Graphite}
+%</luatex>
+ }{
+%<*xetexx>
+ \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic}
+%</xetexx>
+%<*luatex>
+ \tl_set:Nv \l_fontspec_mode_tl
+ { g_fontspec_mode_tag_ \l_keys_choice_tl }
+%</luatex>
}
- }{
- \xetex_or_luatex:nn
- { \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} }
- { \tl_set:Nv \l_fontspec_mode_tl {g_fontspec_mode_tag_\l_tmpa_tl} }
}
+ ,
+ Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic}
}
\tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT}
\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU}
@@ -4658,18 +4777,20 @@ This work consists of this file fontspec.dtx
% \paragraph{OpenType script/language}
% See later for the resolutions from \pkg{fontspec} features to OpenType definitions.
% \begin{macrocode}
-\define@key[zf]{preparse}{Script}{
- \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
+\keys_define:nn {fontspec-preparse} { Script .code:n = {
+%<xetexx> \keys_set:nn {fontspec-preparse} {Renderer=ICU}
\tl_set:Nn \l_fontspec_script_name_tl {#1}
\fontspec_update_fontid:n {+script:#1}
+ }
}
% \end{macrocode}
% Exactly the same:
% \begin{macrocode}
-\define@key[zf]{preparse}{Language}{
- \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} }
+\keys_define:nn {fontspec-preparse} { Language .code:n = {
+%<xetexx> \keys_set:nn {fontspec-preparse} {Renderer=ICU}
\tl_set:Nn \l_fontspec_lang_name_tl {#1}
\fontspec_update_fontid:n {+language:#1}
+ }
}
% \end{macrocode}
%
@@ -4682,14 +4803,15 @@ This work consists of this file fontspec.dtx
% \paragraph{Fonts}
% Upright:
% \begin{macrocode}
-\define@key[zf]{preparse-external}{UprightFont}{
+\keys_define:nn {fontspec-preparse-external} { UprightFont .code:n = {
\fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1}
\fontspec_update_fontid:n {up:#1}
+ }
}
% \end{macrocode}
% Bold:
% \begin{macrocode}
-\define@key[zf]{preparse-external}{BoldFont}{
+\keys_define:nn {fontspec-preparse-external} { BoldFont .code:n = {
\tl_if_empty:nTF {#1}
{
\bool_set_true:N \l_fontspec_nobf_bool
@@ -4700,11 +4822,12 @@ This work consists of this file fontspec.dtx
\fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1}
\fontspec_update_fontid:n {bf:#1}
}
+ }
}
% \end{macrocode}
% Same for italic:
% \begin{macrocode}
-\define@key[zf]{preparse-external}{ItalicFont}{
+\keys_define:nn {fontspec-preparse-external} { ItalicFont .code:n = {
\tl_if_empty:nTF {#1}
{
\bool_set_true:N \l_fontspec_noit_bool
@@ -4714,26 +4837,33 @@ This work consists of this file fontspec.dtx
\fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1}
\fontspec_update_fontid:n {it:#1}
}
+ }
}
% \end{macrocode}
% Simpler for bold+italic \& slanted:
% \begin{macrocode}
-\define@key[zf]{preparse-external}{BoldItalicFont}{
+\keys_define:nn {fontspec-preparse-external} { BoldItalicFont .code:n = {
\fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1}
\fontspec_update_fontid:n {bfit:#1}
+ }
}
-\define@key[zf]{preparse-external}{SlantedFont}{
- \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1}
- \fontspec_update_fontid:n {sl:#1}
-}
-\define@key[zf]{preparse-external}{BoldSlantedFont}{
+\keys_define:nn {fontspec-preparse-external}
+ {
+ SlantedFont .code:n =
+ {
+ \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1}
+ \fontspec_update_fontid:n {sl:#1}
+ }
+ }
+\keys_define:nn {fontspec-preparse-external} { BoldSlantedFont .code:n = {
\fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1}
\fontspec_update_fontid:n {bfsl:#1}
+ }
}
% \end{macrocode}
% Small caps isn't pre-parsed because it can vary with others above:
% \begin{macrocode}
-\define@key[zf]{options}{SmallCapsFont}{
+\keys_define:nn {fontspec} { SmallCapsFont .code:n = {
\tl_if_empty:nTF {#1}
{
\bool_set_true:N \l_fontspec_nosc_bool
@@ -4741,7 +4871,8 @@ This work consists of this file fontspec.dtx
}{
\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}
+ \fontspec_update_fontid:n {sc:#1}
+ }
}
}
% \end{macrocode}
@@ -4753,66 +4884,82 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\cs_set:Npn \fontspec_complete_fontname:Nn #1#2 {
\tl_set:Nn #1 {#2}
- \tl_replace_all_in:Nnx #1 {*} {\l_fontspec_fontname_tl}
- \luatex_if_engine:T {
- \tl_replace_all_in:Nnn #1 {~} {}
- }
+ \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl}
+%<luatex> \tl_remove_all:Nn #1 {~}
}
-\cs_generate_variant:Nn \tl_replace_all_in:Nnn {Nnx}
+\cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx}
% \end{macrocode}
% \end{macro}
%
% \paragraph{Features}
% \begin{macrocode}
-\define@key[zf]{preparse}{UprightFeatures}{
+\keys_define:nn {fontspec-preparse} { UprightFeatures .code:n = {
\def\l_fontspec_fontfeat_up_clist{, #1}
\fontspec_update_fontid:n {rmfeat:#1}
+ }
}
-\define@key[zf]{preparse}{BoldFeatures}{
+\keys_define:nn {fontspec-preparse} { BoldFeatures .code:n = {
\def\l_fontspec_fontfeat_bf_clist{, #1}
\fontspec_update_fontid:n {bffeat:#1}
+ }
}
-\define@key[zf]{preparse}{ItalicFeatures}{
+\keys_define:nn {fontspec-preparse} { ItalicFeatures .code:n = {
\def\l_fontspec_fontfeat_it_clist{, #1}
\fontspec_update_fontid:n {itfeat:#1}
+ }
}
-\define@key[zf]{preparse}{BoldItalicFeatures}{
+\keys_define:nn {fontspec-preparse} { BoldItalicFeatures .code:n = {
\def\l_fontspec_fontfeat_bfit_clist{, #1}
\fontspec_update_fontid:n {bfitfeat:#1}
+ }
}
-\define@key[zf]{preparse}{SlantedFeatures}{
+\keys_define:nn {fontspec-preparse} { SlantedFeatures .code:n = {
\def\l_fontspec_fontfeat_sl_clist{, #1}
\fontspec_update_fontid:n {slfeat:#1}
+ }
}
-\define@key[zf]{preparse}{BoldSlantedFeatures}{
+\keys_define:nn {fontspec-preparse} { BoldSlantedFeatures .code:n = {
\def\l_fontspec_fontfeat_bfsl_clist{, #1}
\fontspec_update_fontid:n {bfslfeat:#1}
+ }
}
% \end{macrocode}
% 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}{
+\keys_define:nn {fontspec} { SmallCapsFeatures .code:n = {
\bool_if:NF \l_fontspec_firsttime_bool {
\def\l_fontspec_fontfeat_sc_clist{, #1}
}
- \fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty}
+ \fontspec_update_fontid:n {scfeat:#1}
+ }
}
% \end{macrocode}
%
% paragraph{Features varying by size}
% TODO: sizezfeatures and italicfont (etc) don't play nice
% \begin{macrocode}
-\define@key[zf]{preparse}{SizeFeatures}{
+\keys_define:nn {fontspec-preparse} { SizeFeatures .code:n = {
\tl_set:Nn \l_fontspec_sizefeat_clist {#1}
- \fontspec_update_fontid:n {sizefeat:\zap@space #1~\@empty}
+ \fontspec_update_fontid:n {sizefeat:#1}
+ }
}
% \end{macrocode}
%
% \begin{macrocode}
-\define@key[zf]{sizing}{Size}{ \tl_set:Nn \l_fontspec_size_tl {#1} }
-\define@key[zf]{sizing}{Font}{
- \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1}
-}
+\keys_define:nn {fontspec-sizing}
+ {
+ Size .code:n =
+ {
+ \tl_set:Nn \l_fontspec_size_tl {#1}
+ }
+ }
+\keys_define:nn {fontspec-sizing}
+ {
+ Font .code:n =
+ {
+ \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1}
+ }
+ }
% \end{macrocode}
%
% \subsubsection{Font-independent features}
@@ -4824,7 +4971,7 @@ This work consists of this file fontspec.dtx
% it's gotta be numerical. \cs{fontspec_calc_scale:n} does all the work in
% the auto-scaling cases.
% \begin{macrocode}
-\define@key[zf]{options}{Scale}{
+\keys_define:nn {fontspec} { Scale .code:n = {
\prg_case_str:nnn {#1}
{
{MatchLowercase} { \fontspec_calc_scale:n {5} }
@@ -4833,6 +4980,7 @@ This work consists of this file fontspec.dtx
{ \tl_set:Nx \l_fontspec_scale_tl {#1} }
\fontspec_update_fontid:n {+scale:\l_fontspec_scale_tl}
\tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] }
+ }
}
% \end{macrocode}
%
@@ -4847,13 +4995,15 @@ This work consists of this file fontspec.dtx
% but allows alternate italic shapes from a separate font, say, to
% be loaded and to be auto-scaled correctly. Even if this would be ugly.
% \begin{macrocode}
-\cs_new:Npn \fontspec_calc_scale:n #1 {
+\cs_new:Nn \fontspec_calc_scale:n {
\group_begin:
\rmfamily
- \fontspec_set_font_dimen:NnN \@tempdima {#1} \font
- \fontspec_set_font_dimen:NnN \@tempdimb {#1} \zf@basefont
- \dim_set:Nn \@tempdimc { 1pt*\@tempdima/\@tempdimb }
- \tl_gset:Nx \l_fontspec_scale_tl {\strip@pt\@tempdimc}
+ \fontspec_set_font_dimen:NnN \l_fontspec_tmpa_dim {#1} \font
+ \fontspec_set_font_dimen:NnN \l_fontspec_tmpb_dim {#1} \l_fontspec_font
+ \fp_set_from_dim:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpa_dim }
+ \fp_set_from_dim:Nn \l_fontspec_tmpb_fp { \l_fontspec_tmpb_dim }
+ \fp_div:Nn \l_fontspec_tmpa_fp { \l_fontspec_tmpb_fp }
+ \tl_gset:Nx \l_fontspec_scale_tl { \fp_use:N \l_fontspec_tmpa_fp }
\fontspec_info:n {set-scale}
\group_end:
}
@@ -4868,7 +5018,7 @@ This work consists of this file fontspec.dtx
% for a \texttt{.tfm} font), then we cheat and measure the height of a glyph.
% We assume in this case that the font contains either an `X' or an `x'.
% \begin{macrocode}
-\cs_new:Npn \fontspec_set_font_dimen:NnN #1#2#3
+\cs_new:Nn \fontspec_set_font_dimen:NnN
{
\dim_set:Nn #1 { \fontdimen #2 #3 }
\dim_compare:nNnT #1 = {0pt} {
@@ -4889,15 +5039,16 @@ This work consists of this file fontspec.dtx
% These options set the relevant \cmd\fontdimen s for the
% font being loaded.
% \begin{macrocode}
-\define@key[zf]{options}{WordSpace}{
+\keys_define:nn {fontspec} { WordSpace .code:n = {
\fontspec_update_fontid:n {+wordspace:#1}
\bool_if:NF \l_fontspec_firsttime_bool {
\_fontspec_parse_wordspace:w #1,,,\q_stop
}
+ }
}
% \end{macrocode}
%
-% \begin{macro}{\zf@wordspace@parse}
+% \begin{macro}{\_fontspec_parse_wordspace:w}
% This macro determines if the input to \feat{WordSpace} is
% of the form |{X}| or |{X,Y,Z}| and executes the font scaling.
% If the former input, it executes |{X,X,X}|.
@@ -4905,18 +5056,17 @@ This work consists of this file fontspec.dtx
\cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop {
\tl_if_empty:nTF {#4}
{
- \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont}
- \dim_set:Nn \@tempdimb {\@tempdima}
- \dim_set:Nn \@tempdimc {\@tempdima}
+ \tl_put_right:Nn \l_fontspec_postadjust_tl {
+ \fontdimen 2 \font = #1 \fontdimen 2 \font
+ \fontdimen 3 \font = #1 \fontdimen 3 \font
+ \fontdimen 4 \font = #1 \fontdimen 4 \font
+ }
}{
- \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont}
- \dim_set:Nn \@tempdimb {#2\fontdimen3\zf@basefont}
- \dim_set:Nn \@tempdimc {#3\fontdimen4\zf@basefont}
- }
- \tl_put_right:Nx \l_fontspec_postadjust_tl {
- \fontdimen2\font\the\@tempdima
- \fontdimen3\font\the\@tempdimb
- \fontdimen4\font\the\@tempdimc
+ \tl_put_right:Nn \l_fontspec_postadjust_tl {
+ \fontdimen 2 \font = #1 \fontdimen 2 \font
+ \fontdimen 3 \font = #2 \fontdimen 3 \font
+ \fontdimen 4 \font = #3 \fontdimen 4 \font
+ }
}
}
% \end{macrocode}
@@ -4925,27 +5075,33 @@ This work consists of this file fontspec.dtx
% \paragraph{Punctuation space}
% Scaling factor for the nominal \cmd\fontdimen \#7.
% \begin{macrocode}
-\define@key[zf]{options}{PunctuationSpace}{
- \fontspec_update_fontid:n {+punctspace:#1}
- \setlength\@tempdima{#1\fontdimen7\zf@basefont}
- \tl_put_right:Nx \l_fontspec_postadjust_tl {\fontdimen7\font\the\@tempdima}
-}
+\keys_define:nn {fontspec}
+ {
+ PunctuationSpace .code:n =
+ {
+ \fontspec_update_fontid:n {+punctspace:#1}
+ \tl_put_right:Nx \l_fontspec_postadjust_tl
+ { \fontdimen 7 \font = #1 \fontdimen 7 \font }
+ }
+ }
% \end{macrocode}
%
% \paragraph{Secret hook into the font-adjustment code}
%
% \begin{macrocode}
-\define@key[zf]{options}{FontAdjustment}{
+\keys_define:nn {fontspec} { FontAdjustment .code:n = {
\fontspec_update_fontid:n {+fontadjust:\detokenize{#1}}
\tl_put_right:Nx \l_fontspec_postadjust_tl {#1}
+ }
}
% \end{macrocode}
%
% \paragraph{Letterspacing}
% \begin{macrocode}
-\define@key[zf]{options}{LetterSpace}{
+\keys_define:nn {fontspec} { LetterSpace .code:n = {
\fontspec_update_fontid:n {+tracking:#1}
\fontspec_update_featstr:n{letterspace=#1}
+ }
}
% \end{macrocode}
%
@@ -4955,43 +5111,50 @@ This work consists of this file fontspec.dtx
% and it's one character, then it's the second; otherwise, it's
% the third.
% \begin{macrocode}
-\define@key[zf]{options}{HyphenChar}{
+\keys_define:nn {fontspec} { HyphenChar .code:n = {
\fontspec_update_fontid:n {+hyphenchar:#1}
\str_if_eq:nnTF {#1} {None}
{
- \tl_put_right:Nn \l_fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one }
+ \tl_put_right:Nn \l_fontspec_postadjust_tl
+ { \hyphenchar \font = \c_minus_one }
}
{
\tl_if_single:nTF {#1}
{ \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} }
{ \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} }
- \font_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl}
+ \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl}
{
- \xetex_or_luatex:nnn { \tl_put_right:Nn \l_fontspec_postadjust_tl }
+ \tl_put_right:Nn \l_fontspec_postadjust_tl
+%<*xetexx>
{ \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: }
+%</xetexx>
+%<*luatex>
{
\hyphenchar \font = \c_zero
\luatexprehyphenchar = \l_fontspec_hyphenchar_tl \scan_stop:
}
+%</luatex>
}
{ \fontspec_error:nx {no-glyph}{#1} }
}
+ }
}
% \end{macrocode}
%
% \paragraph{Color}
+% Hooks into pkg{xcolor}, which names its colours \texttt{\char`\\color@<name>}.
% \begin{macrocode}
-\define@key[zf]{options}{Color}{
+\keys_define:nn {fontspec} { Color .code:n = {
\fontspec_update_fontid:n {+col:#1}
- \cs_if_exist:cTF {\token_to_str:N\color@#1}
+ \cs_if_exist:cTF { \token_to_str:N \color@ #1 }
{
\convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
}
{
- \int_compare:nTF { \tl_elt_count:n {#1} == 6 }
+ \int_compare:nTF { \tl_length:n {#1} == 6 }
{ \tl_set:Nn \l_fontspec_hexcol_tl {#1} }
{
- \int_compare:nTF { \tl_elt_count:n {#1} == 8 }
+ \int_compare:nTF { \tl_length:n {#1} == 8 }
{ \fontspec_parse_colour:viii #1 }
{
\bool_if:NF \l_fontspec_firsttime_bool {
@@ -5000,6 +5163,7 @@ This work consists of this file fontspec.dtx
}
}
}
+ }
}
\cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 {
\tl_set:Nn \l_fontspec_hexcol_tl {#1#2#3#4#5#6}
@@ -5011,11 +5175,11 @@ This work consists of this file fontspec.dtx
}
\tl_set:Nn \l_fontspec_opacity_tl {#7#8}
}
-\keyval@alias@key[zf]{options}{Color}{Colour}
+\aliasfontfeature{Color}{Colour}
% \end{macrocode}
% \begin{macrocode}
\newcounter{fontspec_tmp_int}
-\define@key[zf]{options}{Opacity}{
+\keys_define:nn {fontspec} { Opacity .code:n = {
\fontspec_update_fontid:n {+opac:#1}
\setcounter {fontspec_tmp_int} { 255*\real{#1} }
\tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
@@ -5025,34 +5189,47 @@ This work consists of this file fontspec.dtx
}
}
\tl_set:Nx \l_fontspec_opacity_tl
- { \nhex2 { \value{fontspec_tmp_int} } }
+ {
+ \int_compare:nT { \value{fontspec_tmp_int} <= "F } {0} % zero pad
+ \int_to_hexadecimal:n { \value{fontspec_tmp_int} }
+ }
+ }
}
% \end{macrocode}
%
%
% \paragraph{Mapping}
% \begin{macrocode}
-\xetex_or_luatex:nnn {
- \define@key[zf]{options}{Mapping}
-}{
+\keys_define:nn {fontspec}
+%<*xetexx>
+{
+ Mapping .code:n = {
\fontspec_update_fontid:n {+map:#1}
\fontspec_update_featstr:n{mapping=#1}
-}{
+ }
+}
+%</xetexx>
+%<*luatex>
+{
+ Mapping .code:n = {
\str_if_eq:nnTF {#1} {tex-text} {
\fontspec_warning:n {no-mapping-ligtex}
\msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none}
- \setkeys[zf]{options}{ Ligatures=TeX }
+ \keys_set:nn {fontspec} { Ligatures=TeX }
}{
\fontspec_warning:n {no-mapping}
}
+ }
}
+%</luatex>
% \end{macrocode}
%
% \paragraph{FeatureFile}
% \begin{macrocode}
-\define@key[zf]{options}{FeatureFile}{
+\keys_define:nn {fontspec} { FeatureFile .code:n = {
\fontspec_update_fontid:n {+fea:#1}
\fontspec_update_featstr:n{featurefile=#1}
+ }
}
% \end{macrocode}
%
@@ -5060,16 +5237,19 @@ This work consists of this file fontspec.dtx
% \subsubsection{Continuous font axes}
%
% \begin{macrocode}
-\define@key[zf]{options}{Weight}{
+\keys_define:nn {fontspec} { Weight .code:n = {
\fontspec_update_fontid:n {+weight:#1}
\fontspec_update_featstr:n{weight=#1}
+ }
}
-\define@key[zf]{options}{Width}{
+\keys_define:nn {fontspec} { Width .code:n = {
\fontspec_update_fontid:n {+width:#1}
\fontspec_update_featstr:n{width=#1}
+ }
}
-\define@key[zf]{options}{OpticalSize}{
- \xetex_or_luatex:nn {
+\keys_define:nn {fontspec} { OpticalSize .code:n =
+%<*xetexx>
+ {
\bool_if:NTF \l_fontspec_icu_bool {
\tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
\fontspec_update_fontid:n {+size:#1}
@@ -5084,27 +5264,37 @@ This work consists of this file fontspec.dtx
\fontspec_warning:n {no-opticals}
}
}
- }{
+ }
+%</xetexx>
+%<*luatex>
+ {
\tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1}
\fontspec_update_fontid:n {+size:#1}
}
+%</luatex>
}
% \end{macrocode}
%
% \subsubsection{Font transformations}
% These are to be specified to apply directly to a font shape:
% \begin{macrocode}
-\define@key[zf]{options}{FakeSlant}[0.2]{
+\keys_define:nn {fontspec} { FakeSlant .code:n = {
\fontspec_update_fontid:n {+slant:#1}
\fontspec_update_featstr:n{slant=#1}
+ },
+ FakeSlant .default:n = {0.2}
}
-\define@key[zf]{options}{FakeStretch}[1.2]{
+\keys_define:nn {fontspec} { FakeStretch .code:n = {
\fontspec_update_fontid:n {+extend:#1}
\fontspec_update_featstr:n{extend=#1}
+ },
+ FakeStretch .default:n = {1.2}
}
-\define@key[zf]{options}{FakeBold}[1.5]{
+\keys_define:nn {fontspec} { FakeBold .code:n = {
\fontspec_update_fontid:n {+embolden:#1}
\fontspec_update_featstr:n{embolden=#1}
+ },
+ FakeBold .default:n = {1.5}
}
% \end{macrocode}
% These are to be given to a shape that has no real bold/italic
@@ -5118,7 +5308,7 @@ This work consists of this file fontspec.dtx
% (This is just a bit harder to program in the current design of
% \pkg{fontspec}.)
% \begin{macrocode}
-\define@key[zf]{options}{AutoFakeSlant}[0.2]{
+\keys_define:nn {fontspec} { AutoFakeSlant .code:n = {
\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}
@@ -5130,11 +5320,13 @@ This work consists of this file fontspec.dtx
\tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl
}
}
+ },
+ AutoFakeSlant .default:n = {0.2}
}
% \end{macrocode}
% Same but reversed:
% \begin{macrocode}
-\define@key[zf]{options}{AutoFakeBold}[1.5]{
+\keys_define:nn {fontspec} { AutoFakeBold .code:n = {
\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}
@@ -5146,6 +5338,8 @@ This work consists of this file fontspec.dtx
\tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl
}
}
+ },
+ AutoFakeBold .default:n = {1.5}
}
% \end{macrocode}
%
@@ -5184,13 +5378,13 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% Emulate CM extra ligatures.
% \begin{macrocode}
-\define@key[zf@feat]{Ligatures}{TeX}[]{
- \xetex_or_luatex:nn {
- \fontspec_update_fontid:n {+map:tex-text}
- \fontspec_update_featstr:n{mapping=tex-text}
- }{
- \fontspec_update_fontid:n {+tlig+trep}
- \fontspec_update_featstr:n{+tlig;+trep}
+\keys_define:nn {fontspec}
+{
+ Ligatures / TeX .code:n = {
+%<xetexx> \fontspec_update_fontid:n {+map:tex-text}
+%<xetexx> \fontspec_update_featstr:n{mapping=tex-text}
+%<luatex> \fontspec_update_fontid:n {+tlig+trep}
+%<luatex> \fontspec_update_featstr:n{+tlig;+trep}
}
}
% \end{macrocode}
@@ -5313,69 +5507,78 @@ This work consists of this file fontspec.dtx
% easy to process, very annoying for the user!
%
% \begin{macrocode}
-\define@key[zf]{options}{Alternate}[0]{
- \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
- \setkeys*[zf@feat]{Alternate}{#1}
- \tl_if_empty:NF \XKV@rm {
- \def\XKV@tfam{Alternate}
- \fontspec_make_feature:nnx {17}{#1} { \fontspec_salt:n {#1} }
+\fontspec_define_font_feature:n { Alternate }
+\keys_define:nn {fontspec}
+ {
+ Alternate .default:n = {0} ,
+ Alternate / unknown .code:n =
+ {
+ \fontspec_make_feature:nnx {17}{#1} { \fontspec_salt:n {#1} }
+ }
}
- \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
-}
% \end{macrocode}
%
% \begin{macrocode}
-\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_salt:n #1 }
- {+salt=#1} { +salt= \int_eval:n {#1+1} }
+\cs_set:Nn \fontspec_salt:n
+%<xetexx> { +salt = #1 }
+%<luatex> { +salt = \int_eval:n {#1+1} }
% \end{macrocode}
%
% \begin{macrocode}
-\define@key[zf]{options}{Variant}{
- \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
- \setkeys*[zf@feat]{Variant}{#1}
- \tl_if_empty:NF \XKV@rm {
- \def\XKV@tfam{Variant}
- \fontspec_make_feature:nnx {18}{#1} { +ss \two@digits {#1} }
+\fontspec_define_font_feature:n { Variant }
+\keys_define:nn {fontspec}
+ {
+ Variant .default:n = {0} ,
+ Variant / unknown .code:n =
+ {
+ \fontspec_make_feature:nnx {18}{#1} { +ss \two@digits {#1} }
+ }
}
- \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
-}
\aliasfontfeature{Variant}{StylisticSet}
% \end{macrocode}
%
% \begin{macrocode}
-\define@key[zf]{options}{CharacterVariant}{
- \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
- \setkeys*[zf@feat]{CharacterVariant}{#1}
- \tl_if_empty:NF \XKV@rm {
- \def\XKV@tfam{CharacterVariant}
- \fontspec_make_feature:nnx {}{} { +cv \two@digits {#1} }
+\fontspec_define_font_feature:n { CharacterVariant }
+\use:x
+ {
+ \cs_new:Npn \exp_not:N \fontspec_parse_cv:w
+ ##1 \c_colon_str ##2 \c_colon_str ##3 \exp_not:N \q_nil
+ {
+ \fontspec_make_numbered_feature:xn
+ { +cv \exp_not:N \two@digits {##1} } {##2}
+ }
+ \keys_define:nn {fontspec}
+ {
+ CharacterVariant / unknown .code:n =
+ {
+ \clist_map_inline:nn {##1}
+ {
+ \exp_not:N \fontspec_parse_cv:w
+ ####1 \c_colon_str 0 \c_colon_str \exp_not:N \q_nil
+ }
+ }
+ }
}
- \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
-}
% \end{macrocode}
+% Possibilities: \verb|a:0:\q_nil| or \verb|a:b:0:\q_nil|.
%
%
% \subsubsection{OpenType maths font features}
-% Used internally by \pkg{unicode-math}; their names might change:
+% Deprecated August 2011; delete at some stage in the future.
% \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}
-}
+\keys_define:nn {fontspec}
+ {
+ ScriptStyle .code:n = {
+%<xetexx> \fontspec_update_fontid:n {+ssty=0}
+%<luatex> \fontspec_update_fontid:n {+ssty=1}
+ \fontspec_update_featstr:n{+sstyle}
+ },
+ ScriptScriptStyle .code:n = {
+%<xetexx> \fontspec_update_fontid:n {+ssty=1}
+%<luatex> \fontspec_update_fontid:n {+ssty=2}
+ \fontspec_update_featstr:n{+ssstyle}
+ }
+ }
% \end{macrocode}
%
%
@@ -5393,6 +5596,8 @@ This work consists of this file fontspec.dtx
\fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{}
\fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna}
\fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna}
+\fontspec_define_numbered_feat:nnnn {Style} {MathScript} {+ssty} {0}
+\fontspec_define_numbered_feat:nnnn {Style} {MathScriptScript} {+ssty} {1}
% \end{macrocode}
%
% \subsubsection{CJK shape}
@@ -5437,35 +5642,37 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
%
% \begin{macrocode}
-\define@key[zf]{options}{Annotation}[0]{
- \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm
- \setkeys*[zf@feat]{Annotation}{#1}
- \tl_if_empty:NF \XKV@rm {
- \def\XKV@tfam{Alternate}
- \fontspec_make_feature:nnx {}{} { \fontspec_nalt:n {#1} }
+\fontspec_define_font_feature:n { Annotation }
+\keys_define:nn {fontspec}
+ {
+ Annotation .default:n = {0} ,
+ Annotation / unknown .code:n =
+ {
+ \fontspec_make_feature:nnx {}{}
+%<xetexx> { +nalt=#1 }
+%<luatex> { +nalt= \int_eval:n {#1+1} }
+ }
}
- \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist
-}
% \end{macrocode}
%
-% \begin{macrocode}
-\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_nalt:n #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}[]{
- \bool_if:NTF \l_fontspec_icu_bool {
- \fontspec_make_feature:nnn{}{}{+vrt2}
- \fontspec_update_fontid:n {+vert}
- \fontspec_update_featstr:n{vertical}
- }{
- \fontspec_update_fontid:n {+vert}
- \fontspec_update_featstr:n{vertical}
+\keys_define:nn {fontspec}
+ {
+ Vertical .choice: ,
+ Vertical / RotatedGlyphs .code:n =
+ {
+ \bool_if:NTF \l_fontspec_icu_bool {
+ \fontspec_make_feature:nnn{}{}{+vrt2}
+ \fontspec_update_fontid:n {+vert}
+ \fontspec_update_featstr:n{vertical}
+ }{
+ \fontspec_update_fontid:n {+vert}
+ \fontspec_update_featstr:n{vertical}
+ }
+ }
}
-}
% \end{macrocode}
%
% \subsubsection{Script}
@@ -5474,7 +5681,8 @@ This work consists of this file fontspec.dtx
\newfontscript{Balinese}{bali} \newfontscript{Bengali}{beng}
\newfontscript{Bopomofo}{bopo} \newfontscript{Braille}{brai}
\newfontscript{Buginese}{bugi} \newfontscript{Buhid}{buhd}
-\newfontscript{Byzantine~Music}{byzm} \newfontscript{Canadian~Syllabics}{cans}
+\newfontscript{Byzantine~Music}{byzm}
+\newfontscript{Canadian~Syllabics}{cans}
\newfontscript{Cherokee}{cher}
\newfontscript{CJK~Ideographic}{hani} \newfontscript{Coptic}{copt}
\newfontscript{Cypriot~Syllabary}{cprt} \newfontscript{Cyrillic}{cyrl}
@@ -5709,49 +5917,62 @@ This work consists of this file fontspec.dtx
\newfontlanguage{Yakut}{YAK}\newfontlanguage{Yoruba}{YBA}
\newfontlanguage{Y-Cree}{YCR}\newfontlanguage{Yi~Classic}{YIC}
\newfontlanguage{Yi~Modern}{YIM}\newfontlanguage{Chinese~Hong~Kong}{ZHH}
-\newfontlanguage{Chinese~Phonetic}{ZHP}\newfontlanguage{Chinese~Simplified}{ZHS}
+\newfontlanguage{Chinese~Phonetic}{ZHP}
+\newfontlanguage{Chinese~Simplified}{ZHS}
\newfontlanguage{Chinese~Traditional}{ZHT}\newfontlanguage{Zande}{ZND}
\newfontlanguage{Zulu}{ZUL}
% \end{macrocode}
%
% \paragraph{Turkish} Turns out that many fonts use `TUR' as their Turkish language tag rather than the specified `TRK'. So we check for both:
% \begin{macrocode}
-\define@key[zf@feat]{Lang}{Turkish}[]{
- \fontspec_check_lang:nTF {TRK} {
- \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int}
- \fontspec_update_fontid:n {+lang=Turkish}
- \tl_set:Nn \l_fontspec_lang_tl {TRK}
- }{
- \fontspec_check_lang:nTF {TUR} {
- \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int}
- \fontspec_update_fontid:n {+lang=Turkish}
- \tl_set:Nn \l_fontspec_lang_tl {TUR}
- }{
- \fontspec_warning:nx {language-not-exist} {#1}
- \setkeys[zf@feat]{Lang}{Default}
- }
+\keys_define:nn {fontspec}
+ {
+ Language / Turkish .code:n =
+ {
+ \fontspec_check_lang:nTF {TRK} {
+ \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int}
+ \fontspec_update_fontid:n {+lang=Turkish}
+ \tl_set:Nn \l_fontspec_lang_tl {TRK}
+ }{
+ \fontspec_check_lang:nTF {TUR} {
+ \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int}
+ \fontspec_update_fontid:n {+lang=Turkish}
+ \tl_set:Nn \l_fontspec_lang_tl {TUR}
+ }{
+ \fontspec_warning:nx {language-not-exist} {Turkish}
+ \keys_set:nn {fontspec} {Language=Default}
+ }
+ }
+ }
}
-}
% \end{macrocode}
%
% \paragraph{Default}
%
% \begin{macrocode}
-\define@key[zf@feat]{Lang}{Default}[]{
- \fontspec_update_fontid:n {+lang=dflt}
- \tl_set:Nn \l_fontspec_lang_tl {DFLT}
- \int_zero:N \l_fontspec_language_int
-}
+\keys_define:nn {fontspec}
+ {
+ Language / Default .code:n =
+ {
+ \fontspec_update_fontid:n {+lang=dflt}
+ \tl_set:Nn \l_fontspec_lang_tl {DFLT}
+ \int_zero:N \l_fontspec_language_int
+ }
+ }
% \end{macrocode}
%
% \subsubsection{Raw feature string}
% This allows savvy \XeTeX-ers to input font features manually if they have
% already memorised the OpenType abbreviations and don't mind not having error checking.
% \begin{macrocode}
-\define@key[zf]{options}{RawFeature}{
- \fontspec_update_fontid:n {+Raw:#1}
- \fontspec_update_featstr:n{#1}
-}
+\keys_define:nn {fontspec}
+ {
+ RawFeature .code:n =
+ {
+ \fontspec_update_fontid:n {+Raw:#1}
+ \fontspec_update_featstr:n{#1}
+ }
+ }
% \end{macrocode}
%
%
@@ -5965,24 +6186,24 @@ This work consists of this file fontspec.dtx
% as per usual with \cmd\setboldmathrm, which stores the appropriate
% family name in \cmd\g_fontspec_bfmathrm_tl.
% \begin{macrocode}
- \DeclareSymbolFont{operators}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault
- \SetSymbolFont{operators}{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault
- \SetMathAlphabet\mathrm{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault
- \SetMathAlphabet\mathit{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\itdefault
- \SetMathAlphabet\mathbf{normal}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault
- \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
+ \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault
+ \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\mddefault\itdefault
+ \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault
+ \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\mddefault\updefault
+ \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\mddefault\updefault
+ \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault
\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}\g_fontspec_encoding_tl\g_fontspec_mathrm_tl\bfdefault\updefault
+ \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\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
+ \SetMathAlphabet\mathrm{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\updefault
+ \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\bfdefault\updefault
+ \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_fontspec_bfmathrm_tl\mddefault\itdefault
}
- \SetMathAlphabet\mathsf{bold}\zf@enc\g_fontspec_mathsf_tl\bfdefault\updefault
- \SetMathAlphabet\mathtt{bold}\zf@enc\g_fontspec_mathtt_tl\bfdefault\updefault
+ \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\bfdefault\updefault
+ \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g_fontspec_mathtt_tl\bfdefault\updefault
}
% \end{macrocode}
% \end{macro}
@@ -6012,6 +6233,7 @@ This work consists of this file fontspec.dtx
\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{lmodern}{\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}{}
@@ -6037,16 +6259,36 @@ This work consists of this file fontspec.dtx
}
% \end{macrocode}
%
-% The end! Thanks for coming.
+% \subsection{Compatibility}
%
-% \iffalse
-%</fontspec>
-%<*lua>
-% \fi
+% \begin{macro}{\zf@enc}
+% \begin{macro}{\zf@family}
+% \begin{macro}{\zf@basefont}
+% \begin{macro}{\zf@fontspec}
+% Just in case.
+% \begin{macrocode}
+\tl_set:Nn \zf@enc { \g_fontspec_encoding_tl }
+\tl_set:Nn \zf@family { \l_fontspec_family_tl }
+\tl_set:Nn \zf@basefont { \l_fontspec_font }
+\cs_set_eq:NN \zf@fontspec \fontspec_select:nn
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+% The end! Thanks for coming.
+% \begin{macrocode}
+\ExplSyntaxOff
+%</fontspec&(xetexx|luatex)>
+% \end{macrocode}
%
% \clearpage
% \part{fontspec.lua}
%
+% \begin{macrocode}
+%<*lua>
+% \end{macrocode}
% First we define some metadata.
% \begin{macrocode}
fontspec = { }
@@ -6077,14 +6319,14 @@ function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-packag
local function check_script(id, script)
local s = string.lower(script)
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
for j,_ in pairs(features[i]) do
if features[i][j][s] then
fontspec.log("script '%s' exists in font '%s'",
- script, fonts.ids[id].fullname)
+ script, fonts.identifiers[id].fullname)
return true
end
end
@@ -6099,14 +6341,14 @@ local function check_language(id, language, script)
local s = string.lower(script)
local l = string.lower(language)
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
for j,_ in pairs(features[i]) do
if features[i][j][s] and features[i][j][s][l] then
fontspec.log("language '%s' for script '%s' exists in font '%s'",
- language, script, fonts.ids[id].fullname)
+ language, script, fonts.identifiers[id].fullname)
return true
end
end
@@ -6122,14 +6364,14 @@ local function check_feature(id, feature, language, script)
local l = string.lower(language)
local f = string.lower(feature:gsub("^[+-]", ""))
if id and id > 0 then
- local otfdata = fonts.ids[id].shared.otfdata
+ local otfdata = fonts.identifiers[id].shared.otfdata
if otfdata then
local features = otfdata.luatex.features
for i,_ in pairs(features) do
if features[i][f] and features[i][f][s] then
if features[i][f][s][l] == true then
fontspec.log("feature '%s' for language '%s' and script '%s' exists in font '%s'",
- feature, language, script, fonts.ids[id].fullname)
+ feature, language, script, fonts.identifiers[id].fullname)
return true
end
end
@@ -6182,7 +6424,7 @@ end
%
% \begin{macrocode}
function fontspec.mathfontdimen(fnt, str)
- local mathdimens = fonts.ids[font.id(fnt)].MathConstants
+ local mathdimens = fonts.identifiers[font.id(fnt)].MathConstants
if mathdimens then
local m = mathdimens[str]
if m then
@@ -6197,16 +6439,45 @@ function fontspec.mathfontdimen(fnt, str)
end
% \end{macrocode}
%
-% \iffalse
+% Here we patch fonts tfm table to emulate \XeTeX's \cs{fontdimen8},
+% which stores the caps-height of the font. (Cf.\ \cs{fontdimen5} which
+% stores the x-height.)
+%
+% Falls back to measuring the glyph if the font doesn't contain the
+% necessary information.
+% This needs to be extended for fonts that don't contain an `X'.
+%
+% \begin{macrocode}
+local function set_capheight(fontdata)
+ local capheight
+ local units = fontdata.units
+ local size = fontdata.size
+ local otfdata = fontdata.shared.otfdata
+
+ if otfdata.pfminfo.os2_capheight > 0 then
+ capheight = otfdata.pfminfo.os2_capheight / units * size
+ else
+ if fontdata.characters[string.byte("X")] then
+ capheight = fontdata.characters[string.byte("X")].height
+ else
+ capheight = otfdata.metadata.ascent / units * size
+ end
+ end
+ fontdata.parameters[8] = capheight
+end
+luatexbase.add_to_callback("luaotfload.patch_font", set_capheight, "fontspec.set_capheight")
+% \end{macrocode}
+%
+% \begin{macrocode}
%</lua>
-% \fi
+% \end{macrocode}
%
% \clearpage
% \part{fontspec-patches.sty}
%
-% \iffalse
+% \begin{macrocode}
%<*patches>
-% \fi
+% \end{macrocode}
%
% \begin{macrocode}
\ExplSyntaxOn
@@ -6262,7 +6533,7 @@ end
% \begin{macro}{\fontspec_visible_space:}
% Print \unichar{2434}{Open box}, which is used to visibly display a space character.
% \begin{macrocode}
-\cs_new:Npn \fontspec_visible_space: {
+\cs_new:Nn \fontspec_visible_space: {
\font_glyph_if_exist:NnTF \font {"2423}
{\char"2423\relax}
{\fontspec_visible_space_fallback:}
@@ -6273,9 +6544,9 @@ end
% \begin{macro}{\fontspec_visible_space:@fallback}
% If the current font doesn't have \unichar{2434}{Open box}, use Latin Modern Mono instead.
% \begin{macrocode}
-\cs_new:Npn \fontspec_visible_space_fallback: {
+\cs_new:Nn \fontspec_visible_space_fallback: {
{
- \usefont{\zf@enc}{lmtt}{\f@series}{\f@shape}
+ \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape}
\textvisiblespace
}
}
@@ -6286,9 +6557,9 @@ end
% Helper macro to turn spaces (\verb|^^20|) active and print visible space instead.
% \begin{macrocode}
\group_begin:
-\char_make_active:n{"20}%
+\char_set_catcode_active:n{"20}%
\cs_gset:Npn\fontspec_print_visible_spaces:{%
-\char_make_active:n{"20}%
+\char_set_catcode_active:n{"20}%
\cs_set_eq:NN^^20\fontspec_visible_space:%
}%
\group_end:
@@ -6376,16 +6647,37 @@ end
}
% \end{macrocode}
%
-% \iffalse
+% \subsection{\cs{oldstylenums}}
+%
+%
+% \begin{macro}{\oldstylenums}
+% \begin{macro}{\liningnums}
+% This command obviously needs a redefinition.
+% And we may as well provide the reverse command.
+% \begin{macrocode}
+\RenewDocumentCommand \oldstylenums {m}
+ {
+ { \addfontfeature{Numbers=OldStyle} #1 }
+ }
+\NewDocumentCommand \liningnums {m}
+ {
+ { \addfontfeature{Numbers=Lining} #1 }
+ }
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
+%
+% \begin{macrocode}
%</patches>
-% \fi
+% \end{macrocode}
%
% \clearpage
% \part{fontspec.cfg}
%
-% \iffalse
+% \begin{macrocode}
%<*cfg>
-% \fi
+% \end{macrocode}
%
% \begin{macrocode}
@@ -6400,9 +6692,9 @@ end
% \end{macrocode}
%
-% \iffalse
+% \begin{macrocode}
%</cfg>
-% \fi
+% \end{macrocode}
%
% \clearpage
% \PrintChanges
@@ -6431,7 +6723,7 @@ end
\section*{The basics of the \textsf{fontspec} package}
The \textsf{fontspec} package enables automatic font selection
-for \LaTeX{} documents typeset with Xe\TeX{} or \LuaTeX.
+for \LaTeX{} documents typeset with Xe\TeX{} or Lua\TeX.
The basic command is
{\centering \verb|\fontspec[font features]{font display name}|.\par}
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx
new file mode 100644
index 00000000000..103bc0b4373
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx
@@ -0,0 +1,15 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+
+\aliasfontfeature{Numbers}{123}
+\aliasfontfeatureoption{Numbers}{Lining}{UC}
+\aliasfontfeatureoption{Numbers}{OldStyle}{LC}
+
+\fontspec[123=UC]{TeX Gyre Pagella}
+Numbers: 12345
+
+\fontspec[123=LC]{TeX Gyre Pagella}
+Numbers: 12345
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx
new file mode 100644
index 00000000000..4caecfb471b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx
@@ -0,0 +1,9 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+
+\aliasfontfeature{ItalicFeatures}{IF}
+\fontspec[IF = {Colour=FF0000}]{Times}
+Roman letters \itshape and red italics
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx
new file mode 100644
index 00000000000..183d66099e0
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx
@@ -0,0 +1,12 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\Large
+\setmainfont{TeX Gyre Termes} aA
+\fontspec{TeX Gyre Heros} aA
+\fontspec{TeX Gyre Cursor} aA
+\fontspec[Scale=MatchUppercase]{TeX Gyre Heros} aA
+\fontspec[Scale=MatchUppercase]{TeX Gyre Cursor} aA
+\fontspec[Scale=MatchLowercase]{TeX Gyre Heros} aA
+\fontspec[Scale=MatchLowercase]{TeX Gyre Cursor} aA
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx
new file mode 100644
index 00000000000..a9105f4a70f
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx
@@ -0,0 +1,11 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\Large
+\fontspec{EB Garamond Italic} very
+\fontspec[CharacterVariant=5]{EB Garamond Italic} very
+\fontspec[CharacterVariant=5:0]{EB Garamond Italic} very
+\fontspec[CharacterVariant=5:1]{EB Garamond Italic} very
+\fontspec[CharacterVariant=5:2]{EB Garamond Italic} very
+\fontspec[CharacterVariant=5:3]{EB Garamond Italic} very
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F003a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx
index b0d4b43aa6b..b0d4b43aa6b 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F003a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx
index 7455431e2e3..7455431e2e3 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F003b.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx
index 8e9052dd6fb..afef4c2a539 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F003b.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx
@@ -9,4 +9,9 @@ Test
Color=red,Opacity=0.5
]{Verdana}
Test
+
+\fontspec[
+ Color=00FF00,Opacity=0.5
+ ]{Verdana}
+Test
\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx
new file mode 100644
index 00000000000..2fab9c6660e
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx
@@ -0,0 +1,18 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+
+\fontspec[Numbers={Proportional,OldStyle}]
+ {TeX Gyre Adventor}
+`In 1842, 999 people sailed 97 miles in
+ 13 boats. In 1923, 111 people sailed 54
+ miles in 56 boats.' \bigskip
+
+{\addfontfeatures{Numbers={Monospaced,Lining}}
+\begin{tabular}{@{} cccc @{}}
+ Year & People & Miles & Boats \\
+ \hline 1842 & 999 & 75 & 13 \\
+ 1923 & 111 & 54 & 56
+\end{tabular}}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx
new file mode 100644
index 00000000000..28673b1c254
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx
@@ -0,0 +1,11 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\Large
+ \fontspec[BoldFont={Kurier Heavy}]
+ {Kurier Bold}
+ Kurier Bold \\
+ {\itshape Kurier Bold Italic} \\
+ {\bfseries Kurier Heavy } \\
+ {\bfseries\itshape Kurier Heavy Italic} \\
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F006a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx
index 39cd453a155..39cd453a155 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F006a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F001b-emph.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx
index e24dea90cec..e24dea90cec 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F001b-emph.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F001a-basic-loading.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx
index 4aa54463b7a..4aa54463b7a 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F001a-basic-loading.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx
new file mode 100644
index 00000000000..98b4102b33b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx
@@ -0,0 +1,22 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+% behaviour fixed Sept 2011; external
+% fonts should not search for variants
+% if they're not specified.
+
+\setmainfont
+ [ExternalLocation,
+ SlantedFont={lmroman10-italic}]
+ {lmroman10-regular}
+
+test \textsl{hello}
+
+\setmainfont
+ [ExternalLocation,
+ BoldFont={lmroman10-bold}]
+ {lmroman10-regular}
+
+test \textbf{hello}
+
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx
new file mode 100644
index 00000000000..d1593613039
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx
@@ -0,0 +1,19 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\usepackage{xcolor}
+\begin{document}
+\fontspec[
+ UprightFeatures={Color = 220022,
+ SmallCapsFeatures = {Color=115511}},
+ ItalicFeatures={Color = 2244FF,
+ SmallCapsFeatures = {Color=112299}},
+ BoldFeatures={Color = FF4422,
+ SmallCapsFeatures = {Color=992211}},
+ BoldItalicFeatures={Color = 888844,
+ SmallCapsFeatures = {Color=444422}},
+ ]{TeX Gyre Termes}
+Upright {\scshape Small Caps}\\
+\itshape Italic {\scshape Italic Small Caps}\\
+\upshape\bfseries Bold {\scshape Bold Small Caps}\\
+\itshape Bold Italic {\scshape Bold Italic Small Caps}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F002a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx
index 79f1c0dc2dd..79f1c0dc2dd 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F002a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F004a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx
index b6b32e4c0d1..b6b32e4c0d1 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F004a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx
new file mode 100644
index 00000000000..12ef304e7ff
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx
@@ -0,0 +1,8 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\fontspec{Latin Modern Roman}
+Automatic optical size\par
+\scalebox{0.4}{\Huge
+Automatic optical size}
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx
new file mode 100644
index 00000000000..b15bba6652b
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx
@@ -0,0 +1,10 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\usepackage{xcolor}
+\begin{document}
+\huge
+\fontspec{EB Garamond Italic} \& violet \\
+\fontspec[CharacterVariant={4}]{EB Garamond Italic} \& violet \\
+\fontspec[CharacterVariant={5:2}]{EB Garamond Italic} \& violet \\
+\fontspec[CharacterVariant={4,5:2}]{EB Garamond Italic} \& violet
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx
new file mode 100644
index 00000000000..3d1487ed6f5
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx
@@ -0,0 +1,12 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\usepackage{xcolor}
+\begin{document}
+\huge
+\fontspec{EB Garamond Italic} very \\
+\fontspec[CharacterVariant=5]{EB Garamond Italic} very \\
+\fontspec[CharacterVariant=5:0]{EB Garamond Italic} very \\
+\fontspec[CharacterVariant=5:1]{EB Garamond Italic} very \\
+\fontspec[CharacterVariant=5:2]{EB Garamond Italic} very \\
+\fontspec[CharacterVariant=5:3]{EB Garamond Italic} very
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F005a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx
index 08dc161729c..08dc161729c 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F005a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F200a-test-prog.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx
index c9ec65bc928..c9ec65bc928 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F200a-test-prog.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F100e.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx
index f146623f66e..f146623f66e 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F100e.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F100d.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx
index 4e818edff8b..4e818edff8b 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F100d.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F100c.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx
index 83371207940..83371207940 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F100c.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F100a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx
index 9f49e48bc13..9f49e48bc13 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F100a.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F100b.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx
index 84e646b616b..84e646b616b 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/F100b.ltx
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx
new file mode 100644
index 00000000000..92ccec4d1c0
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx
@@ -0,0 +1,20 @@
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\fontspec{TeX Gyre Termes}
+Some text for our example to take
+up some space, and to demonstrate
+the default interword space.
+\bigskip
+
+\addfontfeature{ WordSpace = 0.3 }
+Some text for our example to take
+up some space, and to demonstrate
+the default interword space.
+\bigskip
+
+\large
+Some text for our example to take
+up some space, and to demonstrate
+the default interword space.
+\end{document} \ No newline at end of file
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx
new file mode 100644
index 00000000000..2d7eb5952c6
--- /dev/null
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx
@@ -0,0 +1,11 @@
+
+\documentclass{testsuite}
+\usepackage{fontspec}
+\begin{document}
+\newfontfeature{AvoidD}{Special=Avoid d-collisions}
+\newfontfeature{NoAvoidD}{Special=!Avoid d-collisions}
+\fontspec[AvoidD,Variant=1]{Zapfino}
+ sockdolager rubdown \\
+\fontspec[NoAvoidD,Variant=1]{Zapfino}
+ sockdolager rubdown
+\end{document}
diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex
index 4f7cee4b899..25644b041dc 100644
--- a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex
+++ b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex
@@ -1,15 +1,24 @@
-\TEST{F001a-basic-loading}
-\TEST{F001b-emph}
-\TEST{F002a}
-\TEST{F003a}
-\TEST{F003b}
-\TEST{F003c}
-\TEST{F004a}
-\TEST{F005a}
-\TEST{F006a}
-\TEST{F100a}
-\TEST{F100b}
-\TEST{F100c}
-\TEST{F100d}
-\TEST{F100e}
-\TEST{F200a-test-prog}
+\TEST{F-autoscaling}
+\TEST{F-charactervariant}
+\TEST{F-colour-basic}
+\TEST{F-colour-clash}
+\TEST{F-colour-opacity}
+\TEST{F-feat-numbers}
+\TEST{F-font-selection-bold}
+\TEST{F-hyphenchar}
+\TEST{F-inner-emph}
+\TEST{F-loading-basic}
+\TEST{F-loading-external-underdefined}
+\TEST{F-loading-nested-scfeat}
+\TEST{F-loading-scale}
+\TEST{F-loading-sizefeatures}
+\TEST{F-ot-cvxx-2}
+\TEST{F-ot-cvxx}
+\TEST{F-ot-ss06}
+\TEST{F-programmers-interface}
+\TEST{F-verb-fancyvrb}
+\TEST{F-verb-listings}
+\TEST{F-verb-moreverb}
+\TEST{F-verb-plain}
+\TEST{F-verb-verbatim}
+\TEST{F-wordspace}