From a15070e9ad7c5de81ac3a66d5301c333030d08c6 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 17 Jun 2014 22:32:41 +0000 Subject: fontspec git-svn-id: svn://tug.org/texlive/trunk@34269 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/fontspec/README | 67 +- .../doc/latex/fontspec/fontspec-example.tex | 14 +- .../doc/latex/fontspec/fontspec-testsuite.pdf | Bin 271559 -> 0 bytes Master/texmf-dist/doc/latex/fontspec/fontspec.pdf | Bin 2798445 -> 2695416 bytes Master/texmf-dist/source/latex/fontspec/Makefile | 11 +- .../texmf-dist/source/latex/fontspec/fontspec.dtx | 2803 +++++++++++--------- .../fontspec/testsuite/F-alias-feature-option.ltx | 15 - .../latex/fontspec/testsuite/F-alias-feature.ltx | 9 - .../source/latex/fontspec/testsuite/F-autofake.ltx | 16 - .../latex/fontspec/testsuite/F-autoscaling.ltx | 12 - .../fontspec/testsuite/F-charactervariant.ltx | 11 - .../latex/fontspec/testsuite/F-colour-basic.ltx | 13 - .../latex/fontspec/testsuite/F-colour-clash.ltx | 13 - .../latex/fontspec/testsuite/F-colour-opacity.ltx | 17 - .../latex/fontspec/testsuite/F-feat-numbers.ltx | 18 - .../fontspec/testsuite/F-font-selection-bold.ltx | 11 - .../latex/fontspec/testsuite/F-hyphenchar.ltx | 15 - .../latex/fontspec/testsuite/F-inner-emph.ltx | 11 - .../latex/fontspec/testsuite/F-loading-basic.ltx | 13 - .../testsuite/F-loading-external-underdefined.ltx | 22 - .../fontspec/testsuite/F-loading-nested-scfeat.ltx | 19 - .../latex/fontspec/testsuite/F-loading-scale.ltx | 16 - .../fontspec/testsuite/F-loading-sizefeatures.ltx | 11 - .../latex/fontspec/testsuite/F-optical-sizes.ltx | 8 - .../latex/fontspec/testsuite/F-ot-cvxx-2.ltx | 10 - .../source/latex/fontspec/testsuite/F-ot-cvxx.ltx | 12 - .../source/latex/fontspec/testsuite/F-ot-ss06.ltx | 9 - .../fontspec/testsuite/F-programmers-interface.ltx | 25 - .../latex/fontspec/testsuite/F-verb-fancyvrb.ltx | 10 - .../latex/fontspec/testsuite/F-verb-listings.ltx | 10 - .../latex/fontspec/testsuite/F-verb-moreverb.ltx | 12 - .../latex/fontspec/testsuite/F-verb-plain.ltx | 24 - .../latex/fontspec/testsuite/F-verb-verbatim.ltx | 24 - .../latex/fontspec/testsuite/F-wordspace.ltx | 20 - .../fontspec/testsuite/X-new-font-feature.ltx | 11 - .../latex/fontspec/testsuite/testsuite-listing.tex | 29 - .../source/latex/fontspec/testsuite/testsuite.cls | 17 - .../tex/latex/fontspec/fontspec-luatex.sty | 1656 ++++++------ .../tex/latex/fontspec/fontspec-patches.sty | 6 +- .../tex/latex/fontspec/fontspec-xetex.sty | 1715 ++++++------ Master/texmf-dist/tex/latex/fontspec/fontspec.cfg | 9 + Master/texmf-dist/tex/latex/fontspec/fontspec.lua | 4 +- Master/texmf-dist/tex/latex/fontspec/fontspec.sty | 86 +- 43 files changed, 3409 insertions(+), 3425 deletions(-) delete mode 100644 Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-autofake.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex delete mode 100644 Master/texmf-dist/source/latex/fontspec/testsuite/testsuite.cls diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README index 0610e92c6c3..8d5edc40e3a 100644 --- a/Master/texmf-dist/doc/latex/fontspec/README +++ b/Master/texmf-dist/doc/latex/fontspec/README @@ -3,7 +3,7 @@ THE FONTSPEC PACKAGE ==================== The fontspec package provides an automatic and unified interface for loading -fonts in LaTeX. XeTeX and LuaTeX (the latter through the luaotfload package) +fonts in LaTeX. XeTeX and LuaTeX (the latter through the `luaotfload` package) allows a direct interface to fonts which may be loaded by their name rather than filename, so no manual font installation is required. @@ -15,7 +15,7 @@ others. See the documentation `fontspec.pdf` for full information. Release versions of fontspec are available from CTAN: - + Development and historical versions are available from Github: @@ -27,7 +27,7 @@ Please offer suggestions and file bug reports in the issue tracker: Requirements ------------ -The `fontspec` package requires an up-to-date TeX Live 2011 or MiKTeX 2.9, +The `fontspec` package requires an up-to-date TeX Live or MiKTeX installation, including the most recent version of the `l3kernel` package which provides the LaTeX3 programming interface known as `expl3`. @@ -37,25 +37,18 @@ Summary of user commands Font families may be selected individually with the command - \fontspec[]{} + \fontspec{}[] Commands for selecting fonts efficiently through a document are created with - \newfontfamily\myfamily[]{} - \newfontface\myfont[]{} + \newfontfamily\myfamily{}[] + \newfontface\myfont{}[] Default document fonts are selected with - \setmainfont[]{} - \setsansfont[]{} - \setmonofont[]{} - -Fonts to be used in text strings in maths are defined with - - \setmathrm[]{} - \setmathsf[]{} - \setmathtt[]{} - \setboldmathrm[]{} + \setmainfont{}[] + \setsansfont{}[] + \setmonofont{}[] Features to be used for every subsequently defined font are specified with @@ -72,6 +65,48 @@ Features may be added to the font currently in use with Change history -------------- +- v2.4 (25/05/2014) + + * Significant change to the user interface: instead of `\setmainfont[features]{font}`, you now write `\setmainfont{font}[features]`. + Backwards compatibility is of course preserved. + + The reason for this change is to improve the visual comprehension of the font loading syntax with large numbers of font features. + + * Defaults for symbolic font families like this can now be specified with + + \defaultfontfeatures[\rmfamily]{...} + + or + + \defaultfontfeatures[\headingsfont]{...} + \setfontfamily\headingsfont{...} + + * New `PunctuationSpace=WordSpace` and `PunctuationSpace=TwiceWordSpace` settings, intended for monospaced fonts; these force the space after a period to be exactly one or two spaces wide, respectively, which preserves character alignment across lines. + + * The features above now allow changes to the default settings: + + * `Ligatures=TeX` is enabled by default with `\setmainfont` and `\setsansfont`. + * `WordSpace={1,0,0}` and `PunctuationSpace=WordSpace` are now enabled by default for `\setmonofont` to produce better monospaced results. + * (These can be adjusted by created your own `fontspec.cfg` file.) + + * `SizeFeatures` can now be nested inside `ItalicFeatures` (etc.) and behaves correctly. This has been a very long overdue bug! + + * New feature `NFSSFamily=ABC` to set the NFSS family of a font to “`ABC`”. Useful + when other packages use the `\fontfamily{ABC}\selectfont` interface. + + * New feature `FontFace = {series}{shape}{font}` allows a font face to be loaded with a specific NFSS font series and font shape. + A more verbose syntax allows arbitrary font features as well (and this also plays nicely with `SizeFeatures`): + + \fontspec{myfont.otf}[ + FontFace = {b}{ui}{Font = myfont-bui.otf, } , + ] + + The code above, for example, will allow a bold upright italic font to be selected using the standard NFSS interface: `\fontseries{b}\fontshape{ui}\selectfont`. + + * `\defaultfontfeatures+` (note the `+`) can now be used to append to the default font feature set. + + * Setting the `SmallCapsFont` using the `*`-replacement notation has been improved/fixed. + - v2.3c (2013/05/20) * Compatbility with luaotfload 2013/05/20 2.2c, support for older version diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex index a348d1f21b1..9138c3a6f74 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex @@ -4,9 +4,9 @@ \usepackage{fontspec} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros} -\setmonofont[Scale=MatchLowercase]{Inconsolata} +\setmainfont{TeX Gyre Pagella} +\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase] +\setmonofont{Inconsolata}[Scale=MatchLowercase] \begin{document} \pagestyle{empty} @@ -17,7 +17,7 @@ The \textsf{fontspec} package enables automatic font selection for \LaTeX{} documents typeset with Xe\TeX{} or Lua\TeX. The basic command is -{\centering \verb|\fontspec[font features]{font display name}|.\par} +{\centering \verb|\fontspec{font display name}[font features]|.\par} The default, sans serif, and typewriter fonts may be set with the commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|, @@ -37,9 +37,9 @@ called mid-document. Maths symbols themselves are not affected. Notice the font features used to load the default fonts in the preamble. -The first, \verb|Ligatures=TeX|, enables regular \TeX{} ligatures like -\verb|``---''| for ``---''. -The second, \verb|Scale=MatchLowercase|, automatically scales the fonts to +\verb|Ligatures=TeX| is automatically enabled for the roman and sans font, +allowing regular \TeX{} ligatures like \verb|``---''| for ``---''. +\verb|Scale=MatchLowercase| automatically scales the fonts to the same x-height. Please see the complete \textsf{fontspec} documentation for further diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf deleted file mode 100644 index d57ce9e952c..00000000000 Binary files a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf and /dev/null differ diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf index a4ded4d26e9..eec90c21a6a 100644 Binary files a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf and b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf differ diff --git a/Master/texmf-dist/source/latex/fontspec/Makefile b/Master/texmf-dist/source/latex/fontspec/Makefile index 2a0b321947e..9d6445ec6d4 100644 --- a/Master/texmf-dist/source/latex/fontspec/Makefile +++ b/Master/texmf-dist/source/latex/fontspec/Makefile @@ -40,7 +40,7 @@ DTX = $(NAME).dtx REDIRECT = > /dev/null # Files grouped by generation mode -COMPILED = $(DOC) fontspec-testsuite.pdf +COMPILED = $(DOC) EXAMPLES = fontspec-example.tex UNPACKED = fontspec.sty fontspec-xetex.sty fontspec-luatex.sty fontspec-patches.sty fontspec.lua fontspec.cfg $(EXAMPLES) SOURCE = $(DTX) Makefile README @@ -110,7 +110,6 @@ define run-install @mkdir -p $(RUNDIR) && cp $(RUNFILES) $(RUNDIR) @mkdir -p $(DOCDIR) && cp $(DOCFILES) $(DOCDIR) @mkdir -p $(SRCDIR) && cp $(SRCFILES) $(SRCDIR) -@mkdir -p $(SRCDIR)/testsuite/ && cp $(TESTS) $(SRCDIR)/testsuite/ endef define run-sty-install @@ -129,12 +128,6 @@ $(TDS_ZIP): $(ALL_FILES) README: README.markdown cp $< $@ -# lazy: -fontspec-testsuite.pdf: $(DTX) - @echo 'Compiling test suite.' - $(DO_PDFLATEX) - xelatex --interaction=nonstopmode fontspec-testsuite.tex $(REDIRECT) - .PHONY: install manifest clean mrproper install: $(ALL_FILES) @@ -153,7 +146,7 @@ sty-install: $(RUNFILES) @echo "Installing in '$(TEXMFROOT)'." $(run-install) -manifest: +manifest: @echo "Source files:" @for f in $(SOURCE); do echo $$f; done @echo "" diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index 039cb13729f..da3219ae1ac 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -2,6 +2,20 @@ %<*internal> \begingroup \input l3docstrip.tex + +\def\doOption#1>#2\endLine{% + \maybeMsg{<#1 . >}% + \Evaluate{#1}% + \def\do##1##2##3{% + \if1\Expr{##2}% + \def\inLine{#2}% + \replaceModuleInLine + \StreamPut##1{\inLine}% + \fi + }% + \activefiles +} + \keepsilent \usedir{tex/latex/fontspec} \let\MetaPrefix\relax @@ -9,7 +23,7 @@ _________________________________________ The fontspec package for XeLaTeX/LuaLaTeX - (C) 2004--2013 Will Robertson and Khaled Hosny + (C) 2004--2014 Will Robertson and Khaled Hosny License information appended. @@ -17,7 +31,7 @@ \endpreamble \postamble -Copyright 2004--2013 Will Robertson +Copyright 2004--2014 Will Robertson Copyright 2009--2013 Khaled Hosny Distributable under the LaTeX Project Public License, @@ -41,11 +55,22 @@ This work consists of this file fontspec.dtx \generate{\file{fontspec.lua} {\from{fontspec.dtx}{lua}}} \let\MetaPrefix\DoubleperCent + +\ifx\FontspecDebug\undefined + \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}}} + +\else + +\generate{\file{fontspec.sty} {\from{fontspec.dtx}{fontspec,debug}}} +\generate{\file{fontspec-xetex.sty} {\from{fontspec.dtx}{fontspec,xetexx,debug}}} +\generate{\file{fontspec-luatex.sty} {\from{fontspec.dtx}{fontspec,luatex,debug}}} +\generate{\file{fontspec-patches.sty} {\from{fontspec.dtx}{patches,debug}}} + +\fi \nopreamble\nopostamble \generate{\file{fontspec.cfg} {\from{fontspec.dtx}{cfg}}} @@ -66,7 +91,7 @@ This work consists of this file fontspec.dtx %\ProvidesPackage{fontspec-luatex} %\ProvidesPackage{fontspec-patches} %<*fontspec|patches> - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] % % %<*driver> @@ -159,7 +184,7 @@ This work consists of this file fontspec.dtx % % \subsection{Acknowledgements} % -% This package couldn't be possible without the early and continued support +% This package could not have been possible without the early and continued support % the author of \XeTeX, Jonathan Kew. When I started this package, he steered % me many times in the right direction. % @@ -225,14 +250,19 @@ This work consists of this file fontspec.dtx % leaving well enough alone, apply the |[no-math]| package option to manually % suppress its maths font. % -% \subsection{Configuration} If you wish to customise any part of the -% \pkg{fontspec} interface (see later in this manual, \vref{sec:newfeatures} -% and~\ref{sec:aliasfontfeature}), this should be done by creating your own +% \subsection{Configuration} +% \label{sec:config} +% +% If you wish to customise any part of the +% \pkg{fontspec} interface, this should be done by creating your own % \texttt{fontspec.cfg} file, -% which will be automatically loaded if it is found by \XeTeX\ or \LuaTeX. Either place it -% in the same folder as the main document for isolated cases, or in a location +% which will be automatically loaded if it is found by \XeTeX\ or \LuaTeX. +% A |fontspec.cfg| file is distributed with \pkg{fontspec} with a small number of defaults set up within it. +% +% To customise \pkg{fontspec} to your liking, use the standard |.cfg| file as a starting point or write your own from scratch, then either place it in the same folder as the main document for isolated cases, or in a location % that \XeTeX\ or \LuaTeX\ searches by default; \eg\ in Mac\TeX: \path{~/Library/texmf/tex/latex/}. -% The package option |[no-config]| will suppress this behaviour under all circumstances. +% +% The package option |[no-config]| will suppress the loading of the |fontspec.cfg| file under all circumstances. % % \subsection{Warnings} % \label{sec:quiet-warnings} @@ -254,17 +284,30 @@ This work consists of this file fontspec.dtx % fonts. % % \cmdbox{% -% \CMD{\string\fontspec} \oarg{font features} \marg{font name}\\ -% \CMD{\string\setmainfont} \oarg{font features} \marg{font name}\\ -% \CMD{\string\setsansfont} \oarg{font features} \marg{font name}\\ -% \CMD{\string\setmonofont} \oarg{font features} \marg{font name}\\ -% \CMD{\string\newfontfamily} \meta{cmd} \oarg{font features} \marg{font name} +% \CMD{\string\fontspec}\marg{font name}\oarg{font features}\\ +% \CMD{\string\setmainfont}\marg{font name}\oarg{font features}\\ +% \CMD{\string\setsansfont}\marg{font name}\oarg{font features}\\ +% \CMD{\string\setmonofont}\marg{font name}\oarg{font features}\\ +% \CMD{\string\newfontfamily}\meta{cmd}\marg{font name}\oarg{font features} % } % % These are the main font-selecting commands of this package. % The \cs{fontspec} command selects a font for one-time use; all -% others should be used to define the standard fonts used in a document. -% They will be described later in this section. +% others should be used to define the standard fonts used in a document, as shown in \exref{fontload}. +% Here, the scales of the fonts have been chosen to equalise their +% lowercase letter heights. The \feat{Scale} font feature will be discussed +% further in \vref{sec:font-ind-features}, including methods for automatic +% scaling. +% +% \begin{Lexample}{fontload}{Loading the default, sans serif, and monospaced fonts.} +% \setmainfont{TeX Gyre Bonum} +% \setsansfont{Latin Modern Sans}[Scale=MatchLowercase] +% \setmonofont{Inconsolata}[Scale=MatchLowercase] +% +% \rmfamily Pack my box with five dozen liquor jugs\par +% \sffamily Pack my box with five dozen liquor jugs\par +% \ttfamily Pack my box with five dozen liquor jugs +% \end{Lexample} % % The font features argument accepts comma separated % \meta{font feature}=\meta{option} lists; these are described in later: @@ -291,7 +334,7 @@ This work consists of this file fontspec.dtx % % The simplest example might be something like % \begin{Verbatim} -% \fontspec[ ... ]{Cambria} +% \setmainfont{Cambria}[ ... ] % \end{Verbatim} % in which the bold and italic fonts will be found automatically % (if they exist) and are immediately accessible with the usual @@ -313,39 +356,31 @@ This work consists of this file fontspec.dtx % When selecting fonts by file name, any font that can be found in the default % search paths may be used directly (including in the current directory) % without having to explicitly define the location of the font file on disk. -% \begin{quote}\itshape -% \textbf{\XeTeX\ \& Mac users only:} -% Note that \XeTeX\ can only select fonts in this way with the |xdvipdfmx| driver, but \XeTeX\ with the |xdv2pdf| driver can only select system-installed fonts -% by font name and not file name. The |xdvipdfmx| driver is default for \XeTeX, so this is only a problem if you wish to explicitly use -% the |xdv2pdf| driver. -% \end{quote} +% % Fonts selected by filename must include bold and italic variants explicitly. % \begin{Verbatim} -% \fontspec -% [ BoldFont = texgyrepagella-bold.otf , +% \setmainfont{texgyrepagella-regular.otf}[ +% BoldFont = texgyrepagella-bold.otf , % ItalicFont = texgyrepagella-italic.otf , % BoldItalicFont = texgyrepagella-bolditalic.otf ] -% {texgyrepagella-regular.otf} % \end{Verbatim} % \pkg{fontspec} knows that the font is to be selected by file name by the % presence of the `|.otf|' extension. % An alternative is to specify the extension separately, as shown following: % \begin{Verbatim} -% \fontspec -% [ Extension = .otf , +% \setmainfont{texgyrepagella-regular}[ +% Extension = .otf , % BoldFont = texgyrepagella-bold , % ... ] -% {texgyrepagella-regular} % \end{Verbatim} % If desired, an abbreviation can be applied to the font names based on the % mandatory `font name' argument: % \begin{Verbatim} -% \fontspec -% [ Extension = .otf , +% \setmainfont{texgyrepagella}[ +% Extension = .otf , % UprightFont = *-regular , % BoldFont = *-bold , % ... ] -% {texgyrepagella} % \end{Verbatim} % In this case `texgyrepagella' is no longer the name of an actual font, % but is used to construct the font names for each shape; @@ -356,54 +391,26 @@ This work consists of this file fontspec.dtx % To load a font that is not in one of the default search paths, its location % in the filesystem must be specified with the |Path| feature: % \begin{Verbatim} -% \fontspec -% [ Path = /Users/will/Fonts/ , +% \setmainfont{texgyrepagella}[ +% Path = /Users/will/Fonts/ , % UprightFont = *-regular , % BoldFont = *-bold , % ... ] -% {texgyrepagella} % \end{Verbatim} % Note that \XeTeX\ and \LuaTeX\ are able to load the font without giving an % extension, but \pkg{fontspec} must know to search for the file; this can can % be indicated by declaring the font exists in an `|ExternalLocation|': % \begin{Verbatim} -% \fontspec -% [ ExternalLocation , +% \setmainfont{texgyrepagella-regular}[ +% ExternalLocation , % BoldFont = texgyrepagella-bold , % ... ] -% {texgyrepagella-regular} % \end{Verbatim} % To be honest, |Path| and |ExternalLocation| are actually the same feature % with different names. The former can be given without an argument and the % latter can be given with one; the different names are just for clarity. % % -% \section{Default font families} -% \label{sec:setxxfont} -% -% \cmdbox{ -% \cmd{\setmainfont} \oarg{font features} \marg{font name} \\ -% \cmd{\setsansfont} \oarg{font features} \marg{font name} \\ -% \cmd{\setmonofont} \oarg{font features} \marg{font name} -% } -% -% These commands are used to select -% the default font families for the entire document. They take the -% same arguments as \cmd{\fontspec}. See \exref{fontload}. -% Here, the scales of the fonts have been chosen to equalise their -% lowercase letter heights. The \feat{Scale} font feature will be discussed -% further in \vref{sec:font-ind-features}, including methods for automatic -% scaling. -% -% \begin{Lexample}{fontload}{Loading the default, sans serif, and monospaced fonts.} -% \setmainfont{TeX Gyre Bonum} -% \setsansfont[Scale=MatchLowercase]{Latin Modern Sans} -% \setmonofont[Scale=MatchLowercase]{Inconsolata} -% -% \rmfamily Pack my box with five dozen liquor jugs\par -% \sffamily Pack my box with five dozen liquor jugs\par -% \ttfamily Pack my box with five dozen liquor jugs -% \end{Lexample} % % % @@ -411,8 +418,8 @@ This work consists of this file fontspec.dtx % \section{New commands to select font families} % % \cmdbox{ -% \CMD{\string\newfontfamily} \cs{\meta{font-switch}} \oarg{font features} \marg{font name} \\ -% \CMD{\string\newfontface} \cs{\meta{font-switch}} \oarg{font features} \marg{font name} +% \CMD{\string\newfontfamily}\cs{\meta{font-switch}}\marg{font name}\oarg{font features} \\ +% \CMD{\string\newfontface}\cs{\meta{font-switch}}\marg{font name}\oarg{font features} % } % % \noindent For cases when a specific font with a specific @@ -449,9 +456,8 @@ This work consists of this file fontspec.dtx % in \exref{nfface}, which is repeated in \vref{sec:contextuals}. % % \begin{Xexample}{nfface}{Defining a single font face.} -% \newfontface\fancy +% \newfontface\fancy{Hoefler Text Italic}% % [Contextuals={WordInitial,WordFinal}] -% {Hoefler Text Italic} % \fancy where is all the vegemite % % \emph, \textbf, etc., all don't work % \end{Xexample} @@ -494,8 +500,8 @@ This work consists of this file fontspec.dtx % default from the \emph{new} font. See \exref{bff}. % % \begin{Xexample}{bff}{Explicit selection of the bold font.} -% \fontspec[BoldFont={Helvetica Neue}] -% {Helvetica Neue UltraLight} +% \fontspec{Helvetica Neue UltraLight}% +% [BoldFont={Helvetica Neue}] % Helvetica Neue UltraLight \\ % {\itshape Helvetica Neue UltraLight Italic} \\ % {\bfseries Helvetica Neue } \\ @@ -513,13 +519,12 @@ This work consists of this file fontspec.dtx % For example, % some space can be saved instead of writing `\texttt{Baskerville SemiBold}': % \begin{Verbatim} -% \fontspec[BoldFont={* SemiBold}]{Baskerville} +% \setmainfont{Baskerville}[BoldFont={* SemiBold}] % \end{Verbatim} % % As a matter of fact, this feature can also be used for the upright font too: % \begin{Verbatim} -% \fontspec[UprightFont={* SemiBold}, -% BoldFont={* Bold}]{Baskerville} +% \setmainfont{Baskerville}[UprightFont={* SemiBold},BoldFont={* Bold}] % \end{Verbatim} % % \subsubsection{Small caps and slanted font shapes} @@ -535,20 +540,20 @@ This work consists of this file fontspec.dtx % of glyphs allowed in the PostScript Type~1 format. Such fonts may be used % by declaring the \feat{SmallCapsFont} of the family you are specifying: % \begin{Verbatim} -% \fontspec[ +% \fontspec{Minion MM Roman}[ % SmallCapsFont={Minion MM Small Caps & Oldstyle Figures} -% ]{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[ +% \fontspec{ }[ % UprightFeatures = { SmallCapsFont={ } } , % BoldFeatures = { SmallCapsFont={ } } , % ItalicFeatures = { SmallCapsFont={ } } , % BoldItalicFeatures = { SmallCapsFont={ } } , -% ]{ } +% ] % Roman 123 \\ \textsc{Small caps 456} % \end{Verbatim} % @@ -560,13 +565,87 @@ This work consists of this file fontspec.dtx % font features from the main font. See \ref{sec:bfit-feat} for details. % When an OpenType font is selected for |SmallCapsFont|, the small caps % font feature is \emph{not} automatically enabled. In this case, users -% should write instead +% should write instead, if necessary, % \begin{Verbatim} -% \fontspec[ +% \fontspec{...}[ % SmallCapsFont={...}, % SmallCapsFeatures={Letters=SmallCaps}, -% ]{...} +% ] +% \end{Verbatim} +% +% \subsection{Specifically choosing the NFSS family} +% +% In \LaTeX's NFSS, font families are defined with names such as `\texttt{ppl}' (Palatino), `\texttt{cmr}' (Computer Modern Roman), and so on, which are selected with the \cs{fontfamily} command: +% \begin{Verbatim} +% \fontfamily{ppl}\selectfont % \end{Verbatim} +% In \pkg{fontspec}, the family names are auto-generated based on the fontname of the font; for example, writing |\fontspec{Times New Roman}| for the first time would generate an internal font family name of `\texttt{TimesNewRoman(1)}'. +% +% In certain cases it is desirable to be able to choose this internal font family name so it can be re-used elsewhere for interacting with other packages that use the \LaTeX's font selection interface; an example might be +% \begin{Verbatim} +% \usepackage{fancyvrb} +% \fvset{fontfamily=myverbatimfont} +% \end{Verbatim} +% To select a font for use in this way in \pkg{fontspec} use the \feat{NFSSFamily} feature:\footnote{Thanks to Luca Fascione for the example and motivation for finally implementing this feature.} +% \begin{Verbatim} +% \newfontfamily\verbatimfont[NFSSFamily=myverbatimfont]{Inconsolata} +% \end{Verbatim} +% It is then possible to write commands such as: +% \begin{Verbatim} +% \fontfamily{myverbatimfont}\selectfont +% \end{Verbatim} +% which is essentially the same as writing |\verbatimfont|, or to go back to the orginal example: +% \begin{Verbatim} +% \fvset{fontfamily=myverbatimfont} +% \end{Verbatim} +% Only use this feature when necessary; the in-built font switching commands that \pkg{fontspec} generates (such as |\verbatimfont| in the example above) are recommended in all other cases. +% +% If you don't wish to explicitly set the NFSS family but you would like to know what it is, an alternative mechanism for package writers is introduced as part of the \pkg{fontspec} programming interface; see the function \cs{fontspec_set_family:Nnn} for details (\vref*{sec:api}). +% +% \subsection{Choosing additional NFSS font faces} +% +% \LaTeX's font selection scheme is more flexible than the \pkg{fontspec} interface discussed up until this point. +% It assigns to each font face a \emph{family} (discussed above), a \emph{series} such as bold or light or condensed, and a \emph{shape} such as italic or slanted or small caps. +% The \pkg{fontspec} features such as \feat{BoldFont} and so on all assign faces for the default series and shapes of the NFSS, but it's not uncommon to have font families that have multiple weights and shapes and so on. +% +% If you set up a regular font family with the `standard four' (upright, bold, italic, and bold italic) shapes and then want to use, say, a light font for a certain document element, many users will be perfectly happy to use \cs{newfontface}\cs{\meta{switch}} and use the resulting font \cs{\meta{switch}}. +% In other cases, however, it is more convenient or even necessary to load additional fonts using additional NFSS specifiers. +% +% \cmdbox{ +% \texttt{FontFace = }\marg{series}\marg{shape} +% \texttt{\char`\{} \texttt{Font = }\meta{font name} \texttt, \meta{features} \texttt{\char`\}} \\ +% \texttt{FontFace = }\marg{series}\marg{shape}\marg{font name} +% } +% +% The font thus specified will inherit the font features of the main font, with optional addition \meta{features} as requested. +% (Note that the optional \marg{features} argument is still surrounded with curly braces.) +% Multiple \feat{FontFace} commands may be used in a single declaration to specify multiple fonts. +% As an example: +% \begin{Verbatim} +% \setmainfont{font1.otf}[ +% FontFace = {c}{n}{ font2.otf } , +% FontFace = {c}{m}{ Font = font3.otf , Color = red } +% ] +% \end{Verbatim} +% Writing |\fontseries{c}\selectfont| will result in |font2| being selected, which then followed by |\fontshape{m}\selectfont| will result in |font3| being selected (in red). +% A font face that is defined in terms of a different series but a normal shape will attempt to find a matching small caps feature and define that face as well if appropriate. +% Conversely, a font faced defined in terms of a different font will not. +% +% There are some standards for choosing shape and series codes; the \LaTeXe\ font selection guide\footnote{\texttt{texdoc fntguide}} lists series |m| for medium, |b| for bold, |bx| for bold extended, |sb| for semi-bold, and |c| for condensed. +% A far more comprehensive listing is included in Appendix~A of Philipp Lehman's `The Font Installation Guide'\footnote{\texttt{texdoc fontinstallationguide}} covering 14 separate weights and 12 separate widths. +% +% The \feat{FontFace} command also interacts properly with the \feat{SizeFeatures} command as follows: (nonsense set of font selection choices) +% \begin{Verbatim} +% FontFace = {c}{n}{ +% Font = Times , +% SizeFeatures = { +% { Size = -10 , Font=Georgia } , +% { Size = 10-15} , % default "Font = Times" +% { Size = 15- , Font=Cochin } , +% }, +% }, +% \end{Verbatim} +% Note that if the first \feat{Font} feature is omitted then each size needs its own inner \feat{Font} declaration. % % \subsection{Math(s) fonts} % @@ -594,10 +673,10 @@ This work consists of this file fontspec.dtx % others keep an eye out for problems. % % \cmdbox{ -% \cmd{\setmathrm} \oarg{font features} \marg{font name} \\ -% \cmd{\setmathsf} \oarg{font features} \marg{font name} \\ -% \cmd{\setmathtt} \oarg{font features} \marg{font name} \\ -% \cmd{\setboldmathrm} \oarg{font features} \marg{font name} +% \cmd{\setmathrm}\marg{font name}\oarg{font features} \\ +% \cmd{\setmathsf}\marg{font name}\oarg{font features} \\ +% \cmd{\setmathtt}\marg{font name}\oarg{font features} \\ +% \cmd{\setboldmathrm}\marg{font name}\oarg{font features} % } % % However, the default text fonts may not necessarily be the ones you @@ -621,8 +700,49 @@ This work consists of this file fontspec.dtx % \end{Verbatim} % % +% % \subsection{Miscellaneous font selecting details} % +% \paragraph{The optional argument --- from v2.4} +% For the first decade of \pkg{fontspec}'s life, optional font features were selected with a bracketed argument before the font name, as in: +% \begin{Verbatim} +% \setmainfont[ +% lots and lots , +% and more and more , +% an excessive number really , +% of font features could go here +% ]{myfont.otf} +% \end{Verbatim} +% This always looked like ugly syntax to me, and the order of these arguments has now been reversed: +% \begin{Verbatim} +% \setmainfont{myfont.otf}[ +% lots and lots , +% and more and more , +% an excessive number really , +% of font features could go here +% ] +% \end{Verbatim} +% I hope this doesn't cause any problems. +% \begin{enumerate} +% \item Backwards compatibility has been preserved. (In fact, you could even write +% \begin{Verbatim} +% \fontspec[Ligatures=Rare]{myfont.otf}[Color=red] +% \end{Verbatim} +% if you really felt like it and both sets of features would be applied.) +% +% \item +% Following standard \pkg{xparse} behaviour, there must be no space before the opening bracket; writing +% \begin{Verbatim*} +% \fontspec{myfont.otf} [Color=red] +% \end{Verbatim*} +% will result in |[Color=red]| not being recognised an argument and therefore it will be typeset as text. When breaking over lines, write either of: +% \begin{Verbatim} +% \fontspec{myfont.otf}% \fontspec{myfont.otf}[ +% [Color=red] Color=Red] +% \end{Verbatim} +% +% \end{enumerate} +% % \paragraph{Spaces} % \cmd\fontspec\ and \cmd\addfontfeatures\ ignore trailing spaces as % if it were a `naked' control sequence; \eg, `|M. \fontspec{...} N|' and @@ -640,7 +760,7 @@ This work consists of this file fontspec.dtx % Nested emphasis is controlled by the \cs{eminnershape} command. % For example, for |\emph{\emph{...}}| to produce small caps:\par % \indent|\renewcommand\eminnershape{\scshape}|\par\noindent -% +% This functionality is provided by the \pkg{fixltx2e} package, which is automatically loaded by \pkg{fontspec}. % % % @@ -656,13 +776,13 @@ This work consists of this file fontspec.dtx % % \subsection{Default settings} \label{sec:defaults} % -% \cmdbox{\cmd\defaultfontfeatures \marg{font features}} +% \cmdbox{\cmd\defaultfontfeatures\marg{font features}} % -% It is desirable to define -% options that are applied to every subsequent font selection command: -% a default feature set, so to speak. This may be defined with the +% It is sometimes useful to define +% font features that are applied to every subsequent font selection command. +% This may be defined with the % \cmd{\defaultfontfeatures} command, shown in \exref{dff}. -% New calls of \cs{defaultfontfeatures} overwrite previous ones. +% New calls of \cs{defaultfontfeatures} overwrite previous ones, and defaults can be reset by calling the command with an empty argument. % % \begin{Xexample}{dff}{A demonstration of the \cs{defaultfontfeatures} command.} % \fontspec{TeX Gyre Adventor} @@ -675,18 +795,43 @@ This work consists of this file fontspec.dtx % 0123456789 % \end{Xexample} % -% \cmdbox{\cmd\defaultfontfeatures \oarg{font name} \marg{font features}} +% \cmdbox{\cmd\defaultfontfeatures\oarg{font name}\marg{font features}} % -% \textbf{New in v2.3}. % Default font features can be specified on a per-font and per-face basis % by using the optional argument to \cs{defaultfontfeatures} as shown.\footnote{Internally, \meta{font name} has all spaces removed and is converted to lowercase.} % \begin{Verbatim} % \defaultfontfeatures[TeX Gyre Adventor]{Color=blue} % \setmainfont{TeX Gyre Adventor}% will be blue % \end{Verbatim} +% Multiple fonts may be affected by using a comma separated list of font names. % -% Additionally, when a font is first loaded, a configuration file is searched +% \cmdbox{\cmd\defaultfontfeatures\oarg{\cs{font-switch}}\marg{font features}} +% +% \textbf{New in v2.4}. +% Defaults can also be applied to symbolic families such as those created with the |\newfontfamily| command and for |\rmfamily|, |\sffamily|, and |\ttfamily|: +% \begin{Verbatim} +% \defaultfontfeatures[\rmfamily,\sffamily]{Ligatures=TeX} +% \setmainfont{TeX Gyre Adventor}% will use standard TeX ligatures +% \end{Verbatim} +% The line above to set \TeX-like ligatures is now activated by \emph{default} in \texttt{fontspec.cfg}. +% To reset default font features, simply call the command with an empty argument: +% \begin{Verbatim} +% \defaultfontfeatures[\rmfamily,\sffamily]{} +% \setmainfont{TeX Gyre Adventor}% will no longer use standard TeX ligatures +% \end{Verbatim} +% +% \cmdbox{\cmd\defaultfontfeatures\texttt{+}\marg{font features}\\ +% \cmd\defaultfontfeatures\texttt{+}\oarg{font name}\marg{font features}} +% +% \textbf{New in v2.4}. +% Using the |+| form of the command appends the \meta{font features} to any already-selected defaults. +% +% +% \subsection{Default settings from a file} +% +% In addition to the defaults that may be specified in the document as described above, when a font is first loaded, a configuration file is searched % for with the name `\meta{fontname}\texttt{.fontspec}'.\footnote{Located in the current folder or within a standard \texttt{texmf} location.} +% % The contents of this file can be used to specify default font features without % having to have this information present within each document. % \meta{fontname} is stripped of spaces and file extensions are omitted; for @@ -723,7 +868,7 @@ This work consists of this file fontspec.dtx % \subsection{Changing the currently selected features} % \label{sec:addfontfeatures} % -% \cmdbox{\cmd\addfontfeatures \marg{font features}} +% \cmdbox{\cmd\addfontfeatures\marg{font features}} % % This command allows font features to % be changed without knowing what features are currently selected or even what @@ -740,8 +885,8 @@ This work consists of this file fontspec.dtx % In the distant future this functionality will be re-written to avoid this issue (giving `\verb|Numbers=OldStyle|' the smarts to know to explicitly de-activate any previous instances of `\verb|Numbers=Lining|', and vice-versa, but as I hope you can imagine this requires a fair degree of elbow grease which I haven't had available for some time now. % % \begin{Lexample}{aff}{A demonstration of the \cs{addfontfeatures} command. Note the caveat listed in the text regarding such usage.} -% \fontspec[Numbers={Proportional,OldStyle}] -% {TeX Gyre Adventor} +% \fontspec{TeX Gyre Adventor}% +% [Numbers={Proportional,OldStyle}] % `In 1842, 999 people sailed 97 miles in % 13 boats. In 1923, 111 people sailed 54 % miles in 56 boats.' \bigskip @@ -769,12 +914,12 @@ This work consists of this file fontspec.dtx % \label{sec:bfit-feat} % % \cmdbox{ -% \feat{BoldFeatures}\marg{features} \\ -% \feat{ItalicFeatures}\marg{features} \\ -% \feat{BoldItalicFeatures}\marg{features} \\ -% \feat{SlantedFeatures}\marg{features} \\ -% \feat{BoldSlantedFeatures}\marg{features} \\ -% \feat{SmallCapsFeatures}\marg{features} +% \feat{BoldFeatures}\texttt=\marg{features} \\ +% \feat{ItalicFeatures}\texttt=\marg{features} \\ +% \feat{BoldItalicFeatures}\texttt=\marg{features} \\ +% \feat{SlantedFeatures}\texttt=\marg{features} \\ +% \feat{BoldSlantedFeatures}\texttt=\marg{features} \\ +% \feat{SmallCapsFeatures}\texttt=\marg{features} % } % % It is entirely possible that separate fonts in a family will require @@ -815,7 +960,7 @@ This work consists of this file fontspec.dtx % % \begin{Xexample}{scfeat}{An example of setting the \feat{SmallCapsFeatures} % separately for each font shape.} -% \fontspec[ +% \fontspec{TeX Gyre Termes}[ % UprightFeatures={Color = 220022, % SmallCapsFeatures = {Color=115511}}, % ItalicFeatures={Color = 2244FF, @@ -824,7 +969,7 @@ This work consists of this file fontspec.dtx % 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}\\ @@ -865,10 +1010,11 @@ This work consists of this file fontspec.dtx % in \vref{sec:opticalsize}. % % \begin{Xexample}{sizefeat}{An example of specifying different font features for different sizes of font with \feat{SizeFeatures}.} -% \fontspec[ SizeFeatures={ +% \fontspec{TeX Gyre Chorus}[ +% SizeFeatures={ % {Size={-8}, Font=TeX Gyre Bonum Italic, Color=AA0000}, % {Size={8-14}, Color=00AA00}, -% {Size={14-}, Color=0000AA}} ]{TeX Gyre Chorus} +% {Size={14-}, Color=0000AA}} ] % % {\scriptsize Small\par} Normal size\par {\Large Large\par} % \end{Xexample} @@ -888,7 +1034,7 @@ This work consists of this file fontspec.dtx % {Size=-10,Numbers=Uppercase}, % {Size=10-}} % \end{Verbatim} -% Otherwise, the font sizes greater than 10 won't be defined! +% Otherwise, the font sizes greater than 10 won't be defined at all! % % \begin{table} % \caption{Syntax for specifying the size to apply custom font features.}\label{tab:sizing} @@ -905,6 +1051,25 @@ This work consists of this file fontspec.dtx % \end{tabular} % \end{table} % +% \paragraph{Interaction with other features} +% For \feat{SizeFeatures} to work with \feat{ItalicFeatures}, \feat{BoldFeatures}, etc., and \feat{SmallCapsFeatures}, a strict heirarchy is required: +% \begin{Verbatim} +% UprightFeatures = +% { +% SizeFeatures = +% { +% { +% Size = -10, +% Font = ..., % if necessary +% SmallCapsFeatures = {...}, +% ... % other features for this size range +% }, +% ... % other size ranges +% } +% } +% \end{Verbatim} +% Suggestions on simplifying this interface welcome. +% % % \section{Font independent options} \label{sec:font-ind-features} % @@ -925,8 +1090,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} -% driver (\MacOSX\ only); \XeLaTeX\ with the \texttt{xdvipdfmx} driver +% Transparency is supported by \LuaLaTeX; \XeLaTeX\ with the \texttt{xdvipdfmx} driver % does not support this feature. % % If you load the \pkg{xcolor} package, you may use any named colour instead @@ -959,7 +1123,7 @@ This work consists of this file fontspec.dtx % % In its explicit form, \feat{Scale} takes a single % numeric argument for linearly scaling the font, as demonstrated -% in \vref{sec:setxxfont}. +% in \exref{fontload}. % It is now possible to % measure the correct dimensions of the fonts loaded and % calculate values to scale them automatically. @@ -982,6 +1146,14 @@ This work consists of this file fontspec.dtx % Since there is some subjectivity about the exact scaling to be used, these values % should be used to fine-tune the results. % +% Note that when |Scale=MatchLowercase| is used with |\setmainfont|, the new `main' font of the document will be scaled to match the old default. +% This may be undesirable in some cases, so to achieve `natural' scaling for the main font but automatically scale all other fonts selected, you may write +% \begin{Verbatim} +% \defaultfontfeatures{ Scale = MatchLowercase } +% \defaultfontfeatures[\rmfamily]{ Scale = 1} +% \end{Verbatim} +% One or both of these lines may be placed into a local |fontspec.cfg| file (see \vref{sec:config}) for this behaviour to be effected in your own documents automatically. +% (Also see \vref{sec:defaults} for more information on setting font defaults.) % % % @@ -1036,9 +1208,9 @@ This work consists of this file fontspec.dtx % \nonfrenchspacing % \fontspec{TeX Gyre Schola} % Letters, Words. Sentences. \par -% \fontspec[PunctuationSpace=2]{TeX Gyre Schola} +% \fontspec{TeX Gyre Schola}[PunctuationSpace=2] % Letters, Words. Sentences. \par -% \fontspec[PunctuationSpace=0]{TeX Gyre Schola} +% \fontspec{TeX Gyre Schola}[PunctuationSpace=0] % Letters, Words. Sentences. % \end{Lexample} % @@ -1101,13 +1273,13 @@ This work consists of this file fontspec.dtx % \end{Xexample} % % \begin{Xexample}{optsize0}{Optical size substitution is suppressed when set to zero.} -% \fontspec[OpticalSize=0]{Latin Modern Roman 5 Regular} +% \fontspec{Latin Modern Roman 5 Regular}[OpticalSize=0] % Latin Modern optical sizes \\ -% \fontspec[OpticalSize=0]{Latin Modern Roman 8 Regular} +% \fontspec{Latin Modern Roman 8 Regular}[OpticalSize=0] % Latin Modern optical sizes \\ -% \fontspec[OpticalSize=0]{Latin Modern Roman 12 Regular} +% \fontspec{Latin Modern Roman 12 Regular}[OpticalSize=0] % Latin Modern optical sizes \\ -% \fontspec[OpticalSize=0]{Latin Modern Roman 17 Regular} +% \fontspec{Latin Modern Roman 17 Regular}[OpticalSize=0] % Latin Modern optical sizes % \end{Xexample} % @@ -1115,13 +1287,13 @@ This work consists of this file fontspec.dtx % used to specify exactly which optical sizes will be used for ranges % of font size. For example, something like: % \begin{Verbatim} -% \fontspec[ -% SizeFeatures={ +% \fontspec{Latin Modern Roman}[ +% UprightFeatures = { SizeFeatures = { % {Size=-10, OpticalSize=8 }, % {Size= 10-14, OpticalSize=10}, % {Size= 14-18, OpticalSize=14}, -% {Size= 18-, OpticalSize=18}} -% ]{Latin Modern Roman} +% {Size= 18-, OpticalSize=18}}} +% ] % \end{Verbatim} % % \part{OpenType} @@ -1196,7 +1368,7 @@ This work consists of this file fontspec.dtx % \Huge\centering % \def\test#1#2{% % #2 $\to$ {\addfontfeature{#1} #2}\\} -% \fontspec{Linux Libertine} +% \fontspec{Linux Libertine O} % \test{Ligatures=Historic}{strict} % \test{Ligatures=Rare}{wurtzite} % \test{Ligatures=NoCommon}{firefly} @@ -1229,9 +1401,9 @@ This work consists of this file fontspec.dtx % `Unicase' is a weird hybrid of upper and lower case letters. % % \begin{Lexample}{caps}{Small caps from lowercase or uppercase letters.} -% \fontspec[Letters=SmallCaps]{TeX Gyre Adventor} +% \fontspec{TeX Gyre Adventor}[Letters=SmallCaps] % THIS SENTENCE no verb \\ -% \fontspec[Letters=UppercaseSmallCaps]{TeX Gyre Adventor} +% \fontspec{TeX Gyre Adventor}[Letters=UppercaseSmallCaps] % THIS SENTENCE no verb % \end{Lexample} % @@ -1296,8 +1468,8 @@ This work consists of this file fontspec.dtx % % \begin{Lexample}[firstline=2]{num-arab}{An example of number remapping to Arabic or Persian. (\LuaTeX\ only.)} % \huge -% \fontspec[Script=Arabic,Numbers=Arabic] -% {persian-modern-regular.ttf} +% \fontspec{persian-modern-regular.ttf}% +% [Script=Arabic,Numbers=Arabic] % {\addfontfeature{Language=Arabic} % 0123456789} \\ % {\addfontfeature{Language=Parsi} @@ -1321,7 +1493,7 @@ This work consists of this file fontspec.dtx % \begin{Lexample}{swash}{An example of the \opt{Swashes} option of the \opt{Contextuals} feature.} % \fontspec{Warnock Pro} \itshape % Without Contextual Swashes \\ -% \fontspec[Contextuals=Swash]{Warnock Pro} +% \fontspec{Warnock Pro}[Contextuals=Swash] % With Contextual Swashes; cf. W C S % \end{Lexample} % @@ -1353,15 +1525,15 @@ This work consists of this file fontspec.dtx % arbitrary fractions (see next section). % % \begin{Lexample}{vertpos}{The \feat{VerticalPosition} feature. Note that the \opt{Ordinal} option can be quite unreliable, as the results here demonstrate.} -% \fontspec[VerticalPosition=Superior]{Warnock Pro} +% \fontspec{Warnock Pro}[VerticalPosition=Superior] % Sup: abdehilmnorst (-\$12,345.67) \\ -% \fontspec[VerticalPosition=Numerator]{Warnock Pro} +% \fontspec{Warnock Pro}[VerticalPosition=Numerator] % Numerator: 12345 \\ -% \fontspec[VerticalPosition=Denominator]{Warnock Pro} +% \fontspec{Warnock Pro}[VerticalPosition=Denominator] % Denominator: 12345 \\ -% \fontspec[VerticalPosition=ScientificInferior]{Warnock Pro} +% \fontspec{Warnock Pro}[VerticalPosition=ScientificInferior] % Scientific Inferior: 12345 \\ -% \fontspec[VerticalPosition=Ordinal]{Warnock Pro} +% \fontspec{Warnock Pro}[VerticalPosition=Ordinal] % `Ordinals': 1st 2nd 3rd 4th 0th % \end{Lexample} % @@ -1451,19 +1623,19 @@ This work consists of this file fontspec.dtx % \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 +% \fontspec{EB Garamond Italic}[CharacterVariant=5] very \\ +% \fontspec{EB Garamond Italic}[CharacterVariant=5:0] very \\ +% \fontspec{EB Garamond Italic}[CharacterVariant=5:1] very \\ +% \fontspec{EB Garamond Italic}[CharacterVariant=5:2] very \\ +% \fontspec{EB Garamond Italic}[CharacterVariant=5:3] 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 +% \fontspec{EB Garamond Italic}[CharacterVariant={4}] \& violet \\ +% \fontspec{EB Garamond Italic}[CharacterVariant={5:2}] \& violet \\ +% \fontspec{EB Garamond Italic}[CharacterVariant={4,5:2}] \& violet % \end{Lexample} % % \subsection{Alternates} @@ -1605,13 +1777,13 @@ This work consists of this file fontspec.dtx % % \begin{Xexample}{fake}{Articifial font transformations.} % \fontspec{Charis SIL} \emph{ABCxyz} \quad -% \fontspec[FakeSlant=0.2]{Charis SIL} ABCxyz +% \fontspec{Charis SIL}[FakeSlant=0.2] ABCxyz % % \fontspec{Charis SIL} ABCxyz \quad -% \fontspec[FakeStretch=1.2]{Charis SIL} ABCxyz +% \fontspec{Charis SIL}[FakeStretch=1.2] ABCxyz % % \fontspec{Charis SIL} \textbf{ABCxyz} \quad -% \fontspec[FakeBold=1.5]{Charis SIL} ABCxyz +% \fontspec{Charis SIL}[FakeBold=1.5] ABCxyz % \end{Xexample} % % If values are omitted, their defaults are as shown above. @@ -1753,7 +1925,7 @@ This work consists of this file fontspec.dtx % Because these font features can % change which features are able to be selected for the font, they are automatically selected % by \pkg{fontspec} before all others and, if \XeTeX\ is being used, will -% specifically select the \opt{ICU} +% specifically select the \opt{OpenType} % renderer for this font, as described in \vref{sec:renderer}. % % @@ -1945,7 +2117,7 @@ This work consists of this file fontspec.dtx % \feat{Mapping} enables a \XeTeX\ text-mapping scheme, shown in \exref{mapping}. % % \begin{Xexample}{mapping}{\XeTeX's \feat{Mapping} feature.} -% \fontspec[Mapping=tex-text]{Cochin} +% \fontspec{Cochin}[Mapping=tex-text] % ``!`A small amount of---text!'' % \end{Xexample} % @@ -1972,27 +2144,30 @@ This work consists of this file fontspec.dtx % Also see the OpenType \opt{Uppercase} % option of the \feat{Letters} feature (\vref*{sec:letters}). % -% \subsection{Different font technologies: \AAT\ and \ICU}\label{sec:renderer} +% \subsection{Different font technologies: \AAT\ and OpenType}\label{sec:renderer} % % \XeTeX\ supports two rendering technologies for typesetting, selected with % the \feat{Renderer} font feature. The first, \opt{AAT}, is -% that provided (only) by \MacOSX\ itself. The second, \opt{ICU}, -% is an open source OpenType interpreter. It provides much greater support for +% that provided (only) by \MacOSX\ itself. The second, \opt{OpenType}, +% is an open source OpenType interpreter. +% \note{v2.4: This was called `\texttt{ICU}' in previous versions of \XeTeX\ and \pkg{fontspec}. +% Backwards compatibility is preserved.} +% It provides greater support for % OpenType features, notably contextual arrangement, over \opt{AAT}. % % In general, this feature will not need to be explicitly called: for OpenType -% fonts, the \opt{ICU} renderer is used automatically, and for \AAT\ fonts, +% fonts, the \opt{OpenType} renderer is used automatically, and for \AAT\ fonts, % \opt{AAT} is chosen by default. Some fonts, however, will contain font tables % for \emph{both} rendering technologies, such as the Hiragino Japanese fonts % distributed with \MacOSX, and in these cases the choice may be required. % % Among some other font features only available through a specific renderer, -% \opt{ICU} provides for the \feat{Script} and \feat{Language} features, which allow +% \opt{OpenType} provides for the \feat{Script} and \feat{Language} features, which allow % different font behaviour for different alphabets and languages; see \vref{sec:ot} % for the description of these features. {\em Because these font features can % change which features are able to be selected for the font instance, they are selected % by \pkg{fontspec} before all others and will automatically and without warning -% select the \opt{ICU} renderer.} +% select the \opt{OpenType} renderer.} % % % \subsection{Optical font sizes} \label{sec:aat-opticalsize} @@ -2007,11 +2182,11 @@ This work consists of this file fontspec.dtx % optical size for a Multiple Master font must always be specified % explicitly. % \begin{Verbatim} -% \fontspec[OpticalSize=11]{Minion MM Roman} +% \fontspec{Minion MM Roman}[OpticalSize=11] % MM optical size test \\ -% \fontspec[OpticalSize=47]{Minion MM Roman} +% \fontspec{Minion MM Roman}[OpticalSize=47] % MM optical size test \\ -% \fontspec[OpticalSize=71]{Minion MM Roman} +% \fontspec{Minion MM Roman}[OpticalSize=71] % MM optical size test \\ % \end{Verbatim} % @@ -2035,15 +2210,7 @@ This work consists of this file fontspec.dtx % Nonetheless, this is the font format that was first supported by \XeTeX\ % (due to its pedigree on \MacOSX\ in the first place) and was the first % font format supported by \pkg{fontspec}. A number of fonts distributed with -% \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} -% xelatex -output-driver="xdv2pdf" filename.tex -% \end{Verbatim} -% -% \MacOSX\ also supports Multiple Master fonts, which are discussed -% in \ref{sec:mm}. +% \MacOSX\ are still in the \AAT\ format, such as `Skia'. % % \subsection{Ligatures} % @@ -2085,14 +2252,13 @@ This work consists of this file fontspec.dtx % by prefixing their name with \opt{No}. % % \begin{Xexample}{wordcx}{Contextual glyph for the beginnings and ends of words.} -% \newfontface\fancy +% \newfontface\fancy{Hoefler Text Italic} % [Contextuals={WordInitial,WordFinal}] -% {Hoefler Text Italic} % \fancy where is all the vegemite % \end{Xexample} % % \begin{Xexample}{longsaat}{A contextual feature for the `long s' can be convenient as the character does not need to be marked up explicitly.} -% \fontspec[Contextuals=Inner]{Hoefler Text} +% \fontspec{Hoefler Text}[Contextuals=Inner] % `Inner' swashes can \emph{sometimes} \\ % contain the archaic long~s. % \end{Xexample} @@ -2111,11 +2277,11 @@ This work consists of this file fontspec.dtx % \begin{Xexample}{aat-supp}{Vertical position for AAT fonts.} % \fontspec{Skia} % Normal -% \fontspec[VerticalPosition=Superior]{Skia} +% \fontspec{Skia}[VerticalPosition=Superior] % Superior -% \fontspec[VerticalPosition=Inferior]{Skia} +% \fontspec{Skia}[VerticalPosition=Inferior] % Inferior \\ -% \fontspec[VerticalPosition=Ordinal]{Skia} +% \fontspec{Skia}[VerticalPosition=Ordinal] % 1st 2nd 3rd 4th 0th 8abcde % \end{Xexample} % @@ -2194,9 +2360,9 @@ This work consists of this file fontspec.dtx % which should be done on a per-font basis. % % \begin{Xexample}{aat-alt}{Alternate shape selection must be numerical.} -% \fontspec[Alternate=0]{Hoefler Text Italic} +% \fontspec{Hoefler Text Italic}[Alternate=0] % Sphinx Of Black Quartz, {\scshape Judge My Vow} \\ -% \fontspec[Alternate=1]{Hoefler Text Italic} +% \fontspec{Hoefler Text Italic}[Alternate=1] % Sphinx Of Black Quartz, {\scshape Judge My Vow} % \end{Xexample} % @@ -2251,7 +2417,7 @@ This work consists of this file fontspec.dtx % \fontspec{Hiragino Mincho Pro} % \verttext % -% \fontspec[Renderer=AAT,Vertical=RotatedGlyphs]{Hiragino Mincho Pro} +% \fontspec{Hiragino Mincho Pro}[Renderer=AAT,Vertical=RotatedGlyphs] % \rotatebox{-90}{\verttext}% requires the graphicx package % \end{Xexample} % @@ -2293,37 +2459,14 @@ This work consists of this file fontspec.dtx % \begin{Xexample}{aat-annot}{Various annotation forms.} % \fontspec{Hei Regular} % 1 2 3 4 5 6 7 8 9 \\ -% \fontspec[Annotation=Circle]{Hei Regular} +% \fontspec{Hei Regular}[Annotation=Circle] % 1 2 3 4 5 6 7 8 9 \\ -% \fontspec[Annotation=Parenthesis]{Hei Regular} +% \fontspec{Hei Regular}[Annotation=Parenthesis] % 1 2 3 4 5 6 7 8 9 \\ -% \fontspec[Annotation=Period]{Hei Regular} +% \fontspec{Hei Regular}[Annotation=Period] % 1 2 3 4 5 6 7 8 9 % \end{Xexample} % -% \section{\AAT\ \& Multiple Master font axes} \label{sec:mm} -% -% Multiple Master and \AAT\ font specifications both provide continuous -% 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 -% Mac~OS~X, has two of these variable parameters, allowing for the -% demonstration in \exref{aatmm}. -% Variations along a multiple master font's optical size axis has been -% shown previously in \vref{sec:opticalsize}. -% -% \begin{Xexample}{aatmm}{Continuously variable font parameters. These fonts -% are unfortunately quite rare.} -% \fontspec[Weight=0.5,Width=3]{Skia} -% Really light and extended Skia \\ -% \fontspec[Weight=2,Width=0.5]{Skia} -% Really fat and condensed Skia -% \end{Xexample} % % % \part{Programming interface} @@ -2347,16 +2490,15 @@ This work consists of this file fontspec.dtx % % \begin{Xexample}{newAATfeat}{Assigning new \AAT\ features.} % \newAATfeature{Alternate}{HoeflerSwash}{17}{1} -% \fontspec[Alternate=HoeflerSwash]{Hoefler Text Italic} +% \fontspec{Hoefler Text Italic}[Alternate=HoeflerSwash] % This is XeTeX by Jonathan Kew. % \end{Xexample} % % -% \DescribeMacro{\newICUfeature} % \DescribeMacro{\newopentypefeature} % New OpenType features may be created with this command:\par -% {\centering\cmd\newICUfeature\marg{feature}\marg{option}\marg{feature tag}\par} -% The synonym \cs{newopentypefeature} is provided for \LuaLaTeX\ users. +% {\centering\cmd\newopentypefeature\marg{feature}\marg{option}\marg{feature tag}\par} +% The synonym \cs{newICUfeature} is deprecated. % % Here's what it would look like in practise: % \begin{Verbatim} @@ -2372,18 +2514,19 @@ This work consists of this file fontspec.dtx % % For example, Zapfino % contains the feature `Avoid d-collisions'. To access it -% with this package, you could do some like that shown in \exref{avoidd} +% with this package, you could do some like that shown in \exref{avoidd}. +% (For some reason this feature doesn't appear to be working although \pkg{fontspec} is doing the right thing. To be investigated.) % % \begin{Xexample}{avoidd}{Assigning new arbitary features.} % \newfontfeature{AvoidD}{Special=Avoid d-collisions} % \newfontfeature{NoAvoidD}{Special=!Avoid d-collisions} -% \fontspec[AvoidD,Variant=1]{Zapfino} +% \fontspec{Zapfino}[AvoidD,Variant=1] % sockdolager rubdown \\ -% \fontspec[NoAvoidD,Variant=1]{Zapfino} +% \fontspec{Zapfino}[NoAvoidD,Variant=1] % sockdolager rubdown % \end{Xexample} % -% The advantage to using the \cmd\newAATfeature\ and \cmd\newICUfeature\ +% The advantage to using the \cmd\newAATfeature\ and \cmd\newopentypefeature\ % commands instead of \cs{newfontfeature} is that they check if the selected font actually contains the desired font % feature at load time. By contrast, \cmd\newfontfeature\ will not give a warning % for improper input. @@ -2395,7 +2538,7 @@ This work consists of this file fontspec.dtx % when you happen to have the OpenType feature tag memorised. % % \begin{Xexample}{raw}{Using raw font features directly.} -% \fontspec[RawFeature=+smcp]{TeX Gyre Pagella} +% \fontspec{texgyrepagella-regular.otf}[RawFeature=+smcp] % Pagella small caps % \end{Xexample} % @@ -2415,7 +2558,7 @@ This work consists of this file fontspec.dtx % % \begin{Xexample}{alias}{Renaming font features.} % \aliasfontfeature{ItalicFeatures}{IF} -% \fontspec[IF = {Alternate=1}]{Hoefler Text} +% \fontspec{Hoefler Text}[IF = {Alternate=1}] % Roman Letters \itshape And Swash % \end{Xexample} % @@ -2430,7 +2573,7 @@ This work consists of this file fontspec.dtx % \begin{Lexample}{aliasopt}{Renaming font feature options.} % \aliasfontfeature{VerticalPosition}{Vert Pos} % \aliasfontfeatureoption{VerticalPosition}{ScientificInferior}{Sci Inf} -% \fontspec[Vert Pos=Sci Inf]{Linux Libertine} +% \fontspec{LinLibertine_R.otf}[Vert Pos=Sci Inf] % Scientific Inferior: 12345 % \end{Lexample} % @@ -2450,6 +2593,7 @@ This work consists of this file fontspec.dtx % implemented. But you get the idea. % % \section{Programming details} +% \label{sec:api} % % 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 @@ -2460,7 +2604,7 @@ This work consists of this file fontspec.dtx % in \cmd{\l_fontspec_font}. % % The following commands in \pkg{expl3} syntax may be used -% for writing codes that interface with fontspec-loaded fonts. +% for writing code that interfaces with fontspec-loaded fonts. % All of the following conditionals also exist with |T| and |F| % as well as |TF| suffixes. % @@ -2575,7 +2719,7 @@ This work consists of this file fontspec.dtx % \section{Verbatim} % \label{sec:verb} % -% Many verbatim mechanisms assume the existence of a `visible space' character that exists in the \textsc{ascii} space slot of the typewriter font. This character is known in Unicode as \unichar{2434}{box open}, which looks like this: `\verb*| |'. +% Many verbatim mechanisms assume the existence of a `visible space' character that exists in the \textsc{ascii} space slot of the typewriter font. This character is known in Unicode as \unichar{2423}{box open}, which looks like this: `\verb*| |'. % % When a Unicode typewriter font is used, \LaTeX\ no longer prints visible spaces for the |verbatim*| environment and |\verb*| command. This problem is fixed by using the correct Unicode glyph, and the following packages are patched to do the same: % \pkg{listings}, \pkg{fancyvrb}, \pkg{moreverb}, and \pkg{verbatim}. @@ -2662,30 +2806,35 @@ This work consists of this file fontspec.dtx % % \subsection{Bits and pieces} % \paragraph{Conditionals} +% \subparagraph{firsttime} 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 (initialised true). % \begin{macrocode} -\bool_new:N \l_fontspec_firsttime_bool -\bool_new:N \l_fontspec_nobf_bool -\bool_new:N \l_fontspec_noit_bool -\bool_new:N \l_fontspec_nosc_bool +\bool_new:N \l_@@_firsttime_bool +\bool_new:N \l_@@_nobf_bool +\bool_new:N \l_@@_noit_bool +\bool_new:N \l_@@_nosc_bool % \end{macrocode} % % \begin{macrocode} -\bool_new:N \l_fontspec_tfm_bool -\bool_new:N \l_fontspec_atsui_bool -\bool_new:N \l_fontspec_icu_bool -\bool_new:N \l_fontspec_mm_bool -\bool_new:N \l_fontspec_graphite_bool +\bool_new:N \l_@@_tfm_bool +\bool_new:N \l_@@_atsui_bool +\bool_new:N \l_@@_ot_bool +\bool_new:N \l_@@_mm_bool +\bool_new:N \l_@@_graphite_bool % \end{macrocode} % For dealing with legacy maths % \begin{macrocode} -\bool_new:N \g_fontspec_math_euler_bool -\bool_new:N \g_fontspec_math_lucida_bool -\bool_new:N \g_fontspec_package_euler_loaded_bool +\bool_new:N \g_@@_math_euler_bool +\bool_new:N \g_@@_math_lucida_bool +\bool_new:N \g_@@_pkg_euler_loaded_bool % \end{macrocode} % For package options: % \begin{macrocode} -\bool_new:N \g_fontspec_cfg_bool -\bool_new:N \g_fontspec_math_bool +\bool_new:N \g_@@_cfg_bool +\bool_new:N \g_@@_math_bool % \end{macrocode} % \paragraph{Counters} % \begin{macrocode} @@ -2695,11 +2844,11 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \paragraph{Other variables} % \begin{macrocode} -\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 +\fp_new:N \l_@@_tmpa_fp +\fp_new:N \l_@@_tmpb_fp +\dim_new:N \l_@@_tmpa_dim +\dim_new:N \l_@@_tmpb_dim +\dim_new:N \l_@@_tmpc_dim % \end{macrocode} % % \begin{macrocode} @@ -2717,12 +2866,12 @@ This work consists of this file fontspec.dtx \cs_generate_variant:Nn \keys_set_known:nnN {nx} % \end{macrocode} % -% \begin{macro}{\_int_mult_truncate:Nn} +% \begin{macro}{\@@_int_mult_truncate:Nn} % Missing in expl3, IMO. % \begin{macrocode} -\cs_new:Nn \_int_mult_truncate:Nn +\cs_new:Nn \@@_int_mult_truncate:Nn { - \int_set:Nn #1 { \dim_eval:w #2 #1 \dim_eval_end: } + \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: } } % \end{macrocode} % \end{macro} @@ -2732,15 +2881,15 @@ This work consists of this file fontspec.dtx % % Shorthands for messages: % \begin{macrocode} -\cs_new:Npn \fontspec_error:n { \msg_error:nn {fontspec} } -\cs_new:Npn \fontspec_error:nx { \msg_error:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:n { \msg_warning:nn {fontspec} } -\cs_new:Npn \fontspec_warning:nx { \msg_warning:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } -\cs_new:Npn \fontspec_info:n { \msg_info:nn {fontspec} } -\cs_new:Npn \fontspec_info:nx { \msg_info:nnx {fontspec} } -\cs_new:Npn \fontspec_info:nxx { \msg_info:nnxx {fontspec} } -\cs_new:Npn \fontspec_trace:n { \msg_trace:nn {fontspec} } +\cs_new:Npn \@@_error:n { \msg_error:nn {fontspec} } +\cs_new:Npn \@@_error:nx { \msg_error:nnx {fontspec} } +\cs_new:Npn \@@_warning:n { \msg_warning:nn {fontspec} } +\cs_new:Npn \@@_warning:nx { \msg_warning:nnx {fontspec} } +\cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx {fontspec} } +\cs_new:Npn \@@_info:n { \msg_info:nn {fontspec} } +\cs_new:Npn \@@_info:nx { \msg_info:nnx {fontspec} } +\cs_new:Npn \@@_info:nxx { \msg_info:nnxx {fontspec} } +\cs_new:Npn \@@_trace:n { \msg_trace:nn {fontspec} } % \end{macrocode} % % Errors: @@ -2830,13 +2979,13 @@ This work consists of this file fontspec.dtx \msg_new:nnn {fontspec} {icu-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~ - for~ ICU~ font~ '\l_fontspec_fontname_tl' + for~ OpenType~ font~ '\l_fontspec_fontname_tl' } \msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} { 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'. + with~ script~ '\l_@@_script_name_tl'~ and~ language~ '\l_@@_lang_name_tl'. } \msg_new:nnn {fontspec} {no-opticals} { @@ -2846,7 +2995,7 @@ This work consists of this file fontspec.dtx { Language~ '#1'~ not~ available~ for~ font~ '\l_fontspec_fontname_tl'~ - with~ script~ '\l_fontspec_script_name_tl'.\\ + with~ script~ '\l_@@_script_name_tl'.\\ 'Default'~ language~ used~ instead. } \msg_new:nnn {fontspec} {only-xetex-feature} @@ -2881,7 +3030,7 @@ This work consists of this file fontspec.dtx \msg_new:nnn {fontspec} {defining-font} { Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~ - with~ options~ [\g_fontspec_default_fontopts_tl #1].\\ + with~ options~ [\l_@@_all_features_clist].\\ \\ This~ font~ family~ consists~ of~ the~ following~ shapes: \l_fontspec_defined_shapes_tl @@ -2892,7 +3041,7 @@ This work consists of this file fontspec.dtx } \msg_new:nnn {fontspec} {set-scale} { - \l_fontspec_fontname_tl\space scale ~=~ \l_fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale ~=~ \l_@@_scale_tl. } \msg_new:nnn {fontspec} {setup-math} { @@ -2926,11 +3075,11 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \DeclareOption{cm-default} - { \fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool} -\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool} -\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool} -\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool} + { \@@_warning:n {cm-default-obsolete} } +\DeclareOption{math}{\bool_set_true:N \g_@@_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g_@@_math_bool} +\DeclareOption{config}{\bool_set_true:N \g_@@_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g_@@_cfg_bool} \DeclareOption{quiet} { \msg_redirect_module:nnn { fontspec } { warning } { info } @@ -2989,7 +3138,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl -\tl_put_right:Nn \document +\AtBeginDocument { \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl @@ -3026,10 +3175,10 @@ This work consists of this file fontspec.dtx % font name and the optional requested features of that % font. Then this new font family is selected. % \begin{macrocode} -\DeclareDocumentCommand \fontspec { O{} m } +\DeclareDocumentCommand \fontspec { O{} m O{} } { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1,#3}{#2} \selectfont \ignorespaces } @@ -3045,20 +3194,23 @@ This work consists of this file fontspec.dtx % (monospaced). I end them with |\normalfont| so that if they're % used in the document, the change registers immediately. % \begin{macrocode} -\DeclareDocumentCommand \setmainfont { O{} m } +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m } +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m } +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} \normalfont + \ignorespaces } % \end{macrocode} % \end{macro} \end{macro} \end{macro} @@ -3077,31 +3229,31 @@ This work consists of this file fontspec.dtx % \begin{macro}{\setmathsf} % \begin{macro}{\setboldmathrm} % \begin{macro}{\setmathtt} -% These commands are analogous to \cmd\setromanfont\ and others, +% These commands are analogous to \cmd\setmainfont\ and others, % but for selecting the font used for \cmd\mathrm, \etc. They % can only be used in the preamble of the % document. \cmd\setboldmathrm\ is used for specifying which % fonts should be used in \cmd\boldmath. % \begin{macrocode} -\tl_new:N \g_fontspec_mathrm_tl -\tl_new:N \g_fontspec_bfmathrm_tl -\tl_new:N \g_fontspec_mathsf_tl -\tl_new:N \g_fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m } +\tl_new:N \g_@@_mathrm_tl +\tl_new:N \g_@@_bfmathrm_tl +\tl_new:N \g_@@_mathsf_tl +\tl_new:N \g_@@_mathtt_tl +\DeclareDocumentCommand \setmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m } +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathsf { O{} m } +\DeclareDocumentCommand \setmathsf { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} + \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathtt { O{} m } +\DeclareDocumentCommand \setmathtt { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} + \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1,#3}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm @@ -3111,9 +3263,9 @@ This work consists of this file fontspec.dtx % If the commands above are not executed, then \cmd\rmdefault\ (\etc) % will be used. % \begin{macrocode} -\tl_set:Nn \g_fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g_fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g_fontspec_mathtt_tl {\ttdefault} +\tl_set:Nn \g_@@_mathrm_tl {\rmdefault} +\tl_set:Nn \g_@@_mathsf_tl {\sfdefault} +\tl_set:Nn \g_@@_mathtt_tl {\ttdefault} % \end{macrocode} % \end{macro} \end{macro} \end{macro} % \end{macro} @@ -3121,8 +3273,7 @@ This work consists of this file fontspec.dtx % \begin{macro}{\newfontfamily} % \begin{macro}{\newfontface} % This macro takes the arguments of \cs{fontspec} with a prepended -% \meta{instance cmd} (code for middle optional argument generated -% by \name{Scott Pakin}'s \textsf{newcommand.py}). This command is used +% \meta{instance cmd}. This command is used % when a specific font instance needs to be referred to repetitively % (\eg, in a section heading) since continuously calling % \cs{fontspec_select:nn} is inefficient because it must parse the @@ -3132,26 +3283,24 @@ This work consists of this file fontspec.dtx % \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 } +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_select:nn{#2}{#3} + \fontspec_set_family:cnn { g_@@_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g_@@_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont } } } % \end{macrocode} -% \cmd\newfontface\ uses an undocumented feature of the \feat{BoldFont} -% feature; if its argument is empty (\ie, |BoldFont={}|), then no bold -% font is searched for. +% \cmd\newfontface\ uses the fact that if the argument to \feat{BoldFont}, etc., is empty (\ie, |BoldFont={}|), then no bold font is searched for. % \begin{macrocode} -\DeclareDocumentCommand \newfontface { m O{} m } +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } % \end{macrocode} % \end{macro} \end{macro} @@ -3166,39 +3315,59 @@ This work consists of this file fontspec.dtx % concatenated with the individual macro choices in the % [...] macro. % \begin{macrocode} -\tl_new:N \g_fontspec_default_fontopts_tl +\clist_new:N \g_@@_default_fontopts_clist \prop_new:N \g_@@_fontopts_prop % \end{macrocode} % % \begin{macrocode} -\DeclareDocumentCommand \defaultfontfeatures { o m } +\DeclareDocumentCommand \defaultfontfeatures { t+ o m } { - \IfNoValueTF {#1} - { \@@_set_default_features:n {#2} } - { \@@_set_font_default_features:nn {#1} {#2} } + \IfNoValueTF {#2} + { \@@_set_default_features:nn {#1} {#3} } + { \@@_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } -\cs_new:Nn \@@_set_default_features:n +\cs_new:Nn \@@_set_default_features:nn { - \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g_@@_default_fontopts_clist {#2} } % \end{macrocode} % The optional argument specifies a font identifier. -% Strip spaces and file extensions and lower-case to ensure consistency. +% Branch for either (a)~single token input such as \verb|\rmdefault|, or (b)~otherwise assume its a fontname. +% In that case, strip spaces and file extensions and lower-case to ensure consistency. % \begin{macrocode} -\cs_new:Nn \@@_set_font_default_features:nn +\cs_new:Nn \@@_set_font_default_features:nnn { - \@@_sanitise_fontname:Nn \l_@@_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g_@@_fontopts_prop \l_@@_tmp_tl } - { \prop_gput:NVn \g_@@_fontopts_prop \l_@@_tmp_tl {#2} } + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l_@@_tmp_tl { \cs:w g_@@_ \cs_to_str:N ##1 _family\cs_end: } } + { \@@_sanitise_fontname:Nn \l_@@_tmp_tl {##1} } + + \IfBooleanTF {#1} + { + \prop_get:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_tmpb_tl + { \tl_clear:N \l_@@_tmpb_tl } + \tl_put_right:Nn \l_@@_tmpb_tl {#3,} + \prop_gput:NVV \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g_@@_fontopts_prop \l_@@_tmp_tl } + { \prop_put:NVn \g_@@_fontopts_prop \l_@@_tmp_tl {#3,} } + } + } } + \cs_new:Nn \@@_sanitise_fontname:Nn { \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l_@@_extensions_clist { \tl_remove_once:Nn #1 {##1} } } + % \end{macrocode} % \end{macro} % @@ -3224,22 +3393,26 @@ This work consists of this file fontspec.dtx % \cs{addfontfeature} is defined as an alias, as I found that I % often typed this instead when adding only a single font feature. % \begin{macrocode} +\bool_new:N \l_@@_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF + { \group_begin: - \tl_clear:N \g_fontspec_default_fontopts_tl + \prop_get:cnN {g_@@_ \f@family _prop} {options} \l_@@_options_tl + \prop_get:cnN {g_@@_ \f@family _prop} {fontname} \l_@@_fontname_tl + \bool_set_true:N \l_@@_disable_defaults_bool \use:x { - \exp_not:N\fontspec_select:nn - {\csname zf@family@options\f@family\endcsname,#1} - {\csname zf@family@fontname\f@family\endcsname} + \exp_not:N \fontspec_select:nn + { \l_@@_options_tl , #1 } {\l_@@_fontname_tl} } \group_end: \fontfamily\l_fontspec_family_tl\selectfont - \else - \fontspec_warning:n {addfontfeatures-ignored} - \fi + } + { + \@@_warning:n {addfontfeatures-ignored} + } \ignorespaces } \cs_set_eq:NN \addfontfeature \addfontfeatures @@ -3247,6 +3420,7 @@ This work consists of this file fontspec.dtx % \end{macro} % % +% % \subsubsection{Defining new font features} % % \begin{macro}{\newfontfeature} @@ -3260,8 +3434,7 @@ This work consists of this file fontspec.dtx { #1 .code:n = { - \fontspec_update_fontid:n {+zf-#1} - \fontspec_update_featstr:n {#2} + \@@_update_featstr:n {#2} } } } @@ -3277,29 +3450,29 @@ This work consists of this file fontspec.dtx \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \fontspec_define_font_feature:n {#1} } + { \@@_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}{} + { \@@_warning:nxx {feature-option-overwrite} {#1} {#2} } + \@@_define_feature_option:nnnnn {#1}{#2}{#3}{#4}{} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\newICUfeature} % \begin{macro}{\newopentypefeature} +% \begin{macro}{\newICUfeature} % This command assigns a new OpenType feature by its abbreviation (|#2|) to a new name (|#1|). % Better than \cmd\newfontfeature\ because it checks if the feature exists in the % font it's being used for. % \begin{macrocode} -\DeclareDocumentCommand \newICUfeature {mmm} +\DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \fontspec_define_font_feature:n{#1} } + { \@@_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} + { \@@_warning:nxx {feature-option-overwrite} {#1} {#2} } + \@@_define_feature_option:nnnnn {#1}{#2}{}{}{#3} } -\cs_set_eq:NN \newopentypefeature \newICUfeature +\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated % \end{macrocode} % \end{macro} % \end{macro} @@ -3332,7 +3505,7 @@ This work consists of this file fontspec.dtx } } { - \fontspec_warning:nx {rename-feature-not-exist} {#1} + \@@_warning:nx {rename-feature-not-exist} {#1} } } } @@ -3363,18 +3536,17 @@ This work consists of this file fontspec.dtx \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} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} } { \fontspec_check_script:nTF {latn} { - \fontspec_warning:nx {script-not-exist-latn} {#1} + \@@_warning:nx {script-not-exist-latn} {#1} \keys_set:nn {fontspec} {Script=Latin} } { - \fontspec_warning:nx {script-not-exist} {#1} + \@@_warning:nx {script-not-exist} {#1} } } } @@ -3403,12 +3575,11 @@ This work consists of this file fontspec.dtx \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} + \@@_warning:nx {language-not-exist} {#1} \keys_set:nn { fontspec } { Language = Default } } } @@ -3422,8 +3593,8 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \DeclareDocumentCommand \DeclareFontsExtensions {m} { - \tl_set:Nn \l_fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l_fontspec_extensions_clist {~} + \clist_set:Nn \l_@@_extensions_clist { #1 } + \tl_remove_all:Nn \l_@@_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} % \end{macrocode} @@ -3449,7 +3620,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \cs_if_exist:cTF {g_fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: + \cs_if_exist:cTF {g_@@_ \f@family _prop} \prg_return_true: \prg_return_false: } % \end{macrocode} % \end{macro} @@ -3463,8 +3634,9 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \bool_if:NTF \l_fontspec_atsui_bool + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \bool_if:NTF \l_@@_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -3489,9 +3661,10 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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: + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool \prg_return_true: \prg_return_false: } { \prg_return_false: @@ -3510,14 +3683,20 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} - \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g_@@_ \f@family _prop} {script-num} \l_@@_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l_@@_tmp_tl} + + \prop_get:cnN {g_@@_ \f@family _prop} {lang-num} \l_@@_tmp_tl + \int_set:Nn \l_fontspec_language_int {\l_@@_tmp_tl} + + \prop_get:cnN {g_@@_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g_@@_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { @@ -3540,9 +3719,10 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} @@ -3565,9 +3745,10 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } @@ -3588,12 +3769,15 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} + \prop_get:cnN {g_@@_ \f@family _prop} {script-num} \l_@@_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l_@@_tmp_tl} + \prop_get:cnN {g_@@_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } @@ -3613,9 +3797,10 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { \tl_set:Nn \l_fontspec_script_tl {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} @@ -3637,11 +3822,13 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} + \prop_get:cnN {g_@@_ \f@family _prop} {script-tag} \l_@@_tmp_tl + \str_if_eq:nVTF {#1} \l_@@_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -3659,11 +3846,13 @@ This work consists of this file fontspec.dtx { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g_@@_ \f@family _prop} {fontdef} \l_@@_fontdef_tl + \@@_font_set:Nnn \l_fontspec_font {\l_@@_fontdef_tl} {\f@size pt} + \@@_set_font_type: + \bool_if:NTF \l_@@_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g_@@_ \f@family _prop} {lang-tag} \l_@@_tmp_tl + \str_if_eq:nVTF {#1} \l_@@_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -3692,9 +3881,11 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l_@@_family_label_tl { #1 } \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } +\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} % \end{macrocode} % \end{macro} % @@ -3703,6 +3894,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_new:Nn \fontspec_set_fontface:NNnn { + \tl_set:Nn \l_@@_family_label_tl { #1 } \fontspec_select:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl @@ -3715,7 +3907,7 @@ This work consists of this file fontspec.dtx % \subsection{expl3 interface for font loading} % % \begin{macrocode} -\cs_set:Nn \fontspec_fontwrap:n { "#1" } +\cs_set:Nn \@@_fontwrap:n { "#1" } % \end{macrocode} % % Beginnings of an `l3font', I guess: @@ -3734,7 +3926,7 @@ This work consists of this file fontspec.dtx \cs_set:Npn \font_suppress_not_found_error: % {\suppressfontnotfounderror=1} % {\luatexsuppressfontnotfounderror=1} - \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} + \prg_set_conditional:Nnn \@@_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -3749,13 +3941,13 @@ This work consists of this file fontspec.dtx % \begin{macro}{\fontspec_set:Nnn,\fontspec_gset:Nnn} % Wrapper around \cs{font_set:Nnn} and \cs{font_gset:Nnn}. % \begin{macrocode} -\cs_new:Nn \fontspec_font_set:Nnn +\cs_new:Nn \@@_font_set:Nnn { - \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_set:Nnn #1 {\@@_fontwrap:n {#2}} {#3} } -\cs_new:Nn \fontspec_font_gset:Nnn +\cs_new:Nn \@@_font_gset:Nnn { - \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_gset:Nnn #1 {\@@_fontwrap:n {#2}} {#3} } % \end{macrocode} % \end{macro} @@ -3794,83 +3986,61 @@ This work consists of this file fontspec.dtx % % 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. +% +% Some often-used variables to know about: +% \begin{itemize} +% \item \cmd{\l_fontspec_fontname_tl} is used as the generic name of the font being defined. +% \item \cmd{\l_@@_fontid_tl} is the unique identifier of the font with all its +% features. +% \item \cmd{\l_fontspec_fontname_up_tl} is the font specifically to be used as the upright font. +% \item \cmd{\l_@@_basename_tl} is the (immutable) original argument used for |*|-replacing. +% \item \cmd{\l_fontspec_font} is the plain \TeX{} font of the upright font requested. +% \end{itemize} % \begin{macrocode} \cs_set:Nn \fontspec_select:nn { \group_begin: \font_suppress_not_found_error: - \fontspec_init: -% \end{macrocode} -% \cmd{\l_fontspec_fontname_tl} is used as the generic name of the font being defined. -% \cmd{\l_fontspec_fontid_tl} is the unique identifier of the font with all its -% features. -% \cmd{\l_fontspec_fontname_up_tl} is the font specifically to be used as the upright font. -% \begin{macrocode} + \@@_init: + \tl_set:Nx \l_fontspec_fontname_tl {#2} % \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} -% Load a possible \texttt{.fontspec} font configuration file. -% This file could set font-specific options for the font about to be loaded. -% \begin{macrocode} + \tl_set_eq:NN \l_@@_basename_tl \l_fontspec_fontname_tl + \@@_load_external_fontoptions:N \l_fontspec_fontname_tl -% \end{macrocode} -% Convert the requested features to font definition -% strings. First the features are parsed for information about font -% loading (whether it's a named font or external font, etc.), and then -% information is extracted for the names of the other shape fonts. -% \begin{macrocode} - \fontspec_preparse_features:nN {#1} \l_fontspec_fontname_tl -% \end{macrocode} -% Finally save the `confirmed' font definition. -% \begin{macrocode} - \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 \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} -% Then the mapping from user features to low-level features occurs. -% This is performed with \cs{fontspec_get_features:n}, in -% 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_set_scriptlang: - \fontspec_get_features:n {} - \bool_set_false:N \l_fontspec_firsttime_bool -% \end{macrocode} -% Check if the family is unique and, if so, save its information. -% (\cs{addfontfeature} and other macros use this data.) -% Then the font family and its shapes are defined in the NFSS. -% -% All NFSS specifications take their default values, so if any of them -% are redefined, the shapes will be selected to fit in with the -% current state. For example, if \cmd\bfdefault\ is redefined to |b|, all -% bold shapes defined by this package will also be assigned to |b|. -% \begin{macrocode} - \fontspec_save_family:nT {#2} + \@@_extract_all_features:n {#1} + \@@_preparse_features: + + \@@_load_font: + \@@_set_scriptlang: + \@@_get_features:Nn \l_@@_rawfeatures_sclist {} + \bool_set_false:N \l_@@_firsttime_bool + + \@@_save_family:nTF {#2} { - \fontspec_save_fontinfo:nn {#1} {#2} + \@@_save_fontinfo: + \@@_find_autofonts: \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} - \fontspec_set_upright: - \fontspec_set_bold: - \fontspec_set_italic: - \fontspec_set_slanted: - \fontspec_set_bold_italic: - \fontspec_set_bold_slanted: + \@@_set_faces: + \@@_info:nxx {defining-font} {#1} {#2} +%<*debug> + \@@_warning:nxx {defining-font} {#1} {#2} +% + } + { +%<*debug> + \typeout{"#2"~ already~ defined~ apparently.} +% } - \fontspec_info:nxx {defining-font} {#1} {#2} \group_end: } % \end{macrocode} % \end{macro} % % \begin{macro}{\@@_load_external_fontoptions:N} +% Load a possible \texttt{.fontspec} font configuration file. +% This file could set font-specific options for the font about to be loaded. % \begin{macrocode} \cs_new:Nn \@@_load_external_fontoptions:N { @@ -3884,136 +4054,152 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_extract_features:} +% \begin{macrocode} +\cs_new:Nn \@@_extract_all_features:n + { + \@@_sanitise_fontname:Nn \l_@@_tmp_tl {\l_fontspec_fontname_tl} + + \bool_if:NTF \l_@@_disable_defaults_bool + { + \clist_set:Nx \l_@@_all_features_clist + {#1} + } + { + \prop_get:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist + { \clist_clear:N \l_@@_fontopts_clist } + + \prop_get:NVNF \g_@@_fontopts_prop \l_@@_family_label_tl \l_@@_family_fontopts_clist + { \clist_clear:N \l_@@_family_fontopts_clist } + \tl_clear:N \l_@@_family_label_tl + + \clist_set:Nx \l_@@_all_features_clist + { + \g_@@_default_fontopts_clist, + \l_@@_family_fontopts_clist, + \l_@@_fontopts_clist, + #1 + } + } + \tl_set:Nx \l_@@_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l_@@_all_features_clist } +%<*debug> + \typeout{fontid: \l_@@_fontid_tl} +% + } +% \end{macrocode} +% \end{macro} % -% \begin{macro}{\fontspec_preparse_features:nN} +% \begin{macro}{\@@_preparse_features:} % \darg{feature options} % \darg{font name} % Perform the (multi-step) feature parsing process. +% +% Convert the requested features to font definition +% strings. First the features are parsed for information about font +% loading (whether it's a named font or external font, etc.), and then +% information is extracted for the names of the other shape fonts. % \begin{macrocode} -\cs_new:Nn \fontspec_preparse_features:nN +\cs_new:Nn \@@_preparse_features: { % \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} - \exp_args:NV \fontspec_if_detect_external:nT #2 + \exp_args:NV \@@_if_detect_external:nT \l_fontspec_fontname_tl { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - - \@@_sanitise_fontname:Nn \l_@@_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist + \keys_set_known:nxN {fontspec-preparse-external} - { - \g_fontspec_default_fontopts_tl - \quark_if_no_value:NF \l_@@_fontopts_clist {\l_@@_fontopts_clist,} - #1 - } - \l_fontspec_keys_leftover_clist + { \l_@@_all_features_clist } + \l_@@_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 - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_keys_leftover_clist} - \l_fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist} - \l_fontspec_fontfeat_clist + \keys_set_known:nxN {fontspec-renderer} {\l_@@_keys_leftover_clist} + \l_@@_keys_leftover_clist + \keys_set_known:nxN {fontspec-preparse} {\l_@@_keys_leftover_clist} + \l_@@_fontfeat_clist } % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_load_font:} +% \begin{macrocode} +\cs_new:Nn \@@_load_font: + { + \@@_font_set:Nnn \l_fontspec_font + { \@@_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \@@_font_if_null:NT \l_fontspec_font { \@@_error:nx {font-not-found} {\l_fontspec_fontname_up_tl} } + \@@_set_font_type: + \@@_font_gset:Nnn \l_fontspec_font + { \@@_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} +% \end{macro} % -% \begin{macro}{\fontspec_if_detect_external:nT} +% \begin{macro}{\@@_if_detect_external:nnT} % Check if either the fontname ends with a known font extension. % \begin{macrocode} -\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} +\prg_new_conditional:Nnn \@@_if_detect_external:n {T} { - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l_@@_extensions_clist { - \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l_@@_tmpa_bool \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_tmpa_bool \clist_map_break: } + { \bool_set_true:N \l_@@_tmpa_bool \clist_map_break: } } - \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l_@@_tmpa_bool \prg_return_true: \prg_return_false: } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_fullname:n} +% \begin{macro}{\@@_fullname:n} % Constructs the complete font name based on a common piece of info. % \begin{macrocode} -\cs_set:Nn \fontspec_fullname:n +\cs_set:Nn \@@_fullname:n { - \fontspec_namewrap:n { #1 \l_fontspec_extension_tl } + \@@_namewrap:n { #1 \l_@@_extension_tl } \l_fontspec_renderer_tl - \l_fontspec_optical_size_tl - } -% \end{macrocode} -% \end{macro} -% -% -% -% \begin{macro}{\fontspec_save_family:nT} -%% Now we have a unique (in fact, too unique!) string that contains -% the family name and every option in abbreviated form. This is used -% with a counter to create a simple NFSS family name for the font we're -% selecting. -% -% The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped. -% \begin{macrocode} -\prg_new_conditional:Nnn \fontspec_save_family:n {T} - { - \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \cs_if_exist:cTF {g_fontspec_family_#1_int} - { \int_gincr:c {g_fontspec_family_#1_int} } - { \int_new: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 \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: + \l_@@_optical_size_tl } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_set_scriptlang:} +% \begin{macro}{\@@_set_scriptlang:} % Only necessary for OpenType fonts. % First check if the font supports scripts, then apply defaults if % none are explicitly requested. Similarly with the language settings. % \begin{macrocode} -\cs_new:Nn \fontspec_set_scriptlang: +\cs_new:Nn \@@_set_scriptlang: { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l_@@_firsttime_bool { - \tl_if_empty:NTF \l_fontspec_script_name_tl + \tl_if_empty:NTF \l_@@_script_name_tl { \fontspec_check_script:nTF {latn} { - \tl_set:Nn \l_fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_set:Nn \l_@@_script_name_tl {Latin} + \tl_if_empty:NT \l_@@_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l_@@_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l_@@_script_name_tl} + \keys_set:nx {fontspec} {Language=\l_@@_lang_name_tl} } { - \fontspec_info:n {no-scripts} + \@@_info:n {no-scripts} } } { - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_if_empty:NT \l_@@_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l_@@_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\l_fontspec_lang_name_tl} + \keys_set:nx {fontspec} {Script=\l_@@_script_name_tl} + \keys_set:nx {fontspec} {Language=\l_@@_lang_name_tl} } } } @@ -4021,179 +4207,132 @@ This work consists of this file fontspec.dtx % \end{macro} % % -% \begin{macro}{\fontspec_save_fontinfo:nn} -% Saves the relevant font information for future processing. +% \begin{macro}{\@@_save_family:nTF} +% Check if the family is unique and, if so, save its information. +% (\cs{addfontfeature} and other macros use this data.) +% Then the font family and its shapes are defined in the NFSS. +% +% Now we have a unique (in fact, too unique!) string that contains +% the family name and every option in abbreviated form. This is used +% with a counter to create a simple NFSS family name for the font we're +% selecting. +% +% The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped. % \begin{macrocode} -\cs_generate_variant:Nn \prop_gput:Nnn {cnV} -\cs_generate_variant:Nn \prop_gput:Nnn {cnx} -\cs_new:Nn \fontspec_save_fontinfo:nn +\prg_new_conditional:Nnn \@@_save_family:n {TF} { - \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} + \cs_if_exist:NT \l_@@_nfss_fam_tl { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_set_eq:cN {g_@@_UID_\l_@@_fontid_tl} \l_@@_nfss_fam_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\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} + \cs_if_exist:cF {g_@@_UID_\l_@@_fontid_tl} { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_if_exist:cTF {g_@@_family_#1_int} + { \int_gincr:c {g_@@_family_#1_int} } + { \int_new:c {g_@@_family_#1_int} } + \tl_set:Nx \l_@@_tmp_tl {#1} + \tl_remove_all:Nn \l_@@_tmp_tl {~} + \tl_gset:cx {g_@@_UID_\l_@@_fontid_tl} + { + \l_@@_tmp_tl ( \int_use:c {g_@@_family_#1_int} ) + } } - \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} -% -% -% \begin{macro}{\fontspec_set_upright:} -% Sets the upright shape. -% \begin{macrocode} -\cs_new:Nn \fontspec_set_upright: - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl - \mddefault \updefault \l_fontspec_fontfeat_up_clist + \tl_gset:Nv \l_fontspec_family_tl {g_@@_UID_\l_@@_fontid_tl} + \cs_if_exist:cTF {g_@@_ \l_fontspec_family_tl _prop} + \prg_return_false: \prg_return_true: } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_set_bold:} -% The macros [...], et al., are used to store the name of the -% custom bold, et al., font, if requested as user options. If they are -% empty, the default fonts are used. % -% The extra bold options defined with -% \feat{BoldFeatures} are appended to the generic font features. -% Then, the bold font is defined either as the ATS -% default ([...] optional argument is to check if -% there actually is one; if not, the bold NFSS series is left -% undefined) or with the font specified with the \feat{BoldFont} feature. +% \begin{macro}{\@@_save_fontinfo:nn} +% Saves the relevant font information for future processing. % \begin{macrocode} -\cs_new:Nn \fontspec_set_bold: +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} +\cs_new:Nn \@@_save_fontinfo: { - \bool_if:NF \l_fontspec_nobf_bool + \prop_new:c {g_@@_ \l_fontspec_family_tl _prop} + \prop_gput:cnx {g_@@_ \l_fontspec_family_tl _prop} {fontname} { \l_@@_basename_tl } + \prop_gput:cnx {g_@@_ \l_fontspec_family_tl _prop} {options} { \l_@@_all_features_clist } + \prop_gput:cnx {g_@@_ \l_fontspec_family_tl _prop} {fontdef} { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } + \@@_fullname:n {\l_fontspec_fontname_tl} : + \l_@@_pre_feat_sclist \l_@@_rawfeatures_sclist } + \prop_gput:cnV {g_@@_ \l_fontspec_family_tl _prop} {script-num} \l_fontspec_script_int + \prop_gput:cnV {g_@@_ \l_fontspec_family_tl _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g_@@_ \l_fontspec_family_tl _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g_@@_ \l_fontspec_family_tl _prop} {lang-tag} \l_fontspec_lang_tl + } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_set_italic:} -% And italic in the same way: +% \subsubsection{Setting font shapes in a family} +% +% All NFSS specifications take their default values, so if any of them +% are redefined, the shapes will be selected to fit in with the +% current state. For example, if \cmd\bfdefault\ is redefined to |b|, all +% bold shapes defined by this package will also be assigned to |b|. +% +% The combination shapes are searched first because they use information that may be redefined in the single cases. +% E.g., if no bold font is specified then |set_autofont| will attempt to set it. +% This has subtle/small ramifications on the logic of choosing the bold italic font. +% +% \begin{macro}{\@@_find_autofonts:} % \begin{macrocode} -\cs_new:Nn \fontspec_set_italic: - { - \bool_if:NF \l_fontspec_noit_bool +\cs_new:Nn \@@_find_autofonts: + { + \bool_if:nF {\l_@@_noit_bool || \l_@@_nobf_bool} { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } - { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } - \mddefault \itdefault \l_fontspec_fontfeat_it_clist + \@@_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_it_tl} {/B} + \@@_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_bf_tl} {/I} + \@@_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\fontspec_set_slanted:} -% And slanted but only if requested: -% \begin{macrocode} -\cs_new:Nn \fontspec_set_slanted: - { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + + \bool_if:NF \l_@@_nobf_bool { - \fontspec_make_font_shapes:nnnn - \l_fontspec_fontname_sl_tl \mddefault \sldefault - \l_fontspec_fontfeat_sl_clist + \@@_set_autofont:Nnn \l_fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} } - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\fontspec_set_bold_italic:} -% % If requested, the custom fonts take precedence when choosing the -% bold italic font. When both italic and bold fonts are requested and -% the bold italic font hasn't been explicitly specified (a rare -% occurance, presumably), the new bold font is used to define the new -% bold italic font. -% \begin{macrocode} -\cs_new:Nn \fontspec_set_bold_italic: - { - \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} + + \bool_if:NF \l_@@_noit_bool { - \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} - } - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} - } - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl - } - \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist + \@@_set_autofont:Nnn \l_fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} } + + \@@_set_autofont:Nnn \l_fontspec_fontname_bfsl_tl {\l_fontspec_fontname_sl_tl} {/B} } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_set_bold_slanted:} -% And bold slanted, again, only if requested: +% \begin{macro}{\@@_set_faces:} % \begin{macrocode} -\cs_new:Nn \fontspec_set_bold_slanted: +\cs_new:Nn \@@_set_faces: { - \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 - } + \@@_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l_@@_fontfeat_up_clist + \@@_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l_@@_fontfeat_bf_clist + \@@_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l_@@_fontfeat_it_clist + \@@_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l_@@_fontfeat_sl_clist + \@@_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l_@@_fontfeat_bfit_clist + \@@_add_nfssfont:oooo \bfdefault \sldefault \l_fontspec_fontname_bfsl_tl \l_@@_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l_@@_nfssfont_prop { \@@_set_faces_aux:nnnnn ##2 } + } +\cs_new:Nn \@@_set_faces_aux:nnnnn + { + \fontspec_complete_fontname:Nn \l_@@_curr_fontname_tl {#3} + \@@_make_font_shapes:Nnnnn \l_@@_curr_fontname_tl {#1} {#2} {#4} {#5} } % \end{macrocode} % \end{macro} % % % -% -% % \subsubsection{Fonts} % -% \begin{macro}{\fontspec_set_font_type:} -% Now check if the font is to be rendered with \ATSUI\ or \ICU. This will either +% \begin{macro}{\@@_set_font_type:} +% Now check if the font is to be rendered with \ATSUI\ or Harfbuzz. This will either % be automatic (based on the font type), or specified by the user via a font feature. % % This macro sets booleans @@ -4201,23 +4340,23 @@ This work consists of this file fontspec.dtx % font or an OpenType font or a font with feature axes (either \AAT\ or % Multiple Master), respectively. % \begin{macrocode} -\cs_new:Nn \fontspec_set_font_type: +\cs_new:Nn \@@_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 + \bool_set_false:N \l_@@_tfm_bool + \bool_set_false:N \l_@@_atsui_bool + \bool_set_false:N \l_@@_ot_bool + \bool_set_false:N \l_@@_mm_bool + \bool_set_false:N \l_@@_graphite_bool \ifcase\XeTeXfonttype\l_fontspec_font - \bool_set_true:N \l_fontspec_tfm_bool + \bool_set_true:N \l_@@_tfm_bool \or - \bool_set_true:N \l_fontspec_atsui_bool + \bool_set_true:N \l_@@_atsui_bool \ifnum\XeTeXcountvariations\l_fontspec_font > \c_zero - \bool_set_true:N \l_fontspec_mm_bool + \bool_set_true:N \l_@@_mm_bool \fi \or - \bool_set_true:N \l_fontspec_icu_bool + \bool_set_true:N \l_@@_ot_bool \fi % \end{macrocode} % If automatic, the \cmd{\l_fontspec_renderer_tl} token list will still be @@ -4227,31 +4366,73 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \tl_if_empty:NT \l_fontspec_renderer_tl { - \bool_if:NTF \l_fontspec_atsui_bool + \bool_if:NTF \l_@@_atsui_bool { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } { - \bool_if:NT \l_fontspec_icu_bool - { \tl_set:Nn \l_fontspec_renderer_tl {/ICU} } + \bool_if:NT \l_@@_ot_bool + { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } } } } % %<*luatex> { - \bool_set_true:N \l_fontspec_icu_bool + \bool_set_true:N \l_@@_ot_bool } % % \end{macrocode} % \end{macro} % % +% \begin{macro}{\@@_set_autofont:Nnn} +% \darg{Font name tl} +% \darg{Base font name} +% \darg{Font name modifier} % -% \begin{macro}{\fontspec_make_font_shapes:nnnn,\fontspec_make_auto_font_shapes:nnnnn} -% \darg{Font name prefix (in the 5-arg case)} +% This function looks for font with \meta{name} and \meta{modifier} |#2#3|, and if found (i.e., different to font with name |#2|) stores it in tl |#1|. A modifier is something like |/B| to look for a bold font, for example. +% +% We can't match external fonts in this way (in \XeTeX\ anyway; todo: test with LuaTeX). +% If \meta{font name tl} is not empty, then it's already been specified by the user so abort. +% If \meta{Base font name} is not given, we also abort for obvious reasons. +% +% If \meta{font name tl} is empty, then proceed. +% If not found, \meta{font name tl} remains empty. +% Otherwise, we have a match. +% \begin{macrocode} +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_new:Nn \@@_set_autofont:Nnn + { + \bool_if:NF \l_@@_external_bool + { + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \@@_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \@@_info:nx {no-font-shape} {#2#3} } + } + } + } + } + +\prg_new_conditional:Nnn \@@_if_autofont:nn {T,TF} + { + \@@_font_set:Nnn \l_tmpa_font { \@@_fullname:n {#1} } {\f@size pt} + \@@_font_set:Nnn \l_tmpb_font { \@@_fullname:n {#1#2} } {\f@size pt} + \str_if_eq_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@@_make_font_shapes:Nnnnn} % \darg{Font name} % \darg{Font series} % \darg{Font shape} % \darg{Font features} +% \darg{Size features} % This macro eventually uses \cs{DeclareFontShape} to define the font shape in % question. % @@ -4270,137 +4451,140 @@ 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 +\cs_new:Nn \@@_make_font_shapes:Nnnnn { - \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_x:nnTF { \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: - \@@_load_fontname:n {#1} - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l_@@_fontopts_clist {\l_@@_fontopts_clist,} #4 } - - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl - { - \bool_if:NF \l_fontspec_nosc_bool - { - \fontspec_make_smallcaps:T - { - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l_@@_fontopts_clist {\l_@@_fontopts_clist,} - #4 , Letters=SmallCaps , \l_fontspec_fontfeat_sc_clist - } - } - } - } - { - \@@_load_fontname:n {\l_fontspec_fontname_sc_tl} - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l_@@_fontopts_clist {\l_@@_fontopts_clist,} - #4 , \l_fontspec_fontfeat_sc_clist - } - } + \@@_declare_shape:nnxx {#2} {#3} { \l_@@_fontopts_clist, #4 } {#5} \group_end: } + \cs_new:Nn \@@_load_fontname:n { \tl_set:Nx \l_fontspec_fontname_tl {#1} \@@_load_external_fontoptions:N \l_fontspec_fontname_tl \@@_sanitise_fontname:Nn \l_@@_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} } + \prop_get:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist + { \clist_clear:N \l_@@_fontopts_clist } + \@@_font_set:Nnn \l_fontspec_font {\@@_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} + \@@_font_if_null:NT \l_fontspec_font { \@@_error:nx {font-not-found} {#1} } } % \end{macrocode} % Note that the test for italics to choose the \cmd\sidefault\ shape % only works while \cmd\fontspec_select:nn\ passes single tokens to this macro\dots % \end{macro} % -% \begin{macro}{\fontspec_declare_shape:nnn} +% \begin{macro}{\@@_declare_shape:nnnn} % \darg{Font series} % \darg{Font shape} % \darg{Font features} +% \darg{Size features} % Wrapper for \cmd\DeclareFontShape. -% And finally the actual font shape declaration using \cmd\l_fontspec_nfss_tl\ defined above. -% \cmd\l_fontspec_postadjust_tl\ is defined in various places to deal with things like the hyphenation +% And finally the actual font shape declaration using \cmd\l_@@_nfss_tl\ defined above. +% \cmd\l_@@_postadjust_tl\ is defined in various places to deal with things like the hyphenation % character and interword spacing. +% +% The main part is to loop through \feat{SizeFeatures} arguments, which are of the form +% {\par\centering |SizeFeatures={{},{},{}}|.\par} % \begin{macrocode} -\cs_new:Nn \fontspec_declare_shape:nnn +\cs_new:Nn \@@_declare_shape:nnnn { - \clist_if_empty:NTF \l_fontspec_sizefeat_clist - { \@@_declare_shape_nosizing:n {#3} } - { \@@_declare_shape_withsizing:n {#3} } - \use:x + \tl_clear:N \l_@@_nfss_tl + \tl_clear:N \l_@@_nfss_sc_tl + \tl_set_eq:NN \l_@@_saved_fontname_tl \l_fontspec_fontname_tl + + \exp_args:Nx \clist_map_inline:nn {#4} { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} {#2} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} + \tl_clear:N \l_@@_size_tl + \tl_set_eq:NN \l_@@_sizedfont_tl \l_@@_saved_fontname_tl % in case not spec'ed + + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \l_@@_sizing_leftover_clist + \tl_if_empty:NT \l_@@_size_tl { \@@_error:n {no-size-info} } + + % "normal" + \@@_load_fontname:n {\l_@@_sizedfont_tl} + \@@_setup_nfss:Nnn \l_@@_nfss_tl {#3} {} + + % small caps + \clist_set_eq:NN \l_@@_fontfeat_curr_clist \l_@@_fontfeat_sc_clist + + \bool_if:NF \l_@@_nosc_bool + { + \tl_if_empty:NTF \l_fontspec_fontname_sc_tl + { +% \typeout{Attempting~ small~ caps?} + \@@_make_smallcaps:TF + { +% \typeout{Small~ caps~ found.} + \clist_put_left:Nn \l_@@_fontfeat_curr_clist {Letters=SmallCaps} + } + { +% \typeout{Small~ caps~ not~ found.} + \bool_set_true:N \l_@@_nosc_bool + } + } + { \@@_load_fontname:n {\l_fontspec_fontname_sc_tl} }% local for each size + } + + \bool_if:NF \l_@@_nosc_bool + { + \@@_setup_nfss:Nnn \l_@@_nfss_sc_tl {#3} {\l_@@_fontfeat_curr_clist} + } + } + + \@@_declare_shapes_normal:nn {#1} {#2} \@@_declare_shape_slanted:nn {#1} {#2} \@@_declare_shape_loginfo:nnn {#1} {#2} {#3} } -% \end{macrocode} -% Default code; sets things up for no optical size fonts or features. -% \begin{macrocode} -\cs_new:Nn \@@_declare_shape_nosizing:n +\cs_generate_variant:Nn \@@_declare_shape:nnnn {nnxx} + +\cs_new:Nn \@@_setup_nfss:Nnn { - \fontspec_get_features:n {#1} - \tl_set:Nx \l_fontspec_nfss_tl + \@@_get_features:Nn \l_@@_rawfeatures_sclist + { #2 , \l_@@_sizing_leftover_clist , #3 } + + \tl_put_right:Nx #1 + { + <\l_@@_size_tl> \l_@@_scale_tl + \@@_fontwrap:n { - <-> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - } + \@@_fullname:n { \l_fontspec_fontname_tl } + : \l_@@_pre_feat_sclist \l_@@_rawfeatures_sclist + } + } } -% \end{macrocode} -% On the other hand, loop through \feat{SizeFeatures} arguments, which -% are of the form -% {\par\centering |SizeFeatures={{},{},{}}|.\par} -% \begin{macrocode} -\cs_new:Nn \@@_declare_shape_withsizing:n + +\cs_new:Nn \@@_declare_shapes_normal:nn { - \tl_clear:N \l_fontspec_nfss_tl - \clist_map_inline:Nn \l_fontspec_sizefeat_clist + \@@_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} {#2} {\l_@@_nfss_tl}{\l_@@_postadjust_tl} + + \bool_if:NF \l_@@_nosc_bool { + \@@_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} + {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} + {\l_@@_nfss_sc_tl}{\l_@@_postadjust_tl} + } + } - \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl - - \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 { #1 , \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 - } - } - } +\cs_new:Nn \@@_DeclareFontShape:nnnnnn + { + \group_begin: + \normalsize + \cs_undefine:c {#1/#2/#3/#4/\f@size} + \group_end: + \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} } +\cs_generate_variant:Nn \@@_DeclareFontShape:nnnnnn {xxxxxx} % \end{macrocode} % This extra stuff for the slanted shape substitution is a little bit awkward. +% We define the slanted shape to be a synonym for it when (a)~we're defining an italic font, but also (b)~when the default slanted shape isn't `it'. +% (Presumably this turned up once in a test and I realised it caused problems. I doubt this would happen much.) +% +% We should test when a slanted font has been specified and not run this code if so, but the \verb|\@@_set_slanted:| code will overwrite this anyway if necessary. % \begin{macrocode} \cs_new:Nn \@@_declare_shape_slanted:nn { @@ -4410,11 +4594,8 @@ This work consists of this file fontspec.dtx !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \use:x - { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl} - } + \@@_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_@@_postadjust_tl} } } % \end{macrocode} @@ -4428,33 +4609,39 @@ This work consists of this file fontspec.dtx *~ '\exp_not:N \str_case: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} + } {#2/#3}'~ + with~ NFSS~ spec.: \exp_not:N \\ + \l_@@_nfss_tl + \exp_not:n { \\ \\ } + *~ '\exp_not:N \str_case:nnn {#1/\scdefault} + { + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\sidefault} {italic~ small~ caps} {\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 + \l_@@_nfss_sc_tl + \tl_if_empty:NF \l_@@_postadjust_tl { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_fontspec_postadjust_tl + \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_@@_postadjust_tl } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\l_fontspec_pre_feat_sclist} +% \begin{macro}{\l_@@_pre_feat_sclist} % These are the features always applied to a font selection before other % features. % \begin{macrocode} -\tl_set:Nn \l_fontspec_pre_feat_sclist +\clist_set:Nn \l_@@_pre_feat_sclist %<*xetexx> { - \bool_if:NT \l_fontspec_icu_bool + \bool_if:NT \l_@@_ot_bool { \tl_if_empty:NF \l_fontspec_script_tl { @@ -4479,63 +4666,52 @@ This work consists of this file fontspec.dtx % % % -% \begin{macro}{\fontspec_update_fontid:n} -% This macro is used to build up a complex family name based on its -% features. -% -% The \meta{firsttime} boolean is set true in \cmd{\fontspec_select:nn} only the first -% 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 - { - \bool_if:NT \l_fontspec_firsttime_bool - { - \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} - } - } -% \end{macrocode} -% \end{macro} % % % \subsubsection{Features} % -% \begin{macro}{\fontspec_get_features:n} +% \begin{macro}{\@@_get_features:Nn} +% % 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. % Its argument is any additional features to prepend to the default. % \begin{macrocode} -\cs_set:Nn \fontspec_get_features:n +\cs_set:Nn \@@_get_features:Nn { - \sclist_clear:N \l_fontspec_rawfeatures_sclist - \tl_clear:N \l_fontspec_scale_tl - \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 + \sclist_clear:N \l_@@_rawfeatures_sclist + \tl_clear:N \l_@@_scale_tl + \tl_set_eq:NN \l_@@_opacity_tl \g_@@_opacity_tl + \tl_set_eq:NN \l_@@_hexcol_tl \g_@@_hexcol_tl + \tl_set_eq:NN \l_@@_postadjust_tl \g_@@_postadjust_tl + \tl_clear:N \l_@@_wordspace_adjust_tl + \tl_clear:N \l_@@_punctspace_adjust_tl - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_fontfeat_clist,#1} - \l_fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l_fontspec_keys_leftover_clist} + \keys_set_known:nxN {fontspec-renderer} {\l_@@_fontfeat_clist,#2} + \l_@@_keys_leftover_clist + \keys_set:nx {fontspec} {\l_@@_keys_leftover_clist} % \end{macrocode} % Finish the colour specification. % Do not set the colour if not explicitly spec'd else \verb|\color| (using % specials) will not work. % \begin{macrocode} - \str_if_eq_x:nnF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } - { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } - { - \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} + \str_if_eq_x:nnF { \l_@@_hexcol_tl \l_@@_opacity_tl } + { \g_@@_hexcol_tl \g_@@_opacity_tl } + { + \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } } + + \tl_set_eq:NN #1 \l_@@_rawfeatures_sclist } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_init:} +% \begin{macro}{\@@_init:} % Initialisations that either need to occur globally: % (all setting of these variables is done locally inside a group) % \begin{macrocode} +\tl_clear:N \l_@@_family_label_tl \tl_clear:N \l_fontspec_fontname_bf_tl \tl_clear:N \l_fontspec_fontname_it_tl \tl_clear:N \l_fontspec_fake_slant_tl @@ -4544,35 +4720,48 @@ This work consists of this file fontspec.dtx \tl_clear:N \l_fontspec_fontname_sl_tl \tl_clear:N \l_fontspec_fontname_bfsl_tl \tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l_fontspec_fontfeat_up_clist -\tl_clear:N \l_fontspec_fontfeat_bf_clist -\tl_clear:N \l_fontspec_fontfeat_it_clist -\tl_clear:N \l_fontspec_fontfeat_bfit_clist -\tl_clear:N \l_fontspec_fontfeat_sl_clist -\tl_clear:N \l_fontspec_fontfeat_bfsl_clist -\tl_clear:N \l_fontspec_fontfeat_sc_clist -\tl_clear:N \l_fontspec_script_name_tl +\tl_clear:N \l_@@_fontfeat_up_clist +\tl_clear:N \l_@@_fontfeat_bf_clist +\tl_clear:N \l_@@_fontfeat_it_clist +\tl_clear:N \l_@@_fontfeat_bfit_clist +\tl_clear:N \l_@@_fontfeat_sl_clist +\tl_clear:N \l_@@_fontfeat_bfsl_clist +\tl_clear:N \l_@@_fontfeat_sc_clist +\tl_clear:N \l_@@_script_name_tl \tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l_fontspec_lang_name_tl +\tl_clear:N \l_@@_lang_name_tl \tl_clear:N \l_fontspec_lang_tl -\clist_clear:N \l_fontspec_sizefeat_clist -\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~} +\tl_set:Nn \g_@@_postadjust_tl { \l_@@_wordspace_adjust_tl \l_@@_punctspace_adjust_tl } + +\clist_set:Nn \l_@@_sizefeat_clist {Size={-}} +\tl_new:N \g_@@_hexcol_tl +\tl_new:N \g_@@_opacity_tl +\tl_set:Nn \g_@@_hexcol_tl {000000} +\tl_set:Nn \g_@@_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} -\cs_set:Npn \fontspec_init: +\cs_set:Npn \@@_init: { - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_true:N \l_fontspec_firsttime_bool - \cs_set:Npn \fontspec_namewrap:n ##1 { ##1 } - \tl_clear:N \l_fontspec_optical_size_tl + \bool_set_false:N \l_@@_ot_bool + \bool_set_true:N \l_@@_firsttime_bool + \cs_set:Npn \@@_namewrap:n ##1 { ##1 } + \tl_clear:N \l_@@_optical_size_tl \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl + \tl_clear:N \g_@@_curr_series_tl + + % This is for detecting font families when assigning default features. + % Replace defaults for the standard families because they're not set in the usual way: + \exp_args:NV \str_case:nnn {\l_@@_family_label_tl} + { + {\rmdefault} { \tl_set:Nn \l_@@_family_label_tl {\g_@@_rmfamily_family} } + {\sfdefault} { \tl_set:Nn \l_@@_family_label_tl {\g_@@_sffamily_family} } + {\ttdefault} { \tl_set:Nn \l_@@_family_label_tl {\g_@@_ttfamily_family} } + }{} + %<*luatex> \tl_set:Nn \l_fontspec_mode_tl {node} \luatexprehyphenchar =`\- % fixme @@ -4584,27 +4773,27 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_make_smallcaps:T} +% \begin{macro}{\@@_make_smallcaps:TF} % \label{mac:makesmallcaps} % This macro checks if the font contains small caps. % \begin{macrocode} -\cs_set:Nn \fontspec_make_ot_smallcaps:T +\cs_set:Nn \fontspec_make_ot_smallcaps:TF { - \fontspec_check_ot_feat:nT {+smcp} { #1 } + \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} } %<*xetexx> -\cs_set:Nn \fontspec_make_smallcaps:T +\cs_set:Nn \@@_make_smallcaps:TF { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ot_smallcaps:T {#1} } + \bool_if:NTF \l_@@_ot_bool + { \fontspec_make_ot_smallcaps:TF {#1} {#2} } { - \bool_if:NT \l_fontspec_atsui_bool - { \fontspec_make_AAT_feature_string:nnT {3}{3} { #1 } } + \bool_if:NT \l_@@_atsui_bool + { \fontspec_make_AAT_feature_string:nnTF {3}{3} {#1} {#2} } } } % %<*luatex> -\cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T +\cs_set_eq:NN \@@_make_smallcaps:TF \fontspec_make_ot_smallcaps:TF % % \end{macrocode} % \end{macro} @@ -4626,17 +4815,17 @@ This work consists of this file fontspec.dtx % % % -% \begin{macro}{\fontspec_update_featstr:n} -% \cmd{\l_fontspec_rawfeatures_sclist} is the string used to define the list of specific +% \begin{macro}{\@@_update_featstr:n} +% \cmd{\l_@@_rawfeatures_sclist} is the string used to define the list of specific % font features. Each time another font feature is requested, this % macro is used to add that feature to the list. Font features are % separated by semicolons. % \begin{macrocode} -\cs_new:Nn \fontspec_update_featstr:n +\cs_new:Nn \@@_update_featstr:n { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l_@@_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} + \sclist_gput_right:Nx \l_@@_rawfeatures_sclist {#1} } } % \end{macrocode} @@ -4651,16 +4840,16 @@ This work consists of this file fontspec.dtx \cs_new:Nn \fontspec_make_feature:nnn %<*xetexx> { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ICU_feature:n {#3} } + \bool_if:NTF \l_@@_ot_bool + { \fontspec_make_OT_feature:n {#3} } { - \bool_if:NT \l_fontspec_atsui_bool + \bool_if:NT \l_@@_atsui_bool { \fontspec_make_AAT_feature:nn {#1}{#2} } } } % %<*luatex> - { \fontspec_make_ICU_feature:n {#3} } + { \fontspec_make_OT_feature:n {#3} } % \cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx} % \end{macrocode} @@ -4669,52 +4858,49 @@ This work consists of this file fontspec.dtx \cs_new:Nn \fontspec_make_AAT_feature:nn { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {aat-feature-not-exist} } + { \@@_warning:n {aat-feature-not-exist} } { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} { - \fontspec_update_fontid:n {+#1,#2} - \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + \@@_update_featstr:n {\l_fontspec_feature_string_tl} } - { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + { \@@_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } -\cs_new:Nn \fontspec_make_ICU_feature:n +\cs_new:Nn \fontspec_make_OT_feature:n { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {icu-feature-not-exist} } + { \@@_warning:n {icu-feature-not-exist} } { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1} - \fontspec_update_featstr:n{#1} + \@@_update_featstr:n {#1} } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \@@_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} - \fontspec_update_featstr:n { #1 = #2 } + \@@_update_featstr:n { #1 = #2 } } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \@@_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}{\@@_define_font_feature:n} +% \begin{macro}{\@@_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 +\cs_new:Nn \@@_define_font_feature:n { \keys_define:nn {fontspec} { #1 .multichoice: } } -\cs_new:Nn \fontspec_define_feature_option:nnnnn +\cs_new:Nn \@@_define_feature_option:nnnnn { \keys_define:nn {fontspec} { @@ -4977,15 +5163,15 @@ This work consists of this file fontspec.dtx % with |kpsewhich|; it's either in the current directory or the \TeX\ tree. Otherwise, the % argument given defines the file path of the font. % \begin{macrocode} -\bool_new:N \l_fontspec_external_bool +\bool_new:N \l_@@_external_bool \@@_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { - \bool_set_true:N \l_fontspec_nobf_bool - \bool_set_true:N \l_fontspec_noit_bool - \bool_set_true:N \l_fontspec_external_bool - \cs_gset:Npn \fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \bool_set_true:N \l_@@_nobf_bool + \bool_set_true:N \l_@@_noit_bool + \bool_set_true:N \l_@@_external_bool + \cs_gset:Npn \@@_namewrap:n ##1 { [ #1 ##1 ] } %<*xetexx> - \keys_set:nn {fontspec-renderer} {Renderer=ICU} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} % } \aliasfontfeature{ExternalLocation}{Path} @@ -4997,13 +5183,13 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse-external} {Extension} { - \tl_set:Nn \l_fontspec_extension_tl {#1} - \bool_if:NF \l_fontspec_external_bool + \tl_set:Nn \l_@@_extension_tl {#1} + \bool_if:NF \l_@@_external_bool { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } } -\tl_clear:N \l_fontspec_extension_tl +\tl_clear:N \l_@@_extension_tl % \end{macrocode} % % \subsubsection{Pre-parsed features} @@ -5019,19 +5205,18 @@ This work consists of this file fontspec.dtx { 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 } % %<*luatex> - \fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/ICU/Graphite} + \@@_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} % } { %<*xetexx> - \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} + \@@_warning:nx {only-luatex-feature} {Renderer=Full/Basic} % %<*luatex> \tl_set:Nv \l_fontspec_mode_tl @@ -5040,10 +5225,11 @@ This work consists of this file fontspec.dtx } } , - Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic} + Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} -\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU} +\tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} +\tl_set:cn {g_fontspec_renderer_tag_OpenType} {/OT} \tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR} \tl_set:cn {g_fontspec_mode_tag_Full} {node} \tl_set:cn {g_fontspec_mode_tag_Basic} {base} @@ -5054,18 +5240,16 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {Script} { -% \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_script_name_tl {#1} - \fontspec_update_fontid:n {+script:#1} +% \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l_@@_script_name_tl {#1} } % \end{macrocode} % Exactly the same: % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {Language} { -% \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \fontspec_update_fontid:n {+language:#1} +% \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l_@@_lang_name_tl {#1} } % \end{macrocode} % @@ -5075,30 +5259,60 @@ This work consists of this file fontspec.dtx % features are for defining explicitly the bold and italic fonts used % in a font family. % +% \paragraph{Bold (NFSS) Series} +% By default, \pkg{fontspec} uses the default bold series, \cs{bfdefault}. +% We want to be able to make this extensible. +% \begin{macrocode} +\seq_new:N \g_@@_bf_series_seq +\@@_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} + { + \tl_gset:Nx \g_@@_curr_series_tl { #1 } + \seq_gput_right:Nx \g_@@_bf_series_seq { #1 } + } +% \end{macrocode} +% % \paragraph{Fonts} % Upright: % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} - \fontspec_update_fontid:n {up:#1} + } +\@@_keys_define_code:nnn {fontspec-preparse-external} {FontName} + { + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} } % \end{macrocode} % Bold: % \begin{macrocode} +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nobf_bool - \fontspec_update_fontid:n {nobf} + \bool_set_true:N \l_@@_nobf_bool } { - \bool_set_false:N \l_fontspec_nobf_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} - \fontspec_update_fontid:n {bf:#1} + \bool_set_false:N \l_@@_nobf_bool + \fontspec_complete_fontname:Nn \l_@@_curr_bfname_tl {#1} + + \seq_if_empty:NT \g_@@_bf_series_seq + { + \tl_gset:Nx \g_@@_curr_series_tl {\bfdefault} + \seq_put_right:Nx \g_@@_bf_series_seq {\bfdefault} + } + \tl_if_eq:oxT \g_@@_curr_series_tl {\bfdefault} + { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_@@_curr_bfname_tl } + +%\typeout{Setting~bold~font~"\l_@@_curr_bfname_tl"~with~series~"\g_@@_curr_series_tl"} + + \prop_put:NxV \l_@@_nfss_prop + {BoldFont-\g_@@_curr_series_tl} \l_@@_curr_bfname_tl + } } +\prop_new:N \l_@@_nfss_prop % \end{macrocode} % Same for italic: % \begin{macrocode} @@ -5106,13 +5320,11 @@ This work consists of this file fontspec.dtx { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_noit_bool - \fontspec_update_fontid:n {noit} + \bool_set_true:N \l_@@_noit_bool } { - \bool_set_false:N \l_fontspec_noit_bool + \bool_set_false:N \l_@@_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} - \fontspec_update_fontid:n {it:#1} } } % \end{macrocode} @@ -5121,17 +5333,14 @@ This work consists of this file fontspec.dtx \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} - \fontspec_update_fontid:n {bfit:#1} } \@@_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} - \fontspec_update_fontid:n {sl:#1} } \@@_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { \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: @@ -5140,13 +5349,11 @@ This work consists of this file fontspec.dtx { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nosc_bool - \fontspec_update_fontid:n {nosc} + \bool_set_true:N \l_@@_nosc_bool } { - \bool_set_true:N \l_fontspec_nosc_bool + \bool_set_false:N \l_@@_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} - \fontspec_update_fontid:n {sc:#1} } } % \end{macrocode} @@ -5158,8 +5365,8 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_set:Nn \fontspec_complete_fontname:Nn { - \tl_set:Nn #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl} + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l_@@_basename_tl} % \tl_remove_all:Nn #1 {~} } \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} @@ -5167,70 +5374,83 @@ This work consists of this file fontspec.dtx % \end{macro} % % \paragraph{Features} -% Can't use |\clist_set:Nn| below, yet, because it would strip the leading comma -% and we use that implicitly to concatenate options. +% % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_up_clist { , #1} - \fontspec_update_fontid:n {rmfeat:#1} + \clist_set:Nn \l_@@_fontfeat_up_clist {#1} } \@@_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bf_clist {, #1} - \fontspec_update_fontid:n {bffeat:#1} + \ + \clist_set:Nn \l_@@_fontfeat_bf_clist {#1} + + \prop_put:NxV \l_@@_nfss_prop + {BoldFont-\g_@@_curr_series_tl} \l_@@_curr_bfname_tl } \@@_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_it_clist {, #1} - \fontspec_update_fontid:n {itfeat:#1} + \clist_set:Nn \l_@@_fontfeat_it_clist {#1} } \@@_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfit_clist {, #1} - \fontspec_update_fontid:n {bfitfeat:#1} + \clist_set:Nn \l_@@_fontfeat_bfit_clist {#1} } \@@_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_sl_clist {, #1} - \fontspec_update_fontid:n {slfeat:#1} + \clist_set:Nn \l_@@_fontfeat_sl_clist {#1} } \@@_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfsl_clist {, #1} - \fontspec_update_fontid:n {bfslfeat:#1} + \clist_set:Nn \l_@@_fontfeat_bfsl_clist {#1} } % \end{macrocode} % Note that small caps features can vary by shape, so these in fact \emph{aren't} pre-parsed. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {SmallCapsFeatures} { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l_@@_firsttime_bool { - \tl_set:Nn \l_fontspec_fontfeat_sc_clist {, #1} + \clist_set:Nn \l_@@_fontfeat_sc_clist {#1} } - \fontspec_update_fontid:n {scfeat:#1} } % \end{macrocode} % % paragraph{Features varying by size} -% TODO: sizezfeatures and italicfont (etc) don't play nice % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} { - \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \fontspec_update_fontid:n {sizefeat:#1} + \clist_set:Nn \l_@@_sizefeat_clist {#1} + \clist_put_right:Nn \l_@@_fontfeat_up_clist { SizeFeatures = {#1} } + } +\@@_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} + { + \clist_set:Nn \l_@@_sizefeat_clist {#1} + \tl_if_empty:NT \l_@@_this_font_tl + { \tl_set:Nn \l_@@_this_font_tl { -- } } % needs to be non-empty as a flag + } +\@@_keys_define_code:nnn {fontspec-preparse-nested} {Font} + { + \tl_set:Nn \l_@@_this_font_tl {#1} + } +\@@_keys_define_code:nnn {fontspec} {SizeFeatures} + { + % dummy + } +\@@_keys_define_code:nnn {fontspec} {Font} + { + % dummy } % \end{macrocode} % % \begin{macrocode} \@@_keys_define_code:nnn {fontspec-sizing} {Size} { - \tl_set:Nn \l_fontspec_size_tl {#1} + \tl_set:Nn \l_@@_size_tl {#1} } \@@_keys_define_code:nnn {fontspec-sizing} {Font} { - \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1} + \fontspec_complete_fontname:Nn \l_@@_sizedfont_tl {#1} } % \end{macrocode} % @@ -5238,6 +5458,76 @@ This work consists of this file fontspec.dtx % % These features can be applied to any font. % +% \paragraph{NFSS family} +% Interactions with other packages will sometimes require setting the NFSS family explicitly. +% (By default \pkg{fontspec} auto-generates one based on the font name.) +% \begin{macrocode} +\@@_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} + { + \tl_set:Nx \l_@@_nfss_fam_tl { #1 } + \cs_undefine:c {g_@@_UID_\l_@@_fontid_tl} + \tl_if_exist:NT \l_fontspec_family_tl + { \cs_undefine:c {g_@@_ \l_fontspec_family_tl _prop} } + } +% \end{macrocode} +% +% \paragraph{NFSS series/shape} +% This option looks similar in name but has a very different function. +% \begin{macrocode} +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\prop_new:N \l_@@_nfssfont_prop +\@@_keys_define_code:nnn {fontspec} {FontFace} + { + \tl_set:No \l_@@_arg_tl { \use_iii:nnn #1 } + \tl_set_eq:NN \l_@@_this_feat_tl \l_@@_arg_tl + \tl_clear:N \l_@@_this_font_tl + \int_compare:nT { \clist_count:N \l_@@_arg_tl = 1 } + { +%<*debug> + \typeout{FontFace~ parsing:~ one~ clist~ item} +% + \tl_if_in:NnF \l_@@_arg_tl {=} + { +%<*debug> + \typeout{FontFace~ parsing:~ no~ equals~ =>~ font~ name~ only} +% + \tl_set_eq:NN \l_@@_this_font_tl \l_@@_arg_tl + \tl_clear:N \l_@@_this_feat_tl + } + } + + \@@_add_nfssfont:oooo + {\use_i:nnn #1}{\use_ii:nnn #1}{\l_@@_this_font_tl}{\l_@@_this_feat_tl} + } +% \end{macrocode} +% +% +% \begin{macro}{\@@_add_nfssfont:nnnn} +% \darg{series} +% \darg{shape} +% \darg{fontname} +% \darg{fontspec features} +% \begin{macrocode} +\cs_new:Nn \@@_add_nfssfont:nnnn + { + \tl_set:Nx \l_@@_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l_@@_sizefeat_clist {Size={-}} } + { \keys_set_known:noN {fontspec-preparse-nested} {#4} \l_@@_tmp_tl } + + \tl_if_empty:NF \l_@@_this_font_tl + { + \prop_put:Nxx \l_@@_nfssfont_prop {#1/#2} + { {#1}{#2}{\l_@@_this_font_tl}{#4}{\l_@@_sizefeat_clist} } + } + } +\cs_generate_variant:Nn \@@_add_nfssfont:nnnn {ooo} +\cs_generate_variant:Nn \@@_add_nfssfont:nnnn {oooo} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} +% \end{macrocode} +% \end{macro} +% % \paragraph{Scale} % If the input isn't one of the pre-defined string options, then % it's gotta be numerical. \cs{fontspec_calc_scale:n} does all the work in @@ -5247,16 +5537,15 @@ This work consists of this file fontspec.dtx { \str_case:nnn {#1} { - {MatchLowercase} { \fontspec_calc_scale:n {5} } - {MatchUppercase} { \fontspec_calc_scale:n {8} } + {MatchLowercase} { \@@_calc_scale:n {5} } + {MatchUppercase} { \@@_calc_scale:n {8} } } - { \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] } + { \tl_set:Nx \l_@@_scale_tl {#1} } + \tl_set:Nx \l_@@_scale_tl { s*[\l_@@_scale_tl] } } % \end{macrocode} % -% \begin{macro}{\fontspec_calc_scale:n} +% \begin{macro}{\@@_calc_scale:n} % This macro calculates the amount of scaling between the default % roman font and the (default shape of) the font being selected such % that the font dimension that is input is equal for both. The only @@ -5267,31 +5556,31 @@ 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:Nn \fontspec_calc_scale:n +\cs_new:Nn \@@_calc_scale:n { \group_begin: \rmfamily - \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} + \@@_set_font_dimen:NnN \l_@@_tmpa_dim {#1} \font + \@@_set_font_dimen:NnN \l_@@_tmpb_dim {#1} \l_fontspec_font + \fp_set_from_dim:Nn \l_@@_tmpa_fp { \l_@@_tmpa_dim } + \fp_set_from_dim:Nn \l_@@_tmpb_fp { \l_@@_tmpb_dim } + \fp_div:Nn \l_@@_tmpa_fp { \l_@@_tmpb_fp } + \tl_gset:Nx \l_@@_scale_tl { \fp_use:N \l_@@_tmpa_fp } + \@@_info:n {set-scale} \group_end: } % \end{macrocode} % \end{macro} % % -% \begin{macro}{\fontspec_set_font_dimen:NnN} +% \begin{macro}{\@@_set_font_dimen:NnN} % This function sets the dimension |#1| (for font |#3|) to `fontdimen' |#2| % for either font dimension 5 (x-height) or 8 (cap-height). If, for some % reason, these return an incorrect `zero' value (as \cs{fontdimen8} might % 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:Nn \fontspec_set_font_dimen:NnN +\cs_new:Nn \@@_set_font_dimen:NnN { \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} @@ -5317,8 +5606,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {WordSpace} { - \fontspec_update_fontid:n {+wordspace:#1} - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l_@@_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } % \end{macrocode} @@ -5332,7 +5620,7 @@ This work consists of this file fontspec.dtx { \tl_if_empty:nTF {#4} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l_@@_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #1 \fontdimen 3 \font @@ -5340,7 +5628,7 @@ This work consists of this file fontspec.dtx } } { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l_@@_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #2 \fontdimen 3 \font @@ -5356,9 +5644,23 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {PunctuationSpace} { - \fontspec_update_fontid:n {+punctspace:#1} - \tl_put_right:Nx \l_fontspec_postadjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } + \str_case_x:nnn {#1} + { + {WordSpace} + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l_@@_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } } % \end{macrocode} % @@ -5367,8 +5669,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {FontAdjustment} { - \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} - \tl_put_right:Nx \l_fontspec_postadjust_tl {#1} + \tl_put_right:Nx \l_@@_postadjust_tl {#1} } % \end{macrocode} % @@ -5376,8 +5677,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {LetterSpace} { - \fontspec_update_fontid:n {+tracking:#1} - \fontspec_update_featstr:n{letterspace=#1} + \@@_update_featstr:n {letterspace=#1} } % \end{macrocode} % @@ -5389,10 +5689,9 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {HyphenChar} { - \fontspec_update_fontid:n {+hyphenchar:#1} \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l_@@_postadjust_tl { \hyphenchar \font = \c_minus_one } } { @@ -5401,7 +5700,7 @@ This work consists of this file fontspec.dtx { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l_@@_postadjust_tl %<*xetexx> { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: } % @@ -5412,7 +5711,7 @@ This work consists of this file fontspec.dtx } % } - { \fontspec_error:nx {no-glyph}{#1} } + { \@@_error:nx {no-glyph}{#1} } } } % \end{macrocode} @@ -5422,52 +5721,50 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Color} { - \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF { \token_to_str:N \color@ #1 } { - \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl + \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl } { \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_fontspec_hexcol_tl {#1} } + { \tl_set:Nn \l_@@_hexcol_tl {#1} } { \int_compare:nTF { \tl_count:n {#1} == 8 } { \fontspec_parse_colour:viii #1 } { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {bad-colour} {#1} } + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {bad-colour} {#1} } } } } } \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} - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \tl_set:Nn \l_@@_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l_@@_opacity_tl \g_@@_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice-col} {#7#8} } + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {opa-twice-col} {#7#8} } } - \tl_set:Nn \l_fontspec_opacity_tl {#7#8} + \tl_set:Nn \l_@@_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} % \end{macrocode} % \begin{macrocode} -\int_new:N \l_fontspec_tmp_int +\int_new:N \l_@@_tmp_int \@@_keys_define_code:nnn {fontspec} {Opacity} { - \fontspec_update_fontid:n {+opac:#1} - \int_set:Nn \l_fontspec_tmp_int {255} - \_int_mult_truncate:Nn \l_fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \int_set:Nn \l_@@_tmp_int {255} + \@@_int_mult_truncate:Nn \l_@@_tmp_int { #1 } + \tl_if_eq:NNF \l_@@_opacity_tl \g_@@_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice} {#1} } + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {opa-twice} {#1} } } - \tl_set:Nx \l_fontspec_opacity_tl + \tl_set:Nx \l_@@_opacity_tl { - \int_compare:nT { \l_fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l_fontspec_tmp_int } + \int_compare:nT { \l_@@_tmp_int <= "F } {0} % zero pad + \int_to_hexadecimal:n { \l_@@_tmp_int } } } % \end{macrocode} @@ -5478,19 +5775,18 @@ This work consists of this file fontspec.dtx \@@_keys_define_code:nnn {fontspec} {Mapping} %<*xetexx> { - \fontspec_update_fontid:n {+map:#1} - \fontspec_update_featstr:n{mapping=#1} + \@@_update_featstr:n { mapping = #1 } } % %<*luatex> { \str_if_eq:nnTF {#1} {tex-text} { - \fontspec_warning:n {no-mapping-ligtex} + \@@_warning:n {no-mapping-ligtex} \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} \keys_set:nn {fontspec} { Ligatures=TeX } } - { \fontspec_warning:n {no-mapping} } + { \@@_warning:n {no-mapping} } } % % \end{macrocode} @@ -5499,8 +5795,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {FeatureFile} { - \fontspec_update_fontid:n {+fea:#1} - \fontspec_update_featstr:n{featurefile=#1} + \@@_update_featstr:n { featurefile = #1 } } % \end{macrocode} % @@ -5510,40 +5805,35 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Weight} { - \fontspec_update_fontid:n {+weight:#1} - \fontspec_update_featstr:n{weight=#1} + \@@_update_featstr:n{weight=#1} } \@@_keys_define_code:nnn {fontspec} {Width} { - \fontspec_update_fontid:n {+width:#1} - \fontspec_update_featstr:n{width=#1} + \@@_update_featstr:n{width=#1} } \@@_keys_define_code:nnn {fontspec} {OpticalSize} %<*xetexx> { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l_@@_ot_bool { - \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} } { - \bool_if:NT \l_fontspec_mm_bool + \bool_if:NT \l_@@_mm_bool { - \fontspec_update_fontid:n {+size:#1} - \fontspec_update_featstr:n{optical size=#1} + \@@_update_featstr:n { optical size = #1 } } } - \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool } + \bool_if:nT { !\l_@@_ot_bool && !\l_@@_mm_bool } { - \bool_if:NT \l_fontspec_firsttime_bool - { \fontspec_warning:n {no-opticals} } + \bool_if:NT \l_@@_firsttime_bool + { \@@_warning:n {no-opticals} } } } % %<*luatex> { - \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l_@@_optical_size_tl {/ S = #1} } % % \end{macrocode} @@ -5555,8 +5845,7 @@ This work consists of this file fontspec.dtx { FakeSlant .code:n = { - \fontspec_update_fontid:n {+slant:#1} - \fontspec_update_featstr:n{slant=#1} + \@@_update_featstr:n{slant=#1} }, FakeSlant .default:n = {0.2} } @@ -5564,8 +5853,7 @@ This work consists of this file fontspec.dtx { FakeStretch .code:n = { - \fontspec_update_fontid:n {+extend:#1} - \fontspec_update_featstr:n{extend=#1} + \@@_update_featstr:n{extend=#1} }, FakeStretch .default:n = {1.2} } @@ -5574,8 +5862,7 @@ This work consists of this file fontspec.dtx { FakeBold .code:n = { - \fontspec_update_fontid:n {+embolden:#1} - \fontspec_update_featstr:n{embolden=#1} + \@@_update_featstr:n {embolden=#1} }, FakeBold .default:n = {1.5} } @@ -5583,7 +5870,7 @@ This work consists of this file fontspec.dtx %<*luatex> \keys_define:nn {fontspec} { - FakeBold .code:n = { \fontspec_warning:n {fakebold-only-xetex} } + FakeBold .code:n = { \@@_warning:n {fakebold-only-xetex} } } % % \end{macrocode} @@ -5602,20 +5889,18 @@ This work consists of this file fontspec.dtx { AutoFakeSlant .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l_@@_firsttime_bool { \tl_set:Nn \l_fontspec_fake_slant_tl {#1} - \clist_put_right:Nn \l_fontspec_fontfeat_it_clist {FakeSlant=#1} + \clist_put_right:Nn \l_@@_fontfeat_it_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_noit_bool - - \fontspec_update_fontid:n {fakeit:#1} + \bool_set_false:N \l_@@_noit_bool \tl_if_empty:NF \l_fontspec_fake_embolden_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeBold=\l_fontspec_fake_embolden_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -5629,20 +5914,18 @@ This work consists of this file fontspec.dtx { AutoFakeBold .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l_@@_firsttime_bool { \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l_fontspec_fontfeat_bf_clist {FakeBold=#1} + \clist_put_right:Nn \l_@@_fontfeat_bf_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_nobf_bool - - \fontspec_update_fontid:n {fakebf:#1} + \bool_set_false:N \l_@@_nobf_bool \tl_if_empty:NF \l_fontspec_fake_slant_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeSlant=\l_fontspec_fake_slant_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeBold=#1} + \clist_put_right:Nx \l_@@_fontfeat_bfit_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -5658,31 +5941,31 @@ This work consists of this file fontspec.dtx % definitions (|\xdef|) in [...]). Both \AAT\ and OpenType % names are offered to chose |Rare|/|Discretionary| ligatures. % \begin{macrocode} -\fontspec_define_font_feature:n{Ligatures} -\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} +\@@_define_font_feature:n{Ligatures} +\@@_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\@@_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\@@_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\@@_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\@@_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\@@_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\@@_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\@@_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\@@_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\@@_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\@@_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\@@_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\@@_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\@@_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\@@_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\@@_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\@@_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\@@_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\@@_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\@@_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\@@_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\@@_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\@@_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\@@_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} % \end{macrocode} % Emulate CM extra ligatures. % \begin{macrocode} @@ -5690,27 +5973,29 @@ This work consists of this file fontspec.dtx { Ligatures / TeX .code:n = { -% \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} +%<*xetexx> + \@@_update_featstr:n { mapping = tex-text } +% +%<*luatex> + \@@_update_featstr:n { +tlig; +trep } +% } } % \end{macrocode} % % \subsubsection{Letters} % \begin{macrocode} -\fontspec_define_font_feature:n{Letters} -\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} +\@@_define_font_feature:n{Letters} +\@@_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\@@_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\@@_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\@@_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\@@_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\@@_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\@@_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\@@_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\@@_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\@@_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} % \end{macrocode} % % \subsubsection{Numbers} @@ -5722,15 +6007,15 @@ This work consists of this file fontspec.dtx % Both naming conventions are offered to select the number case. % % \begin{macrocode} -\fontspec_define_font_feature:n{Numbers} -\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} +\@@_define_font_feature:n{Numbers} +\@@_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\@@_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\@@_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\@@_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\@@_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\@@_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\@@_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\@@_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} % \end{macrocode} % % |luaotload| provides a custom |anum| feature for replacing Latin @@ -5740,76 +6025,76 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \luatex_if_engine:T { - \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} + \@@_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} } % \end{macrocode} % % \subsubsection{Contextuals} % \begin{macrocode} -\fontspec_define_font_feature:n {Contextuals} -\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\@@_define_font_feature:n {Contextuals} +\@@_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\@@_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\@@_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\@@_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\@@_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\@@_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\@@_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\@@_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\@@_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\@@_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\@@_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\@@_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\@@_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\@@_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} % \end{macrocode} % % \subsubsection{Diacritics} % \begin{macrocode} -\fontspec_define_font_feature:n{Diacritics} -\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\@@_define_font_feature:n{Diacritics} +\@@_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\@@_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\@@_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\@@_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\@@_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\@@_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\@@_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\@@_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\@@_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\@@_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\@@_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} % \end{macrocode} % % \subsubsection{Kerning} % \begin{macrocode} -\fontspec_define_font_feature:n{Kerning} -\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -%\fontspec_define_feature_option:nnnnn{Kerning}{Vertical}{}{}{+vkrn} -%\fontspec_define_feature_option:nnnnn{Kerning} +\@@_define_font_feature:n{Kerning} +\@@_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\@@_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\@@_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +%\@@_define_feature_option:nnnnn{Kerning}{Vertical}{}{}{+vkrn} +%\@@_define_feature_option:nnnnn{Kerning} % {VerticalAlternateProportional}{}{}{+vpal} -%\fontspec_define_feature_option:nnnnn{Kerning}{VerticalAlternateHalfWidth}{}{}{+vhal} +%\@@_define_feature_option:nnnnn{Kerning}{VerticalAlternateHalfWidth}{}{}{+vhal} % \end{macrocode} % % \subsubsection{Vertical position} % \begin{macrocode} -\fontspec_define_font_feature:n{VerticalPosition} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\@@_define_font_feature:n{VerticalPosition} +\@@_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\@@_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\@@_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\@@_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\@@_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\@@_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\@@_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} % \end{macrocode} % % \subsubsection{Fractions} % \begin{macrocode} -\fontspec_define_font_feature:n{Fractions} -\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} +\@@_define_font_feature:n{Fractions} +\@@_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\@@_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\@@_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\@@_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} % \end{macrocode} % % \subsubsection{Alternates and variants} @@ -5817,7 +6102,7 @@ This work consists of this file fontspec.dtx % easy to process, very annoying for the user! % % \begin{macrocode} -\fontspec_define_font_feature:n { Alternate } +\@@_define_font_feature:n { Alternate } \keys_define:nn {fontspec} { Alternate .default:n = {0} , @@ -5834,7 +6119,7 @@ This work consists of this file fontspec.dtx % \end{macrocode} % % \begin{macrocode} -\fontspec_define_font_feature:n {Variant} +\@@_define_font_feature:n {Variant} \keys_define:nn {fontspec} { Variant .default:n = {0} , @@ -5848,7 +6133,7 @@ This work consists of this file fontspec.dtx % \end{macrocode} % % \begin{macrocode} -\fontspec_define_font_feature:n { CharacterVariant } +\@@_define_font_feature:n { CharacterVariant } \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w @@ -5873,86 +6158,68 @@ This work consists of this file fontspec.dtx % Possibilities: \verb|a:0:\q_nil| or \verb|a:b:0:\q_nil|. % % -% \subsubsection{OpenType maths font features} -% Deprecated August 2011; delete at some stage in the future. -% \begin{macrocode} -\keys_define:nn {fontspec} - { - ScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=0} - \fontspec_update_featstr:n{+sstyle} - }, - ScriptScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=1} - \fontspec_update_featstr:n{+ssstyle} - } - } -% \end{macrocode} -% % % \subsubsection{Style} % \begin{macrocode} -\fontspec_define_font_feature:n{Style} -\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\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} +\@@_define_font_feature:n{Style} +\@@_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\@@_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\@@_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\@@_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\@@_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\@@_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\@@_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\@@_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\@@_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} +\@@_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} +\@@_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} % \begin{macrocode} -\fontspec_define_font_feature:n{CJKShape} -\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\@@_define_font_feature:n{CJKShape} +\@@_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\@@_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\@@_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\@@_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\@@_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\@@_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\@@_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} % \end{macrocode} % % \subsubsection{Character width} % \begin{macrocode} -\fontspec_define_font_feature:n{CharacterWidth} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\@@_define_font_feature:n{CharacterWidth} +\@@_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\@@_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\@@_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\@@_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\@@_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\@@_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\@@_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\@@_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} % \end{macrocode} % % \subsubsection{Annotation} % \begin{macrocode} -\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} +\@@_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\@@_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\@@_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\@@_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\@@_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\@@_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\@@_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\@@_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\@@_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\@@_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\@@_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\@@_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} % \end{macrocode} % % \begin{macrocode} -\fontspec_define_font_feature:n { Annotation } +\@@_define_font_feature:n { Annotation } \keys_define:nn {fontspec} { Annotation .default:n = {0} , @@ -5971,15 +6238,13 @@ This work consists of this file fontspec.dtx Vertical .choice: , Vertical / RotatedGlyphs .code:n = { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l_@@_ot_bool { \fontspec_make_feature:nnn{}{}{+vrt2} - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \@@_update_featstr:n {vertical} } { - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \@@_update_featstr:n {vertical} } } } @@ -6242,18 +6507,16 @@ This work consists of this file fontspec.dtx \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} + \@@_warning:nx {language-not-exist} {Turkish} \keys_set:nn {fontspec} {Language=Default} } } @@ -6266,7 +6529,6 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec}{ Language / Default } { - \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} \int_zero:N \l_fontspec_language_int } @@ -6278,8 +6540,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {RawFeature} { - \fontspec_update_fontid:n {+Raw:#1} - \fontspec_update_featstr:n{#1} + \@@_update_featstr:n {#1} } % \end{macrocode} % @@ -6371,23 +6632,23 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@ifpackageloaded{euler} { - \bool_set_true:N \g_fontspec_package_euler_loaded_bool + \bool_set_true:N \g_@@_pkg_euler_loaded_bool } { - \bool_set_false:N \g_fontspec_package_euler_loaded_bool + \bool_set_false:N \g_@@_pkg_euler_loaded_bool } \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { - \bool_if:NTF \g_fontspec_package_euler_loaded_bool - { \bool_set_true:N \g_fontspec_math_euler_bool } - { \fontspec_error:n {euler-too-late} } + \bool_if:NTF \g_@@_pkg_euler_loaded_bool + { \bool_set_true:N \g_@@_math_euler_bool } + { \@@_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_@@_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_@@_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_@@_math_lucida_bool}{} % \end{macrocode} % Knuth's CM fonts fonts are all squashed together, combining letters, % accents, text symbols and maths symbols all in the one font, @@ -6450,7 +6711,7 @@ This work consists of this file fontspec.dtx % The following symbols are only defined specifically in \pkg{euler}, so skip them % if that package is loaded. % \begin{macrocode} - \bool_if:NF \g_fontspec_math_euler_bool + \bool_if:NF \g_@@_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} @@ -6461,7 +6722,7 @@ This work consists of this file fontspec.dtx % so we only need to run this code if no extra maths package has been % loaded. % \begin{macrocode} - \bool_if:NF \g_fontspec_math_lucida_bool + \bool_if:NF \g_@@_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} @@ -6496,35 +6757,35 @@ This work consists of this file fontspec.dtx } % \end{macrocode} % Finally, we change the font definitions for \cmd\mathrm\ and so -% on. These are defined using the \cmd\g_fontspec_mathrm_tl\ (\dots) macros, +% on. These are defined using the \cmd\g_@@_mathrm_tl\ (\dots) macros, % which default to \cmd\rmdefault\ but may be specified with the % \cmd\setmathrm\ (\dots) commands in the preamble. % % Since \LaTeX\ only generally defines one level of boldness, we omit % \cmd\mathbf\ in the \textsf{bold} maths series. It can be specified % as per usual with \cmd\setboldmathrm, which stores the appropriate -% family name in \cmd\g_fontspec_bfmathrm_tl. -% \begin{macrocode} - \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 +% family name in \cmd\g_@@_bfmathrm_tl. +% \begin{macrocode} + \DeclareSymbolFont{operators}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\updefault + \SetSymbolFont{operators}{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathrm{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\updefault + \SetMathAlphabet\mathit{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathbf{normal}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathsf{normal}\g_fontspec_encoding_tl\g_@@_mathsf_tl\mddefault\updefault + \SetMathAlphabet\mathtt{normal}\g_fontspec_encoding_tl\g_@@_mathtt_tl\mddefault\updefault + \SetSymbolFont{operators}{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\updefault + \tl_if_empty:NTF \g_@@_bfmathrm_tl { - \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}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_@@_mathrm_tl\bfdefault\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\mathrm{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\mddefault\updefault + \SetMathAlphabet\mathbf{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\g_fontspec_encoding_tl\g_@@_bfmathrm_tl\mddefault\itdefault } - \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 + \SetMathAlphabet\mathsf{bold}\g_fontspec_encoding_tl\g_@@_mathsf_tl\bfdefault\updefault + \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\g_@@_mathtt_tl\bfdefault\updefault } % \end{macrocode} % \end{macro} @@ -6532,44 +6793,44 @@ This work consists of this file fontspec.dtx % \begin{macro}{\fontspec_maybe_setup_maths:} % We're a little less sophisticated about not executing the maths setup if various other maths font packages are loaded. This list is based on the wonderful `\LaTeX Font Catalogue': \url{http://www.tug.dk/FontCatalogue/mathfonts.html}. I'm sure there are more I've missed. Do the \TeX\ Gyre fonts have maths support yet? % -% Untested: would |\unless\ifnum\Gamma=28672\relax\bool_set_false:N \g_fontspec_math_bool\fi| be a better test? +% Untested: would |\unless\ifnum\Gamma=28672\relax\bool_set_false:N \g_@@_math_bool\fi| be a better test? % This needs more cooperation with euler and lucida, I think. % \begin{macrocode} \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_set_false:N \g_@@_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_@@_math_bool}{} \@ifpackageloaded{iwona} { - \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@iwona@mathversions a\bool_set_false:N \g_@@_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g_@@_math_bool}{} \@ifpackageloaded{kurier} { - \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@kurier@mathversions a\bool_set_false:N \g_@@_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}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} - \bool_if:NT \g_fontspec_math_bool + \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{fourier}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{lmodern}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_@@_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g_@@_math_bool}{} + \bool_if:NT \g_@@_math_bool { - \fontspec_info:n {setup-math} + \@@_info:n {setup-math} \fontspec_setup_maths: } } @@ -6581,7 +6842,7 @@ This work consists of this file fontspec.dtx % \subsection{Finishing up} % Now we just want to set up loading the \texttt{.cfg} file, if it exists. % \begin{macrocode} -\bool_if:NT \g_fontspec_cfg_bool +\bool_if:NT \g_@@_cfg_bool { \InputIfFileExists{fontspec.cfg} {} @@ -6948,11 +7209,20 @@ end % % \begin{macrocode} +\defaultfontfeatures + [\rmfamily,\sffamily] + {Ligatures=TeX} + +\defaultfontfeatures + [\ttfamily] + {WordSpace={1,0,0}, + PunctuationSpace=WordSpace} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%% -% Please note that most of the entries here from fontspec v1.x are -% no longer present. Please advise of any serious problems this causes. +% Entries here in time may be deleted. +% Please advise of any problems this causes. \aliasfontfeatureoption{Ligatures}{Historic}{Historical} \let\newfontinstance\newfontfamily @@ -6980,9 +7250,9 @@ end \usepackage{fontspec} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros} -\setmonofont[Scale=MatchLowercase]{Inconsolata} +\setmainfont{TeX Gyre Pagella} +\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase] +\setmonofont{Inconsolata}[Scale=MatchLowercase] \begin{document} \pagestyle{empty} @@ -6993,7 +7263,7 @@ The \textsf{fontspec} package enables automatic font selection for \LaTeX{} documents typeset with Xe\TeX{} or Lua\TeX. The basic command is -{\centering \verb|\fontspec[font features]{font display name}|.\par} +{\centering \verb|\fontspec{font display name}[font features]|.\par} The default, sans serif, and typewriter fonts may be set with the commands \verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|, @@ -7013,9 +7283,9 @@ called mid-document. Maths symbols themselves are not affected. Notice the font features used to load the default fonts in the preamble. -The first, \verb|Ligatures=TeX|, enables regular \TeX{} ligatures like -\verb|``---''| for ``---''. -The second, \verb|Scale=MatchLowercase|, automatically scales the fonts to +\verb|Ligatures=TeX| is automatically enabled for the roman and sans font, +allowing regular \TeX{} ligatures like \verb|``---''| for ``---''. +\verb|Scale=MatchLowercase| automatically scales the fonts to the same x-height. Please see the complete \textsf{fontspec} documentation for further @@ -7025,77 +7295,6 @@ information. % \end{macrocode} % % -%<*testsuite> -% -% \begin{macrocode} -\documentclass{article} -\usepackage{fontspec,fancyvrb,geometry,graphicx,calc,multicol} -\geometry{margin=2cm,a4paper} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\setmonofont{Inconsolata} - -\newcommand\meta[1]{$\langle$\emph{#1}$\rangle$} - -\newcommand\TEST[1]{% - \section{Test #1} - \begin{minipage}{0.5\textwidth} - \VerbatimInput{testsuite/#1.ltx} - \end{minipage} - \hfill - \begin{minipage}{8cm+4pt} - \fboxsep=1pt - \fboxrule=1pt - \fbox{\insertpdf#1\END} - \end{minipage} -} - -\def\insertpdf#1#2\END{% - \ifnum`#1=70\relax - \includegraphics[width=8cm]{testsuite/#1#2.Lsafe.pdf}% - \else - \includegraphics[width=8cm]{testsuite/#1#2.safe.pdf}% - \fi -} - -\newcommand\codeline[1]{\par{\centering#1\par}\par\noindent\ignorespaces} - -\pagestyle{empty} -\begin{document} -\title{The \textsf{fontspec} test suite} -\author{Will Robertson} -\date{Compiled: \today} -\maketitle -\thispagestyle{empty} - -\section*{Preamble} - -\begin{multicols}{2}\noindent -The examples shown in the remainder of the document are generated directly from the code shown alongside. -As well as being good minimal examples, these tests are useful to ensure that changes to \textsf{fontspec} don't affect old behaviour. - -When the test suite is run, the new output is compared pixel by pixel with that shown here and warnings produced if the outputs are not identical (within a small tolerance to account for rounding errors). - -Tests with a name that begins with `\textit X' are processed with \texttt{xelatex} only; `\textit L' with \texttt{lualatex}; and `\textit F' with both. -In the latter case, the output from both engines is compared with each other, ensuring that the package is consistent cross-platform. - -To generate tests yourself, write a new file in the \texttt{testsuite/} folder with filename -\codeline{\meta{F,L,X}\meta{num}\meta{letter}\texttt{.ltx}} -according to the naming scheme above and the following numbering scheme. If you are writing a new test entirely, increment the \meta{num}; if you are writing a variation on an old test, increment the \meta{letter}. No need to be too fussy, though. - -After writing the new test, run -\codeline{\texttt{make initest}} -This will generate the reference output (\texttt{*.safe.pdf}) from which to check all future tests. -After any changes have been made to \textsf{fontspec}, the entire test suite is compiled with \codeline{\texttt{make check}} -If you want to run just a single test, use -\codeline{\texttt{make }\meta{testname}} -(but this syntax \emph{may} be fragile and need to be changed in the future). -\end{multicols} - -\input{testsuite/testsuite-listing.tex} - -\end{document} -% \end{macrocode} -% % %<*doc-style> % \begin{macrocode} @@ -7248,7 +7447,6 @@ If you want to run just a single test, use } \def\prog@X{xelatex - -output-driver=xdv2pdf\space -jobname=\theexample-X-\filename\space} \def\prog@L{lualatex @@ -7277,7 +7475,6 @@ If you want to run just a single test, use \def\MacOSX{Mac~OS~X} \def\AAT{\textsc{aat}} \def\ATSUI{\textsc{atsui}} -\def\ICU{\textsc{icu}} %% (La)TeX font-related declarations: \linespread{1.05} % Pagella needs more space between lines 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 deleted file mode 100644 index 103bc0b4373..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature-option.ltx +++ /dev/null @@ -1,15 +0,0 @@ -\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 deleted file mode 100644 index 4caecfb471b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-alias-feature.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\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-autofake.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-autofake.ltx deleted file mode 100644 index 66c93682554..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-autofake.ltx +++ /dev/null @@ -1,16 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\Large -\def\text{ABC \textit{ABC} \textbf{ABC} - \textbf{\textit{ABC}}\\} -\fontspec{Inconsolata}\text -\fontspec[AutoFakeSlant]{Inconsolata}\text -\fontspec[AutoFakeBold]{Inconsolata}\text -\fontspec[AutoFakeSlant,AutoFakeBold] - {Inconsolata}\text -\fontspec[AutoFakeSlant=0.4]{Inconsolata}\text -\fontspec[AutoFakeBold=5]{Inconsolata}\text -\fontspec[AutoFakeSlant=0.4,AutoFakeBold=5] - {Inconsolata}\text -\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 deleted file mode 100644 index 183d66099e0..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-autoscaling.ltx +++ /dev/null @@ -1,12 +0,0 @@ -\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 deleted file mode 100644 index a9105f4a70f..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-charactervariant.ltx +++ /dev/null @@ -1,11 +0,0 @@ -\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/F-colour-basic.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx deleted file mode 100644 index b0d4b43aa6b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-basic.ltx +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\usepackage{xcolor} -\begin{document} -{\fontspec[Color=5500FF]{Verdana}Test} - -{\fontspec[Color=red]{Verdana}Test} vs -{\color{red}\fontspec{Verdana}Test} - -\definecolor{Foo}{rgb}{0.3,0.4,0.5} -{\fontspec[Color=Foo]{Verdana}Test} vs -{\color{Foo}\fontspec{Verdana}Test} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx deleted file mode 100644 index 7455431e2e3..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-clash.ltx +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\usepackage{xcolor} -\begin{document} -\fontspec{Verdana} -Black -\color{red} -Red - -\fontspec[Color=red]{Verdana} -\color{blue} -Red? -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx deleted file mode 100644 index afef4c2a539..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-colour-opacity.ltx +++ /dev/null @@ -1,17 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\usepackage{xcolor} -\begin{document} -\fontspec[Color=red]{Verdana} -Test - -\fontspec[ - 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 deleted file mode 100644 index 2fab9c6660e..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-feat-numbers.ltx +++ /dev/null @@ -1,18 +0,0 @@ -\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 deleted file mode 100644 index 28673b1c254..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-font-selection-bold.ltx +++ /dev/null @@ -1,11 +0,0 @@ -\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/F-hyphenchar.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx deleted file mode 100644 index 39cd453a155..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-hyphenchar.ltx +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\def\text{\fbox{\parbox{1.55cm}{% - EXAMPLE HYPHENATION% -}}\hfill} - -\fontspec{TeX Gyre Termes} -\addfontfeature{HyphenChar=None} -\text -\addfontfeature{HyphenChar={+}} -\text -\addfontfeature{HyphenChar={"2A}} -\text -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx deleted file mode 100644 index e24dea90cec..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-inner-emph.ltx +++ /dev/null @@ -1,11 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\renewcommand\eminnershape{\upshape\scshape} -\begin{document} -\setmainfont[ - ItalicFont=texgyrepagella-italic.otf - ]{texgyrepagella-regular.otf} -hello \emph{emph \emph{2emph} emph} hello - -hello {\em emph {\em 2emph} emph} hello -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx deleted file mode 100644 index 4aa54463b7a..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-basic.ltx +++ /dev/null @@ -1,13 +0,0 @@ - -\documentclass{testsuite} -\usepackage{fontspec} -\setmainfont[Ligatures=TeX]{TeX Gyre Pagella} -\begin{document} -Hello, moon!\par -\textsc{small caps}\par -`--Punctuation---' - -\def\itdefault{sl} -\setmainfont{Verdana} -Testing \textsl{slanted} edge case. -\end{document} \ No newline at end of file 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 deleted file mode 100644 index 98b4102b33b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-external-underdefined.ltx +++ /dev/null @@ -1,22 +0,0 @@ -\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 deleted file mode 100644 index d1593613039..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-nested-scfeat.ltx +++ /dev/null @@ -1,19 +0,0 @@ -\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/F-loading-scale.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx deleted file mode 100644 index 79f1c0dc2dd..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-scale.ltx +++ /dev/null @@ -1,16 +0,0 @@ - -\documentclass{testsuite} -\usepackage{fontspec} -\setmainfont[Color=FF0000]{Georgia} -\def\1{abcABC}\def\2{XYZxyz} -\def\test{\1\textsf{\2}\1\\} -\begin{document} -\setsansfont{Verdana} -\test -\setsansfont[Scale=0.5]{Verdana} -\test -\setsansfont[Scale=MatchLowercase]{Verdana} -\test -\setsansfont[Scale=MatchUppercase]{Verdana} -\test -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx deleted file mode 100644 index b6b32e4c0d1..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-loading-sizefeatures.ltx +++ /dev/null @@ -1,11 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\usepackage{xcolor} -\begin{document} - \fontspec[ SizeFeatures={ - {Size={-8}, Font=TeX Gyre Bonum Italic, Color=AA0000}, - {Size={8-14}, Color=00AA00}, - {Size={14-}, Color=0000AA}} ]{TeX Gyre Chorus} - - {\scriptsize Small\par} Normal size\par {\Large Large\par} -\end{document} \ No newline at end of file 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 deleted file mode 100644 index 12ef304e7ff..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-optical-sizes.ltx +++ /dev/null @@ -1,8 +0,0 @@ -\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 deleted file mode 100644 index b15bba6652b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx-2.ltx +++ /dev/null @@ -1,10 +0,0 @@ -\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 deleted file mode 100644 index 3d1487ed6f5..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-cvxx.ltx +++ /dev/null @@ -1,12 +0,0 @@ -\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/F-ot-ss06.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx deleted file mode 100644 index 08dc161729c..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-ot-ss06.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\Huge -\fontspec{Junicode} -Before -\addfontfeature{StylisticSet=6} -After -\end{document} diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx deleted file mode 100644 index c9ec65bc928..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-programmers-interface.ltx +++ /dev/null @@ -1,25 +0,0 @@ - -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\ExplSyntaxOn -LM~is -\fontspec_if_fontspec_font:TF {\ERROR}{~not~a~fontspec~font.\par} - -\setmainfont{TeX~ Gyre~ Pagella} -TeX Gyre Pagella -\fontspec_if_fontspec_font:TF {~is~a~fontspec~font}{\ERROR} - -\fontspec_if_opentype:TF {,~is~OpenType}{\ERROR} - -\fontspec_if_feature:nTF {smcp}{,~has~small~caps}{\ERROR} - -\fontspec_if_current_script:nTF {latn}{,~is~using~Latin~script}{\ERROR} - -\fontspec_if_script:nTF {cyrl}{,~also~has~Cyrillic}{\ERROR} - -\fontspec_if_current_language:nTF {DFLT}{,~is~using~`default'~language}{\ERROR} - -\fontspec_if_language:nnTF {latn}{ROM}{,~also~has~Romanian}{\ERROR} - -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx deleted file mode 100644 index f146623f66e..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-fancyvrb.ltx +++ /dev/null @@ -1,10 +0,0 @@ -\documentclass[twocolumn]{testsuite} -\usepackage{fontspec,fancyvrb} -\begin{document} -\begin{Verbatim} -testing spaces -\end{Verbatim} -\begin{Verbatim*} -testing spaces -\end{Verbatim*} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx deleted file mode 100644 index 4e818edff8b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-listings.ltx +++ /dev/null @@ -1,10 +0,0 @@ -\documentclass[twocolumn]{testsuite} -\usepackage{fontspec,listings} -\begin{document} -\begin{lstlisting} -testing spaces -\end{lstlisting} -\begin{lstlisting}[showspaces] -testing spaces -\end{lstlisting} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx deleted file mode 100644 index 83371207940..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-moreverb.ltx +++ /dev/null @@ -1,12 +0,0 @@ -\documentclass[twocolumn]{testsuite} -\usepackage{fontspec,moreverb} -\begin{document} -\setmainfont{texgyretermes-regular.otf} -\setmonofont{Inconsolata.otf} -\begin{listing}{7} -testing spaces -\end{listing} -\begin{listing*}{7} -testing spaces -\end{listing*} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx deleted file mode 100644 index 9f49e48bc13..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-plain.ltx +++ /dev/null @@ -1,24 +0,0 @@ -\documentclass[twocolumn]{testsuite} -\usepackage{fontspec} -\begin{document} -\setmainfont{texgyretermes-regular.otf} -\setmonofont{Inconsolata.otf} -\verb|testing spaces|\\ -\verb*|testing spaces| -\begin{verbatim} -testing spaces -\end{verbatim} -\begin{verbatim*} -testing spaces -\end{verbatim*} -\newpage -\setmonofont{Courier New} -\verb|testing spaces|\\ -\verb*|testing spaces| -\begin{verbatim} -testing spaces -\end{verbatim} -\begin{verbatim*} -testing spaces -\end{verbatim*} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx deleted file mode 100644 index 84e646b616b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-verb-verbatim.ltx +++ /dev/null @@ -1,24 +0,0 @@ -\documentclass[twocolumn]{testsuite} -\usepackage{fontspec,verbatim} -\begin{document} -\setmainfont{texgyretermes-regular.otf} -\setmonofont{Inconsolata.otf} -\verb|testing spaces|\\ -\verb*|testing spaces| -\begin{verbatim} -testing spaces -\end{verbatim} -\begin{verbatim*} -testing spaces -\end{verbatim*} -\newpage -\setmonofont{Courier New} -\verb|testing spaces|\\ -\verb*|testing spaces| -\begin{verbatim} -testing spaces -\end{verbatim} -\begin{verbatim*} -testing spaces -\end{verbatim*} -\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx deleted file mode 100644 index 92ccec4d1c0..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-wordspace.ltx +++ /dev/null @@ -1,20 +0,0 @@ -\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 deleted file mode 100644 index 2d7eb5952c6..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X-new-font-feature.ltx +++ /dev/null @@ -1,11 +0,0 @@ - -\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 deleted file mode 100644 index 1edda869a08..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex +++ /dev/null @@ -1,29 +0,0 @@ -\TEST{F-alias-feature-option} -\TEST{F-alias-feature} -\TEST{F-autofake} -\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-optical-sizes} -\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} -\TEST{X-new-font-feature} diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite.cls b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite.cls deleted file mode 100644 index 4c696c9dc35..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite.cls +++ /dev/null @@ -1,17 +0,0 @@ - -\ProvidesClass{testsuite} -\LoadClass{article} -\RequirePackage{geometry} -\geometry{ - papersize={9cm,6cm},margin=0.5cm -} -\pagestyle{empty} -\parindent=0pt -\parskip=10pt - -\newcommand\LATIN{ABCDEFGHIJKLMNOPQRSTUVWXYZ} -\newcommand\latin{abcdefghijklmnopqrstuvwxyz} - -\newcommand\GREEK{ΑΒΓΔΕΖΗΘϴΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ} -\newcommand\greek{αβγδεϵζηθϑικϰλμνξοπϖρϱςστυφϕχψω} - diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index 4758f213f0c..62ec78a76a5 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-luatex} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -26,7 +26,7 @@ \tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl -\tl_put_right:Nn \document +\AtBeginDocument { \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl @@ -35,114 +35,140 @@ \cs_set:Npn \XeTeXpicfile {} \RequirePackage{xunicode} \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp: -\DeclareDocumentCommand \fontspec { O{} m } +\DeclareDocumentCommand \fontspec { O{} m O{} } { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1,#3}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m } +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m } +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m } +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} \normalfont + \ignorespaces } \cs_set_eq:NN \setromanfont \setmainfont -\tl_new:N \g_fontspec_mathrm_tl -\tl_new:N \g_fontspec_bfmathrm_tl -\tl_new:N \g_fontspec_mathsf_tl -\tl_new:N \g_fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m } +\tl_new:N \g__fontspec_mathrm_tl +\tl_new:N \g__fontspec_bfmathrm_tl +\tl_new:N \g__fontspec_mathsf_tl +\tl_new:N \g__fontspec_mathtt_tl +\DeclareDocumentCommand \setmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m } +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathsf { O{} m } +\DeclareDocumentCommand \setmathsf { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathtt { O{} m } +\DeclareDocumentCommand \setmathtt { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\tl_set:Nn \g_fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g_fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g_fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m } +\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_select:nn{#2}{#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont } } } -\DeclareDocumentCommand \newfontface { m O{} m } +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } -\tl_new:N \g_fontspec_default_fontopts_tl +\clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop -\DeclareDocumentCommand \defaultfontfeatures { o m } +\DeclareDocumentCommand \defaultfontfeatures { t+ o m } { - \IfNoValueTF {#1} - { \__fontspec_set_default_features:n {#2} } - { \__fontspec_set_font_default_features:nn {#1} {#2} } + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } -\cs_new:Nn \__fontspec_set_default_features:n +\cs_new:Nn \__fontspec_set_default_features:nn { - \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g__fontspec_default_fontopts_clist {#2} } -\cs_new:Nn \__fontspec_set_font_default_features:nn +\cs_new:Nn \__fontspec_set_font_default_features:nnn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_gput:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l__fontspec_tmp_tl { \cs:w g__fontspec_ \cs_to_str:N ##1 _family\cs_end: } } + { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } + + \IfBooleanTF {#1} + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + { \tl_clear:N \l__fontspec_tmpb_tl } + \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} + \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_put:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } + } + } } + \cs_new:Nn \__fontspec_sanitise_fontname:Nn { \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } + +\bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF + { \group_begin: - \tl_clear:N \g_fontspec_default_fontopts_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {options} \l__fontspec_options_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontname} \l__fontspec_fontname_tl + \bool_set_true:N \l__fontspec_disable_defaults_bool \use:x { - \exp_not:N\fontspec_select:nn - {\csname zf@family@options\f@family\endcsname,#1} - {\csname zf@family@fontname\f@family\endcsname} + \exp_not:N \fontspec_select:nn + { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} } \group_end: \fontfamily\l_fontspec_family_tl\selectfont - \else - \fontspec_warning:n {addfontfeatures-ignored} - \fi + } + { + \__fontspec_warning:n {addfontfeatures-ignored} + } \ignorespaces } \cs_set_eq:NN \addfontfeature \addfontfeatures @@ -152,28 +178,27 @@ { #1 .code:n = { - \fontspec_update_fontid:n {+zf-#1} - \fontspec_update_featstr:n {#2} + \__fontspec_update_featstr:n {#2} } } } \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \fontspec_define_font_feature:n {#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}{} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{#3}{#4}{} } -\DeclareDocumentCommand \newICUfeature {mmm} +\DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \fontspec_define_font_feature:n{#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} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{}{}{#3} } -\cs_set_eq:NN \newopentypefeature \newICUfeature +\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \keys_if_exist:nnTF {fontspec} {#1} @@ -197,7 +222,7 @@ } } { - \fontspec_warning:nx {rename-feature-not-exist} {#1} + \__fontspec_warning:nx {rename-feature-not-exist} {#1} } } } @@ -215,18 +240,17 @@ \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} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} } { \fontspec_check_script:nTF {latn} { - \fontspec_warning:nx {script-not-exist-latn} {#1} + \__fontspec_warning:nx {script-not-exist-latn} {#1} \keys_set:nn {fontspec} {Script=Latin} } { - \fontspec_warning:nx {script-not-exist} {#1} + \__fontspec_warning:nx {script-not-exist} {#1} } } } @@ -242,32 +266,32 @@ \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} + \__fontspec_warning:nx {language-not-exist} {#1} \keys_set:nn { fontspec } { Language = Default } } } } \DeclareDocumentCommand \DeclareFontsExtensions {m} { - \tl_set:Nn \l_fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l_fontspec_extensions_clist {~} + \clist_set:Nn \l__fontspec_extensions_clist { #1 } + \tl_remove_all:Nn \l__fontspec_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \cs_if_exist:cTF {g_fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: + \cs_if_exist:cTF {g__fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \bool_if:NTF \l_fontspec_atsui_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \bool_if:NTF \l__fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -284,9 +308,10 @@ { \fontspec_if_fontspec_font:TF { - \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: + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: } { \prg_return_false: @@ -296,14 +321,20 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} - \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_language_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { @@ -318,9 +349,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} @@ -334,9 +366,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } @@ -348,12 +381,15 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } @@ -364,9 +400,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \tl_set:Nn \l_fontspec_script_tl {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} @@ -380,11 +417,13 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -395,11 +434,13 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -408,16 +449,19 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } +\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} \cs_new:Nn \fontspec_set_fontface:NNnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \fontspec_fontwrap:n { "#1" } +\cs_set:Nn \__fontspec_fontwrap:n { "#1" } \cs_if_free:NT \font_set_eq:NN { \cs_set_eq:NN \font_set_eq:NN \tex_let:D @@ -431,7 +475,7 @@ } \cs_set:Npn \font_suppress_not_found_error: {\luatexsuppressfontnotfounderror=1} - \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} + \prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -440,13 +484,13 @@ \fi } } -\cs_new:Nn \fontspec_font_set:Nnn +\cs_new:Nn \__fontspec_font_set:Nnn { - \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_set:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } -\cs_new:Nn \fontspec_font_gset:Nnn +\cs_new:Nn \__fontspec_font_gset:Nnn { - \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_gset:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } \prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { @@ -460,33 +504,32 @@ { \group_begin: \font_suppress_not_found_error: - \fontspec_init: + \__fontspec_init: + \tl_set:Nx \l_fontspec_fontname_tl {#2} \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 + \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \fontspec_preparse_features:nN {#1} \l_fontspec_fontname_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 \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 - \fontspec_set_scriptlang: - \fontspec_get_features:n {} - \bool_set_false:N \l_fontspec_firsttime_bool - \fontspec_save_family:nT {#2} + \__fontspec_extract_all_features:n {#1} + \__fontspec_preparse_features: + + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} + \bool_set_false:N \l__fontspec_firsttime_bool + + \__fontspec_save_family:nTF {#2} { - \fontspec_save_fontinfo:nn {#1} {#2} + \__fontspec_save_fontinfo: + \__fontspec_find_autofonts: \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} - \fontspec_set_upright: - \fontspec_set_bold: - \fontspec_set_italic: - \fontspec_set_slanted: - \fontspec_set_bold_italic: - \fontspec_set_bold_slanted: - } - \fontspec_info:nxx {defining-font} {#1} {#2} + \__fontspec_set_faces: + \__fontspec_info:nxx {defining-font} {#1} {#2} + } + { + } \group_end: } \cs_new:Nn \__fontspec_load_external_fontoptions:N @@ -498,311 +541,316 @@ { \file_input:n {\l__fontspec_tmp_tl.fontspec} } } } -\cs_new:Nn \fontspec_preparse_features:nN +\cs_new:Nn \__fontspec_extract_all_features:n { - \exp_args:NV \fontspec_if_detect_external:nT #2 - { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \keys_set_known:nxN {fontspec-preparse-external} + + \bool_if:NTF \l__fontspec_disable_defaults_bool + { + \clist_set:Nx \l__fontspec_all_features_clist + {#1} + } { - \g_fontspec_default_fontopts_tl - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #1 + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist + { \clist_clear:N \l__fontspec_family_fontopts_clist } + \tl_clear:N \l__fontspec_family_label_tl + + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } } - \l_fontspec_keys_leftover_clist + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + } +\cs_new:Nn \__fontspec_preparse_features: + { + \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } + + \keys_set_known:nxN {fontspec-preparse-external} + { \l__fontspec_all_features_clist } + \l__fontspec_keys_leftover_clist \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_keys_leftover_clist} - \l_fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist} - \l_fontspec_fontfeat_clist + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } +\cs_new:Nn \__fontspec_load_font: + { + \__fontspec_font_set:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \__fontspec_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 \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 } -\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} +\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} { - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { - \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l__fontspec_tmpa_bool \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_tmpa_bool \clist_map_break: } + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } } - \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } -\cs_set:Nn \fontspec_fullname:n +\cs_set:Nn \__fontspec_fullname:n { - \fontspec_namewrap:n { #1 \l_fontspec_extension_tl } + \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } \l_fontspec_renderer_tl - \l_fontspec_optical_size_tl - } -%% Now we have a unique (in fact, too unique!) string that contains -\prg_new_conditional:Nnn \fontspec_save_family:n {T} - { - \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \cs_if_exist:cTF {g_fontspec_family_#1_int} - { \int_gincr:c {g_fontspec_family_#1_int} } - { \int_new: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 \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: + \l__fontspec_optical_size_tl } -\cs_new:Nn \fontspec_set_scriptlang: +\cs_new:Nn \__fontspec_set_scriptlang: { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { - \tl_if_empty:NTF \l_fontspec_script_name_tl + \tl_if_empty:NTF \l__fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { - \tl_set:Nn \l_fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_set:Nn \l__fontspec_script_name_tl {Latin} + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\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} + \__fontspec_info:n {no-scripts} } } { - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\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} } } } -\cs_generate_variant:Nn \prop_gput:Nnn {cnV} -\cs_generate_variant:Nn \prop_gput:Nnn {cnx} -\cs_new:Nn \fontspec_save_fontinfo:nn +\prg_new_conditional:Nnn \__fontspec_save_family:n {TF} { - \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} + \cs_if_exist:NT \l__fontspec_nfss_fam_tl { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_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\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} + \cs_if_exist:cF {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - \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 - } -\cs_new:Nn \fontspec_set_upright: - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl - \mddefault \updefault \l_fontspec_fontfeat_up_clist - } -\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} - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } + \cs_if_exist:cTF {g__fontspec_family_#1_int} + { \int_gincr:c {g__fontspec_family_#1_int} } + { \int_new: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} { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist + \l__fontspec_tmp_tl ( \int_use:c {g__fontspec_family_#1_int} ) } } + \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: } -\cs_new:Nn \fontspec_set_italic: +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} +\cs_new:Nn \__fontspec_save_fontinfo: { - \bool_if:NF \l_fontspec_noit_bool + \prop_new:c {g__fontspec_ \l_fontspec_family_tl _prop} + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { \l__fontspec_basename_tl } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontdef} { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } - { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } - \mddefault \itdefault \l_fontspec_fontfeat_it_clist + \__fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + \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 + } -\cs_new:Nn \fontspec_set_slanted: +\cs_new:Nn \__fontspec_find_autofonts: { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \bool_if:nF {\l__fontspec_noit_bool || \l__fontspec_nobf_bool} { - \fontspec_make_font_shapes:nnnn - \l_fontspec_fontname_sl_tl \mddefault \sldefault - \l_fontspec_fontfeat_sl_clist + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} } - } -\cs_new:Nn \fontspec_set_bold_italic: - { - \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} + + \bool_if:NF \l__fontspec_nobf_bool { - \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_bf_tl - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} - } - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} - } - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl - } - \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} + } + + \bool_if:NF \l__fontspec_noit_bool + { + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} } + + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfsl_tl {\l_fontspec_fontname_sl_tl} {/B} + } +\cs_new:Nn \__fontspec_set_faces: + { + \__fontspec_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:oooo \bfdefault \sldefault \l_fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } + } +\cs_new:Nn \__fontspec_set_faces_aux:nnnnn + { + \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} + \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} + } +\cs_new:Nn \__fontspec_set_font_type: + { + \bool_set_true:N \l__fontspec_ot_bool } -\cs_new:Nn \fontspec_set_bold_slanted: +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_new:Nn \__fontspec_set_autofont:Nnn { - \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl + \bool_if:NF \l__fontspec_external_bool + { + \tl_if_empty:xF {#2} { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \tl_if_empty:NT #1 { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } } } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist } } -\cs_new:Nn \fontspec_set_font_type: + +\prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} { - \bool_set_true:N \l_fontspec_icu_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_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } } -\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn +\cs_new:Nn \__fontspec_make_font_shapes:Nnnnn { - \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_x:nnTF { \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: - \__fontspec_load_fontname:n {#1} - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } - - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl - { - \bool_if:NF \l_fontspec_nosc_bool - { - \fontspec_make_smallcaps:T - { - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , Letters=SmallCaps , \l_fontspec_fontfeat_sc_clist - } - } - } - } - { - \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , \l_fontspec_fontfeat_sc_clist - } - } + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, #4 } {#5} \group_end: } + \cs_new:Nn \__fontspec_load_fontname:n { \tl_set:Nx \l_fontspec_fontname_tl {#1} \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} } + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } } -\cs_new:Nn \fontspec_declare_shape:nnn +\cs_new:Nn \__fontspec_declare_shape:nnnn { - \clist_if_empty:NTF \l_fontspec_sizefeat_clist - { \__fontspec_declare_shape_nosizing:n {#3} } - { \__fontspec_declare_shape_withsizing:n {#3} } - \use:x + \tl_clear:N \l__fontspec_nfss_tl + \tl_clear:N \l__fontspec_nfss_sc_tl + \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl + + \exp_args:Nx \clist_map_inline:nn {#4} { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} {#2} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} + \tl_clear:N \l__fontspec_size_tl + \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed + + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \l__fontspec_sizing_leftover_clist + \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } + + % "normal" + \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_tl {#3} {} + + % small caps + \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist + + \bool_if:NF \l__fontspec_nosc_bool + { + \tl_if_empty:NTF \l_fontspec_fontname_sc_tl + { + \__fontspec_make_smallcaps:TF + { + \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} + } + { + \bool_set_true:N \l__fontspec_nosc_bool + } + } + { \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} }% local for each size + } + + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_sc_tl {#3} {\l__fontspec_fontfeat_curr_clist} + } + } + + \__fontspec_declare_shapes_normal:nn {#1} {#2} \__fontspec_declare_shape_slanted:nn {#1} {#2} \__fontspec_declare_shape_loginfo:nnn {#1} {#2} {#3} } -\cs_new:Nn \__fontspec_declare_shape_nosizing:n +\cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} + +\cs_new:Nn \__fontspec_setup_nfss:Nnn { - \fontspec_get_features:n {#1} - \tl_set:Nx \l_fontspec_nfss_tl + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist + { #2 , \l__fontspec_sizing_leftover_clist , #3 } + + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_fontwrap:n { - <-> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } + \__fontspec_fullname:n { \l_fontspec_fontname_tl } + : \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + } } -\cs_new:Nn \__fontspec_declare_shape_withsizing:n - { - \tl_clear:N \l_fontspec_nfss_tl - \clist_map_inline:Nn \l_fontspec_sizefeat_clist - { - - \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl - \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 { #1 , \l_fontspec_keys_leftover_clist } +\cs_new:Nn \__fontspec_declare_shapes_normal:nn + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} - \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 - } - } + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} + {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} + {\l__fontspec_nfss_sc_tl}{\l__fontspec_postadjust_tl} } } + +\cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn + { + \group_begin: + \normalsize + \cs_undefine:c {#1/#2/#3/#4/\f@size} + \group_end: + \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } +\cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn { \bool_if:nT @@ -811,11 +859,8 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \use:x - { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl} - } + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } \cs_new:Nn \__fontspec_declare_shape_loginfo:nnn @@ -826,23 +871,29 @@ *~ '\exp_not:N \str_case: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} + } {#2/#3}'~ + with~ NFSS~ spec.: \exp_not:N \\ + \l__fontspec_nfss_tl + \exp_not:n { \\ \\ } + *~ '\exp_not:N \str_case:nnn {#1/\scdefault} + { + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\sidefault} {italic~ small~ caps} {\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 + \l__fontspec_nfss_sc_tl + \tl_if_empty:NF \l__fontspec_postadjust_tl { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_fontspec_postadjust_tl + \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl } } } -\tl_set:Nn \l_fontspec_pre_feat_sclist +\clist_set:Nn \l__fontspec_pre_feat_sclist { mode = \l_fontspec_mode_tl ; \tl_if_empty:NF \l_fontspec_script_tl @@ -851,30 +902,28 @@ language = \l_fontspec_lang_tl ; } } -\cs_new:Nn \fontspec_update_fontid:n +\cs_set:Nn \__fontspec_get_features:Nn { - \bool_if:NT \l_fontspec_firsttime_bool + \sclist_clear:N \l__fontspec_rawfeatures_sclist + \tl_clear:N \l__fontspec_scale_tl + \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_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_clear:N \l__fontspec_wordspace_adjust_tl + \tl_clear:N \l__fontspec_punctspace_adjust_tl + + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \l__fontspec_keys_leftover_clist + \keys_set:nx {fontspec} {\l__fontspec_keys_leftover_clist} + \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } { - \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} + \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } -\cs_set:Nn \fontspec_get_features:n - { - \sclist_clear:N \l_fontspec_rawfeatures_sclist - \tl_clear:N \l_fontspec_scale_tl - \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 - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_fontfeat_clist,#1} - \l_fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l_fontspec_keys_leftover_clist} - \str_if_eq_x:nnF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } - { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } - { - \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} - } + \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } +\tl_clear:N \l__fontspec_family_label_tl \tl_clear:N \l_fontspec_fontname_bf_tl \tl_clear:N \l_fontspec_fontname_it_tl \tl_clear:N \l_fontspec_fake_slant_tl @@ -883,96 +932,106 @@ \tl_clear:N \l_fontspec_fontname_sl_tl \tl_clear:N \l_fontspec_fontname_bfsl_tl \tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l_fontspec_fontfeat_up_clist -\tl_clear:N \l_fontspec_fontfeat_bf_clist -\tl_clear:N \l_fontspec_fontfeat_it_clist -\tl_clear:N \l_fontspec_fontfeat_bfit_clist -\tl_clear:N \l_fontspec_fontfeat_sl_clist -\tl_clear:N \l_fontspec_fontfeat_bfsl_clist -\tl_clear:N \l_fontspec_fontfeat_sc_clist -\tl_clear:N \l_fontspec_script_name_tl +\tl_clear:N \l__fontspec_fontfeat_up_clist +\tl_clear:N \l__fontspec_fontfeat_bf_clist +\tl_clear:N \l__fontspec_fontfeat_it_clist +\tl_clear:N \l__fontspec_fontfeat_bfit_clist +\tl_clear:N \l__fontspec_fontfeat_sl_clist +\tl_clear:N \l__fontspec_fontfeat_bfsl_clist +\tl_clear:N \l__fontspec_fontfeat_sc_clist +\tl_clear:N \l__fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l_fontspec_lang_name_tl +\tl_clear:N \l__fontspec_lang_name_tl \tl_clear:N \l_fontspec_lang_tl -\clist_clear:N \l_fontspec_sizefeat_clist -\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~} -\cs_set:Npn \fontspec_init: - { - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_true:N \l_fontspec_firsttime_bool - \cs_set:Npn \fontspec_namewrap:n ##1 { ##1 } - \tl_clear:N \l_fontspec_optical_size_tl +\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } + +\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} +\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~} +\cs_set:Npn \__fontspec_init: + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \cs_set:Npn \__fontspec_namewrap:n ##1 { ##1 } + \tl_clear:N \l__fontspec_optical_size_tl \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl + \tl_clear:N \g__fontspec_curr_series_tl + + % This is for detecting font families when assigning default features. + % Replace defaults for the standard families because they're not set in the usual way: + \exp_args:NV \str_case:nnn {\l__fontspec_family_label_tl} + { + {\rmdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_rmfamily_family} } + {\sfdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_sffamily_family} } + {\ttdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_ttfamily_family} } + }{} + \tl_set:Nn \l_fontspec_mode_tl {node} \luatexprehyphenchar =`\- % fixme \luatexposthyphenchar = 0 % fixme \luatexpreexhyphenchar = 0 % fixme \luatexpostexhyphenchar= 0 % fixme } -\cs_set:Nn \fontspec_make_ot_smallcaps:T +\cs_set:Nn \fontspec_make_ot_smallcaps:TF { - \fontspec_check_ot_feat:nT {+smcp} { #1 } + \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} } -\cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T +\cs_set_eq:NN \__fontspec_make_smallcaps:TF \fontspec_make_ot_smallcaps:TF \cs_set_eq:NN \sclist_clear:N \tl_clear:N \cs_new:Nn \sclist_gput_right:Nn { \tl_gput_right:Nn #1 {#2;} } \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} -\cs_new:Nn \fontspec_update_featstr:n +\cs_new:Nn \__fontspec_update_featstr:n { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} + \sclist_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1} } } \cs_new:Nn \fontspec_make_feature:nnn - { \fontspec_make_ICU_feature:n {#3} } + { \fontspec_make_OT_feature:n {#3} } \cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx} \cs_new:Nn \fontspec_make_AAT_feature:nn { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {aat-feature-not-exist} } + { \__fontspec_warning:n {aat-feature-not-exist} } { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} { - \fontspec_update_fontid:n {+#1,#2} - \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } - { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } -\cs_new:Nn \fontspec_make_ICU_feature:n +\cs_new:Nn \fontspec_make_OT_feature:n { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {icu-feature-not-exist} } + { \__fontspec_warning:n {icu-feature-not-exist} } { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__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} - \fontspec_update_featstr:n { #1 = #2 } + \__fontspec_update_featstr:n { #1 = #2 } } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } \cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn} -\cs_new:Nn \fontspec_define_font_feature:n +\cs_new:Nn \__fontspec_define_font_feature:n { \keys_define:nn {fontspec} { #1 .multichoice: } } -\cs_new:Nn \fontspec_define_feature_option:nnnnn +\cs_new:Nn \__fontspec_define_feature_option:nnnnn { \keys_define:nn {fontspec} { @@ -1071,31 +1130,30 @@ { \keys_define:nn {#1} { #2 .code:n = {#3} } } -\bool_new:N \l_fontspec_external_bool +\bool_new:N \l__fontspec_external_bool \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { - \bool_set_true:N \l_fontspec_nobf_bool - \bool_set_true:N \l_fontspec_noit_bool - \bool_set_true:N \l_fontspec_external_bool - \cs_gset:Npn \fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \cs_gset:Npn \__fontspec_namewrap:n ##1 { [ #1 ##1 ] } } \aliasfontfeature{ExternalLocation}{Path} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} { - \tl_set:Nn \l_fontspec_extension_tl {#1} - \bool_if:NF \l_fontspec_external_bool + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } } -\tl_clear:N \l_fontspec_extension_tl +\tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { Renderer .choice_code:n = { - \fontspec_update_fontid:n {+rend:\l_keys_choice_tl} \int_compare:nTF {\l_keys_choice_int <= 3} { - \fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/ICU/Graphite} + \__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite} } { \tl_set:Nv \l_fontspec_mode_tl @@ -1103,165 +1161,237 @@ } } , - Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic} + Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} -\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU} +\tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} +\tl_set:cn {g_fontspec_renderer_tag_OpenType} {/OT} \tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR} \tl_set:cn {g_fontspec_mode_tag_Full} {node} \tl_set:cn {g_fontspec_mode_tag_Basic} {base} \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} { - \tl_set:Nn \l_fontspec_script_name_tl {#1} - \fontspec_update_fontid:n {+script:#1} + \tl_set:Nn \l__fontspec_script_name_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} { - \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \fontspec_update_fontid:n {+language:#1} + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } +\seq_new:N \g__fontspec_bf_series_seq +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} + { + \tl_gset:Nx \g__fontspec_curr_series_tl { #1 } + \seq_gput_right:Nx \g__fontspec_bf_series_seq { #1 } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} - \fontspec_update_fontid:n {up:#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {FontName} + { + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + } +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nobf_bool - \fontspec_update_fontid:n {nobf} + \bool_set_true:N \l__fontspec_nobf_bool } { - \bool_set_false:N \l_fontspec_nobf_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} - \fontspec_update_fontid:n {bf:#1} + \bool_set_false:N \l__fontspec_nobf_bool + \fontspec_complete_fontname:Nn \l__fontspec_curr_bfname_tl {#1} + + \seq_if_empty:NT \g__fontspec_bf_series_seq + { + \tl_gset:Nx \g__fontspec_curr_series_tl {\bfdefault} + \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} + } + \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} + { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } + + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl + } } +\prop_new:N \l__fontspec_nfss_prop \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_noit_bool - \fontspec_update_fontid:n {noit} + \bool_set_true:N \l__fontspec_noit_bool } { - \bool_set_false:N \l_fontspec_noit_bool + \bool_set_false:N \l__fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} - \fontspec_update_fontid:n {it:#1} } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} - \fontspec_update_fontid:n {bfit:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} - \fontspec_update_fontid:n {sl:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} - \fontspec_update_fontid:n {bfsl:#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nosc_bool - \fontspec_update_fontid:n {nosc} + \bool_set_true:N \l__fontspec_nosc_bool } { - \bool_set_true:N \l_fontspec_nosc_bool + \bool_set_false:N \l__fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} - \fontspec_update_fontid:n {sc:#1} } } \cs_set:Nn \fontspec_complete_fontname:Nn { - \tl_set:Nn #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl} + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} \tl_remove_all:Nn #1 {~} } \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_up_clist { , #1} - \fontspec_update_fontid:n {rmfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bf_clist {, #1} - \fontspec_update_fontid:n {bffeat:#1} + \ + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_it_clist {, #1} - \fontspec_update_fontid:n {itfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfit_clist {, #1} - \fontspec_update_fontid:n {bfitfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_sl_clist {, #1} - \fontspec_update_fontid:n {slfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfsl_clist {, #1} - \fontspec_update_fontid:n {bfslfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fontfeat_sc_clist {, #1} + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} } - \fontspec_update_fontid:n {scfeat:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} { - \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \fontspec_update_fontid:n {sizefeat:#1} + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \tl_if_empty:NT \l__fontspec_this_font_tl + { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } +\__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} + { + % dummy + } +\__fontspec_keys_define_code:nnn {fontspec} {Font} + { + % dummy } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Size} { - \tl_set:Nn \l_fontspec_size_tl {#1} + \tl_set:Nn \l__fontspec_size_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Font} { - \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} + } +\__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + \cs_undefine:c {g__fontspec_UID_\l__fontspec_fontid_tl} + \tl_if_exist:NT \l_fontspec_family_tl + { \cs_undefine:c {g__fontspec_ \l_fontspec_family_tl _prop} } + } +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\prop_new:N \l__fontspec_nfssfont_prop +\__fontspec_keys_define_code:nnn {fontspec} {FontFace} + { + \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } + \tl_set_eq:NN \l__fontspec_this_feat_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_font_tl + \int_compare:nT { \clist_count:N \l__fontspec_arg_tl = 1 } + { + \tl_if_in:NnF \l__fontspec_arg_tl {=} + { + \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_feat_tl + } + } + + \__fontspec_add_nfssfont:oooo + {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} + } +\cs_new:Nn \__fontspec_add_nfssfont:nnnn + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \keys_set_known:noN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } } +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {ooo} +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {oooo} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnn {#1} { - {MatchLowercase} { \fontspec_calc_scale:n {5} } - {MatchUppercase} { \fontspec_calc_scale:n {8} } + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } } - { \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] } + { \tl_set:Nx \l__fontspec_scale_tl {#1} } + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } } -\cs_new:Nn \fontspec_calc_scale:n +\cs_new:Nn \__fontspec_calc_scale:n { \group_begin: \rmfamily - \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} + \__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: } -\cs_new:Nn \fontspec_set_font_dimen:NnN +\cs_new:Nn \__fontspec_set_font_dimen:NnN { \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} @@ -1279,15 +1409,14 @@ } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} { - \fontspec_update_fontid:n {+wordspace:#1} - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #1 \fontdimen 3 \font @@ -1295,7 +1424,7 @@ } } { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #2 \fontdimen 3 \font @@ -1305,26 +1434,37 @@ } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} { - \fontspec_update_fontid:n {+punctspace:#1} - \tl_put_right:Nx \l_fontspec_postadjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } + \str_case_x:nnn {#1} + { + {WordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } } \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} { - \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} - \tl_put_right:Nx \l_fontspec_postadjust_tl {#1} + \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec} {LetterSpace} { - \fontspec_update_fontid:n {+tracking:#1} - \fontspec_update_featstr:n{letterspace=#1} + \__fontspec_update_featstr:n {letterspace=#1} } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} { - \fontspec_update_fontid:n {+hyphenchar:#1} \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { @@ -1333,99 +1473,92 @@ { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_zero \luatexprehyphenchar = \l_fontspec_hyphenchar_tl \scan_stop: } } - { \fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{#1} } } } \__fontspec_keys_define_code:nnn {fontspec} {Color} { - \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF { \token_to_str:N \color@ #1 } { - \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl } { \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_fontspec_hexcol_tl {#1} } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } { \int_compare:nTF { \tl_count:n {#1} == 8 } { \fontspec_parse_colour:viii #1 } { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {bad-colour} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } } } } } \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} - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice-col} {#7#8} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice-col} {#7#8} } } - \tl_set:Nn \l_fontspec_opacity_tl {#7#8} + \tl_set:Nn \l__fontspec_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} -\int_new:N \l_fontspec_tmp_int +\int_new:N \l__fontspec_tmp_int \__fontspec_keys_define_code:nnn {fontspec} {Opacity} { - \fontspec_update_fontid:n {+opac:#1} - \int_set:Nn \l_fontspec_tmp_int {255} - \_int_mult_truncate:Nn \l_fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } } - \tl_set:Nx \l_fontspec_opacity_tl + \tl_set:Nx \l__fontspec_opacity_tl { - \int_compare:nT { \l_fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l_fontspec_tmp_int } + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hexadecimal:n { \l__fontspec_tmp_int } } } \__fontspec_keys_define_code:nnn {fontspec} {Mapping} { \str_if_eq:nnTF {#1} {tex-text} { - \fontspec_warning:n {no-mapping-ligtex} + \__fontspec_warning:n {no-mapping-ligtex} \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} \keys_set:nn {fontspec} { Ligatures=TeX } } - { \fontspec_warning:n {no-mapping} } + { \__fontspec_warning:n {no-mapping} } } \__fontspec_keys_define_code:nnn {fontspec} {FeatureFile} { - \fontspec_update_fontid:n {+fea:#1} - \fontspec_update_featstr:n{featurefile=#1} + \__fontspec_update_featstr:n { featurefile = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { - \fontspec_update_fontid:n {+weight:#1} - \fontspec_update_featstr:n{weight=#1} + \__fontspec_update_featstr:n{weight=#1} } \__fontspec_keys_define_code:nnn {fontspec} {Width} { - \fontspec_update_fontid:n {+width:#1} - \fontspec_update_featstr:n{width=#1} + \__fontspec_update_featstr:n{width=#1} } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} { - \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} } \keys_define:nn {fontspec} { FakeSlant .code:n = { - \fontspec_update_fontid:n {+slant:#1} - \fontspec_update_featstr:n{slant=#1} + \__fontspec_update_featstr:n{slant=#1} }, FakeSlant .default:n = {0.2} } @@ -1433,33 +1566,30 @@ { FakeStretch .code:n = { - \fontspec_update_fontid:n {+extend:#1} - \fontspec_update_featstr:n{extend=#1} + \__fontspec_update_featstr:n{extend=#1} }, FakeStretch .default:n = {1.2} } \keys_define:nn {fontspec} { - FakeBold .code:n = { \fontspec_warning:n {fakebold-only-xetex} } + FakeBold .code:n = { \__fontspec_warning:n {fakebold-only-xetex} } } \keys_define:nn {fontspec} { AutoFakeSlant .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \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} + \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_noit_bool - - \fontspec_update_fontid:n {fakeit:#1} + \bool_set_false:N \l__fontspec_noit_bool \tl_if_empty:NF \l_fontspec_fake_embolden_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=\l_fontspec_fake_embolden_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -1470,128 +1600,125 @@ { AutoFakeBold .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l_fontspec_fontfeat_bf_clist {FakeBold=#1} + \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_nobf_bool - - \fontspec_update_fontid:n {fakebf:#1} + \bool_set_false:N \l__fontspec_nobf_bool \tl_if_empty:NF \l_fontspec_fake_slant_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=\l_fontspec_fake_slant_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeBold=#1} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } }, AutoFakeBold .default:n = {1.5} } -\fontspec_define_font_feature:n{Ligatures} -\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} +\__fontspec_define_font_feature:n{Ligatures} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} \keys_define:nn {fontspec} { Ligatures / TeX .code:n = { - \fontspec_update_fontid:n {+tlig+trep} - \fontspec_update_featstr:n{+tlig;+trep} - } - } -\fontspec_define_font_feature:n{Letters} -\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} -\fontspec_define_font_feature:n{Numbers} -\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} + \__fontspec_update_featstr:n { +tlig; +trep } + } + } +\__fontspec_define_font_feature:n{Letters} +\__fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\__fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\__fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\__fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\__fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\__fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} +\__fontspec_define_font_feature:n{Numbers} +\__fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\__fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} \luatex_if_engine:T { - \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} - } -\fontspec_define_font_feature:n {Contextuals} -\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} -\fontspec_define_font_feature:n{Diacritics} -\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} -\fontspec_define_font_feature:n{Kerning} -\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -\fontspec_define_font_feature:n{VerticalPosition} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\fontspec_define_font_feature:n{Fractions} -\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} -\fontspec_define_font_feature:n { Alternate } + \__fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} + } +\__fontspec_define_font_feature:n {Contextuals} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\__fontspec_define_font_feature:n{Diacritics} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\__fontspec_define_font_feature:n{Kerning} +\__fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\__fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\__fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +\__fontspec_define_font_feature:n{VerticalPosition} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\__fontspec_define_font_feature:n{Fractions} +\__fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\__fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} +\__fontspec_define_font_feature:n { Alternate } \keys_define:nn {fontspec} { Alternate .default:n = {0} , @@ -1602,7 +1729,7 @@ } } \cs_set:Nn \fontspec_salt:n { +salt = #1 } -\fontspec_define_font_feature:n {Variant} +\__fontspec_define_font_feature:n {Variant} \keys_define:nn {fontspec} { Variant .default:n = {0} , @@ -1613,7 +1740,7 @@ } } \aliasfontfeature{Variant}{StylisticSet} -\fontspec_define_font_feature:n { CharacterVariant } +\__fontspec_define_font_feature:n { CharacterVariant } \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w @@ -1634,63 +1761,50 @@ } } } -\keys_define:nn {fontspec} - { - ScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=0} - \fontspec_update_featstr:n{+sstyle} - }, - ScriptScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=1} - \fontspec_update_featstr:n{+ssstyle} - } - } -\fontspec_define_font_feature:n{Style} -\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\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_font_feature:n{Style} +\__fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\__fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\__fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\__fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\__fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\__fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\__fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\__fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\__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} -\fontspec_define_font_feature:n{CJKShape} -\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} -\fontspec_define_font_feature:n{CharacterWidth} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} -\fontspec_define_font_feature:n { Annotation } +\__fontspec_define_font_feature:n{CJKShape} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\__fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\__fontspec_define_font_feature:n{CharacterWidth} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} +\__fontspec_define_font_feature:n { Annotation } \keys_define:nn {fontspec} { Annotation .default:n = {0} , @@ -1704,15 +1818,13 @@ Vertical .choice: , Vertical / RotatedGlyphs .code:n = { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_make_feature:nnn{}{}{+vrt2} - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } { - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } } } @@ -1960,18 +2072,16 @@ \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} + \__fontspec_warning:nx {language-not-exist} {Turkish} \keys_set:nn {fontspec} {Language=Default} } } @@ -1979,14 +2089,12 @@ } \__fontspec_keys_define_code:nnn {fontspec}{ Language / Default } { - \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} \int_zero:N \l_fontspec_language_int } \__fontspec_keys_define_code:nnn {fontspec} {RawFeature} { - \fontspec_update_fontid:n {+Raw:#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } \providecommand*{\sidefault}{si} \DeclareRobustCommand{\sishape} @@ -2027,23 +2135,23 @@ } \@ifpackageloaded{euler} { - \bool_set_true:N \g_fontspec_package_euler_loaded_bool + \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool } { - \bool_set_false:N \g_fontspec_package_euler_loaded_bool + \bool_set_false:N \g__fontspec_pkg_euler_loaded_bool } \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { - \bool_if:NTF \g_fontspec_package_euler_loaded_bool - { \bool_set_true:N \g_fontspec_math_euler_bool } - { \fontspec_error:n {euler-too-late} } + \bool_if:NTF \g__fontspec_pkg_euler_loaded_bool + { \bool_set_true:N \g__fontspec_math_euler_bool } + { \__fontspec_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -2062,13 +2170,13 @@ \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi \group_end: - \bool_if:NF \g_fontspec_math_euler_bool + \bool_if:NF \g__fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63} - \bool_if:NF \g_fontspec_math_lucida_bool + \bool_if:NF \g__fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} @@ -2101,67 +2209,67 @@ \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} } } - \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 + \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}\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}\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}\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\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}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\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 } \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{iwona} { - \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@iwona@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{kurier} { - \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \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}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} - \bool_if:NT \g_fontspec_math_bool - { - \fontspec_info:n {setup-math} + \@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}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g__fontspec_math_bool}{} + \bool_if:NT \g__fontspec_math_bool + { + \__fontspec_info:n {setup-math} \fontspec_setup_maths: } } \AtBeginDocument{\fontspec_maybe_setup_maths:} -\bool_if:NT \g_fontspec_cfg_bool +\bool_if:NT \g__fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} @@ -2176,7 +2284,7 @@ } \ExplSyntaxOff %% -%% Copyright 2004--2013 Will Robertson +%% Copyright 2004--2014 Will Robertson %% Copyright 2009--2013 Khaled Hosny %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index 98b152f2117..82479c61ab3 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-patches} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \RequirePackage{fixltx2e}[2006/03/24] @@ -131,7 +131,7 @@ { \addfontfeature{Numbers=Lining} #1 } } %% -%% Copyright 2004--2013 Will Robertson +%% Copyright 2004--2014 Will Robertson %% Copyright 2009--2013 Khaled Hosny %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index c392b552f6c..9821d3987d5 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec-xetex} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \ExplSyntaxOn @@ -26,120 +26,146 @@ \tl_set_eq:NN \UTFencname \g_fontspec_encoding_tl % for xunicode \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl -\tl_put_right:Nn \document +\AtBeginDocument { \tl_set_eq:NN \cyrillicencoding \g_fontspec_encoding_tl \tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl } \RequirePackage{xunicode} -\DeclareDocumentCommand \fontspec { O{} m } +\DeclareDocumentCommand \fontspec { O{} m O{} } { \fontencoding {\g_fontspec_encoding_tl} - \fontspec_set_family:Nnn \f@family {#1}{#2} + \fontspec_set_family:Nnn \f@family {#1,#3}{#2} \selectfont \ignorespaces } -\DeclareDocumentCommand \setmainfont { O{} m } +\DeclareDocumentCommand \setmainfont { O{} m O{} } { - \fontspec_set_family:Nnn \rmdefault {#1}{#2} + \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setsansfont { O{} m } +\DeclareDocumentCommand \setsansfont { O{} m O{} } { - \fontspec_set_family:Nnn \sfdefault {#1}{#2} + \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2} \normalfont + \ignorespaces } -\DeclareDocumentCommand \setmonofont { O{} m } +\DeclareDocumentCommand \setmonofont { O{} m O{} } { - \fontspec_set_family:Nnn \ttdefault {#1}{#2} + \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2} \normalfont + \ignorespaces } \cs_set_eq:NN \setromanfont \setmainfont -\tl_new:N \g_fontspec_mathrm_tl -\tl_new:N \g_fontspec_bfmathrm_tl -\tl_new:N \g_fontspec_mathsf_tl -\tl_new:N \g_fontspec_mathtt_tl -\DeclareDocumentCommand \setmathrm { O{} m } +\tl_new:N \g__fontspec_mathrm_tl +\tl_new:N \g__fontspec_bfmathrm_tl +\tl_new:N \g__fontspec_mathsf_tl +\tl_new:N \g__fontspec_mathtt_tl +\DeclareDocumentCommand \setmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setboldmathrm { O{} m } +\DeclareDocumentCommand \setboldmathrm { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathsf { O{} m } +\DeclareDocumentCommand \setmathsf { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2} } -\DeclareDocumentCommand \setmathtt { O{} m } +\DeclareDocumentCommand \setmathtt { O{} m O{} } { - \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} + \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\tl_set:Nn \g_fontspec_mathrm_tl {\rmdefault} -\tl_set:Nn \g_fontspec_mathsf_tl {\sfdefault} -\tl_set:Nn \g_fontspec_mathtt_tl {\ttdefault} -\DeclareDocumentCommand \newfontfamily { m O{} m } +\tl_set:Nn \g__fontspec_mathrm_tl {\rmdefault} +\tl_set:Nn \g__fontspec_mathsf_tl {\sfdefault} +\tl_set:Nn \g__fontspec_mathtt_tl {\ttdefault} +\DeclareDocumentCommand \newfontfamily { m O{} m O{} } { - \fontspec_select:nn{#2}{#3} + \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3} \use:x { \exp_not:N \DeclareRobustCommand \exp_not:N #1 { \exp_not:N \fontencoding {\g_fontspec_encoding_tl} - \exp_not:N \fontfamily {\l_fontspec_family_tl} \exp_not:N \selectfont + \exp_not:N \fontfamily { \use:c {g__fontspec_ \cs_to_str:N #1 _family} } \exp_not:N \selectfont } } } -\DeclareDocumentCommand \newfontface { m O{} m } +\DeclareDocumentCommand \newfontface { m O{} m O{} } { - \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} + \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3} } -\tl_new:N \g_fontspec_default_fontopts_tl +\clist_new:N \g__fontspec_default_fontopts_clist \prop_new:N \g__fontspec_fontopts_prop -\DeclareDocumentCommand \defaultfontfeatures { o m } +\DeclareDocumentCommand \defaultfontfeatures { t+ o m } { - \IfNoValueTF {#1} - { \__fontspec_set_default_features:n {#2} } - { \__fontspec_set_font_default_features:nn {#1} {#2} } + \IfNoValueTF {#2} + { \__fontspec_set_default_features:nn {#1} {#3} } + { \__fontspec_set_font_default_features:nnn {#1} {#2} {#3} } + \ignorespaces } -\cs_new:Nn \__fontspec_set_default_features:n +\cs_new:Nn \__fontspec_set_default_features:nn { - \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} + \IfBooleanTF {#1} \clist_put_right:Nn \clist_set:Nn + \g__fontspec_default_fontopts_clist {#2} } -\cs_new:Nn \__fontspec_set_font_default_features:nn +\cs_new:Nn \__fontspec_set_font_default_features:nnn { - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1} - \tl_if_empty:nTF {#2} - { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } - { \prop_gput:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#2} } + \clist_map_inline:nn {#2} + { + \tl_if_single:nTF {##1} + { \tl_set:No \l__fontspec_tmp_tl { \cs:w g__fontspec_ \cs_to_str:N ##1 _family\cs_end: } } + { \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {##1} } + + \IfBooleanTF {#1} + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + { \tl_clear:N \l__fontspec_tmpb_tl } + \tl_put_right:Nn \l__fontspec_tmpb_tl {#3,} + \prop_gput:NVV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_tmpb_tl + } + { + \tl_if_empty:nTF {#3} + { \prop_gremove:NV \g__fontspec_fontopts_prop \l__fontspec_tmp_tl } + { \prop_put:NVn \g__fontspec_fontopts_prop \l__fontspec_tmp_tl {#3,} } + } + } } + \cs_new:Nn \__fontspec_sanitise_fontname:Nn { \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } } \tl_remove_all:Nn #1 {~} - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { \tl_remove_once:Nn #1 {##1} } } + +\bool_new:N \l__fontspec_disable_defaults_bool \DeclareDocumentCommand \addfontfeatures {m} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF + { \group_begin: - \tl_clear:N \g_fontspec_default_fontopts_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {options} \l__fontspec_options_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontname} \l__fontspec_fontname_tl + \bool_set_true:N \l__fontspec_disable_defaults_bool \use:x { - \exp_not:N\fontspec_select:nn - {\csname zf@family@options\f@family\endcsname,#1} - {\csname zf@family@fontname\f@family\endcsname} + \exp_not:N \fontspec_select:nn + { \l__fontspec_options_tl , #1 } {\l__fontspec_fontname_tl} } \group_end: \fontfamily\l_fontspec_family_tl\selectfont - \else - \fontspec_warning:n {addfontfeatures-ignored} - \fi + } + { + \__fontspec_warning:n {addfontfeatures-ignored} + } \ignorespaces } \cs_set_eq:NN \addfontfeature \addfontfeatures @@ -149,28 +175,27 @@ { #1 .code:n = { - \fontspec_update_fontid:n {+zf-#1} - \fontspec_update_featstr:n {#2} + \__fontspec_update_featstr:n {#2} } } } \DeclareDocumentCommand \newAATfeature {mmmm} { \keys_if_exist:nnF { fontspec } {#1} - { \fontspec_define_font_feature:n {#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}{} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{#3}{#4}{} } -\DeclareDocumentCommand \newICUfeature {mmm} +\DeclareDocumentCommand \newopentypefeature {mmm} { \keys_if_exist:nnF { fontspec / options } {#1} - { \fontspec_define_font_feature:n{#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} + { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } + \__fontspec_define_feature_option:nnnnn {#1}{#2}{}{}{#3} } -\cs_set_eq:NN \newopentypefeature \newICUfeature +\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \keys_if_exist:nnTF {fontspec} {#1} @@ -194,7 +219,7 @@ } } { - \fontspec_warning:nx {rename-feature-not-exist} {#1} + \__fontspec_warning:nx {rename-feature-not-exist} {#1} } } } @@ -212,18 +237,17 @@ \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} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} } { \fontspec_check_script:nTF {latn} { - \fontspec_warning:nx {script-not-exist-latn} {#1} + \__fontspec_warning:nx {script-not-exist-latn} {#1} \keys_set:nn {fontspec} {Script=Latin} } { - \fontspec_warning:nx {script-not-exist} {#1} + \__fontspec_warning:nx {script-not-exist} {#1} } } } @@ -239,32 +263,32 @@ \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} + \__fontspec_warning:nx {language-not-exist} {#1} \keys_set:nn { fontspec } { Language = Default } } } } \DeclareDocumentCommand \DeclareFontsExtensions {m} { - \tl_set:Nn \l_fontspec_extensions_clist { #1 } - \tl_remove_all:Nn \l_fontspec_extensions_clist {~} + \clist_set:Nn \l__fontspec_extensions_clist { #1 } + \tl_remove_all:Nn \l__fontspec_extensions_clist {~} } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \cs_if_exist:cTF {g_fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: + \cs_if_exist:cTF {g__fontspec_ \f@family _prop} \prg_return_true: \prg_return_false: } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { - \fontspec_font_set:Nnn \l_fontspec_font {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \bool_if:NTF \l_fontspec_atsui_bool + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \bool_if:NTF \l__fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: @@ -281,9 +305,10 @@ { \fontspec_if_fontspec_font:TF { - \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: + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool \prg_return_true: \prg_return_false: } { \prg_return_false: @@ -293,14 +318,20 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} - \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_language_int {\l__fontspec_tmp_tl} + + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l_fontspec_lang_tl + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} } { @@ -315,9 +346,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} @@ -331,9 +363,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: } @@ -345,12 +378,15 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} - \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-num} \l__fontspec_tmp_tl + \int_set:Nn \l_fontspec_script_int {\l__fontspec_tmp_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l_fontspec_script_tl + \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: } { \prg_return_false: } @@ -361,9 +397,10 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { \tl_set:Nn \l_fontspec_script_tl {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} @@ -377,11 +414,13 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {script-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -392,11 +431,13 @@ { \fontspec_if_fontspec_font:TF { - \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 + \prop_get:cnN {g__fontspec_ \f@family _prop} {fontdef} \l__fontspec_fontdef_tl + \__fontspec_font_set:Nnn \l_fontspec_font {\l__fontspec_fontdef_tl} {\f@size pt} + \__fontspec_set_font_type: + \bool_if:NTF \l__fontspec_ot_bool { - \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} + \prop_get:cnN {g__fontspec_ \f@family _prop} {lang-tag} \l__fontspec_tmp_tl + \str_if_eq:nVTF {#1} \l__fontspec_tmp_tl {\prg_return_true:} {\prg_return_false:} } { \prg_return_false: } @@ -405,16 +446,19 @@ } \cs_new:Nn \fontspec_set_family:Nnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \l_fontspec_family_tl } +\cs_generate_variant:Nn \fontspec_set_family:Nnn {c} \cs_new:Nn \fontspec_set_fontface:NNnn { + \tl_set:Nn \l__fontspec_family_label_tl { #1 } \fontspec_select:nn {#3}{#4} \tl_set_eq:NN #1 \l_fontspec_font \tl_set_eq:NN #2 \l_fontspec_family_tl } -\cs_set:Nn \fontspec_fontwrap:n { "#1" } +\cs_set:Nn \__fontspec_fontwrap:n { "#1" } \cs_if_free:NT \font_set_eq:NN { \cs_set_eq:NN \font_set_eq:NN \tex_let:D @@ -428,7 +472,7 @@ } \cs_set:Npn \font_suppress_not_found_error: {\suppressfontnotfounderror=1} - \prg_set_conditional:Nnn \font_if_null:N {p,TF,T,F} + \prg_set_conditional:Nnn \__fontspec_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -437,13 +481,13 @@ \fi } } -\cs_new:Nn \fontspec_font_set:Nnn +\cs_new:Nn \__fontspec_font_set:Nnn { - \font_set:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_set:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } -\cs_new:Nn \fontspec_font_gset:Nnn +\cs_new:Nn \__fontspec_font_gset:Nnn { - \font_gset:Nnn #1 {\fontspec_fontwrap:n {#2}} {#3} + \font_gset:Nnn #1 {\__fontspec_fontwrap:n {#2}} {#3} } \prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { @@ -457,32 +501,31 @@ { \group_begin: \font_suppress_not_found_error: - \fontspec_init: + \__fontspec_init: + \tl_set:Nx \l_fontspec_fontname_tl {#2} - \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 + \tl_set_eq:NN \l__fontspec_basename_tl \l_fontspec_fontname_tl + \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl - \fontspec_preparse_features:nN {#1} \l_fontspec_fontname_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 \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 - \fontspec_set_scriptlang: - \fontspec_get_features:n {} - \bool_set_false:N \l_fontspec_firsttime_bool - \fontspec_save_family:nT {#2} + \__fontspec_extract_all_features:n {#1} + \__fontspec_preparse_features: + + \__fontspec_load_font: + \__fontspec_set_scriptlang: + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist {} + \bool_set_false:N \l__fontspec_firsttime_bool + + \__fontspec_save_family:nTF {#2} { - \fontspec_save_fontinfo:nn {#1} {#2} + \__fontspec_save_fontinfo: + \__fontspec_find_autofonts: \DeclareFontFamily{\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{} - \fontspec_set_upright: - \fontspec_set_bold: - \fontspec_set_italic: - \fontspec_set_slanted: - \fontspec_set_bold_italic: - \fontspec_set_bold_slanted: - } - \fontspec_info:nxx {defining-font} {#1} {#2} + \__fontspec_set_faces: + \__fontspec_info:nxx {defining-font} {#1} {#2} + } + { + } \group_end: } \cs_new:Nn \__fontspec_load_external_fontoptions:N @@ -494,334 +537,339 @@ { \file_input:n {\l__fontspec_tmp_tl.fontspec} } } } -\cs_new:Nn \fontspec_preparse_features:nN +\cs_new:Nn \__fontspec_extract_all_features:n { - \exp_args:NV \fontspec_if_detect_external:nT #2 - { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } - \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \keys_set_known:nxN {fontspec-preparse-external} + + \bool_if:NTF \l__fontspec_disable_defaults_bool { - \g_fontspec_default_fontopts_tl - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #1 + \clist_set:Nx \l__fontspec_all_features_clist + {#1} } - \l_fontspec_keys_leftover_clist + { + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_family_label_tl \l__fontspec_family_fontopts_clist + { \clist_clear:N \l__fontspec_family_fontopts_clist } + \tl_clear:N \l__fontspec_family_label_tl + + \clist_set:Nx \l__fontspec_all_features_clist + { + \g__fontspec_default_fontopts_clist, + \l__fontspec_family_fontopts_clist, + \l__fontspec_fontopts_clist, + #1 + } + } + \tl_set:Nx \l__fontspec_fontid_tl { \tl_to_str:N \l_fontspec_fontname_tl-:-\tl_to_str:N \l__fontspec_all_features_clist } + } +\cs_new:Nn \__fontspec_preparse_features: + { + \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl + { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } + + \keys_set_known:nxN {fontspec-preparse-external} + { \l__fontspec_all_features_clist } + \l__fontspec_keys_leftover_clist \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_keys_leftover_clist} - \l_fontspec_keys_leftover_clist - \keys_set_known:nxN {fontspec-preparse} {\l_fontspec_keys_leftover_clist} - \l_fontspec_fontfeat_clist + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_keys_leftover_clist} + \l__fontspec_keys_leftover_clist + \keys_set_known:nxN {fontspec-preparse} {\l__fontspec_keys_leftover_clist} + \l__fontspec_fontfeat_clist + } +\cs_new:Nn \__fontspec_load_font: + { + \__fontspec_font_set:Nnn \l_fontspec_font + { \__fontspec_fullname:n {\l_fontspec_fontname_up_tl} } {\f@size pt} + \__fontspec_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 \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 } -\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} +\prg_new_conditional:Nnn \__fontspec_if_detect_external:n {T} { - \clist_map_inline:Nn \l_fontspec_extensions_clist + \clist_map_inline:Nn \l__fontspec_extensions_clist { - \bool_set_false:N \l_tmpa_bool + \bool_set_false:N \l__fontspec_tmpa_bool \tl_if_in:nnT {#1 <= end_of_string} {##1 <= end_of_string} - { \bool_set_true:N \l_tmpa_bool \clist_map_break: } + { \bool_set_true:N \l__fontspec_tmpa_bool \clist_map_break: } } - \bool_if:NTF \l_tmpa_bool \prg_return_true: \prg_return_false: + \bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false: } -\cs_set:Nn \fontspec_fullname:n +\cs_set:Nn \__fontspec_fullname:n { - \fontspec_namewrap:n { #1 \l_fontspec_extension_tl } + \__fontspec_namewrap:n { #1 \l__fontspec_extension_tl } \l_fontspec_renderer_tl - \l_fontspec_optical_size_tl - } -%% Now we have a unique (in fact, too unique!) string that contains -\prg_new_conditional:Nnn \fontspec_save_family:n {T} - { - \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} - { - \cs_if_exist:cTF {g_fontspec_family_#1_int} - { \int_gincr:c {g_fontspec_family_#1_int} } - { \int_new: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 \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: + \l__fontspec_optical_size_tl } -\cs_new:Nn \fontspec_set_scriptlang: +\cs_new:Nn \__fontspec_set_scriptlang: { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { - \tl_if_empty:NTF \l_fontspec_script_name_tl + \tl_if_empty:NTF \l__fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { - \tl_set:Nn \l_fontspec_script_name_tl {Latin} - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_set:Nn \l__fontspec_script_name_tl {Latin} + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\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} + \__fontspec_info:n {no-scripts} } } { - \tl_if_empty:NT \l_fontspec_lang_name_tl + \tl_if_empty:NT \l__fontspec_lang_name_tl { - \tl_set:Nn \l_fontspec_lang_name_tl {Default} + \tl_set:Nn \l__fontspec_lang_name_tl {Default} } - \keys_set:nx {fontspec} {Script=\l_fontspec_script_name_tl} - \keys_set:nx {fontspec} {Language=\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} } } } -\cs_generate_variant:Nn \prop_gput:Nnn {cnV} -\cs_generate_variant:Nn \prop_gput:Nnn {cnx} -\cs_new:Nn \fontspec_save_fontinfo:nn +\prg_new_conditional:Nnn \__fontspec_save_family:n {TF} { - \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} + \cs_if_exist:NT \l__fontspec_nfss_fam_tl { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + \cs_set_eq:cN {g__fontspec_UID_\l__fontspec_fontid_tl} \l__fontspec_nfss_fam_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\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} + \cs_if_exist:cF {g__fontspec_UID_\l__fontspec_fontid_tl} { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } - \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 - } -\cs_new:Nn \fontspec_set_upright: - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl - \mddefault \updefault \l_fontspec_fontfeat_up_clist - } -\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} - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist - } + \cs_if_exist:cTF {g__fontspec_family_#1_int} + { \int_gincr:c {g__fontspec_family_#1_int} } + { \int_new: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} { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl - \bfdefault \updefault \l_fontspec_fontfeat_bf_clist + \l__fontspec_tmp_tl ( \int_use:c {g__fontspec_family_#1_int} ) } } + \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: } -\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} } - { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } - \mddefault \itdefault \l_fontspec_fontfeat_it_clist - } - } -\cs_new:Nn \fontspec_set_slanted: +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} +\cs_new:Nn \__fontspec_save_fontinfo: { - \tl_if_empty:NF \l_fontspec_fontname_sl_tl + \prop_new:c {g__fontspec_ \l_fontspec_family_tl _prop} + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontname} { \l__fontspec_basename_tl } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {options} { \l__fontspec_all_features_clist } + \prop_gput:cnx {g__fontspec_ \l_fontspec_family_tl _prop} {fontdef} { - \fontspec_make_font_shapes:nnnn - \l_fontspec_fontname_sl_tl \mddefault \sldefault - \l_fontspec_fontfeat_sl_clist + \__fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + \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 + } -\cs_new:Nn \fontspec_set_bold_italic: +\cs_new:Nn \__fontspec_find_autofonts: { - \bool_if:nF {\l_fontspec_noit_bool || \l_fontspec_nobf_bool} + \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 - { - \tl_if_empty:NTF \l_fontspec_fontname_it_tl - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} - } - } - { - \fontspec_make_auto_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} - } - } - { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl - } - \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_it_tl} {/B} + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_bf_tl} {/I} + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfit_tl {\l_fontspec_fontname_tl} {/BI} } - } -\cs_new:Nn \fontspec_set_bold_slanted: - { - \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl + + \bool_if:NF \l__fontspec_nobf_bool { - \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_set_autofont:Nnn \l_fontspec_fontname_bf_tl {\l_fontspec_fontname_tl} {/B} } + + \bool_if:NF \l__fontspec_noit_bool { - \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl - \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_it_tl {\l_fontspec_fontname_tl} {/I} } + + \__fontspec_set_autofont:Nnn \l_fontspec_fontname_bfsl_tl {\l_fontspec_fontname_sl_tl} {/B} + } +\cs_new:Nn \__fontspec_set_faces: + { + \__fontspec_add_nfssfont:oooo \mddefault \updefault \l_fontspec_fontname_tl \l__fontspec_fontfeat_up_clist + \__fontspec_add_nfssfont:oooo \bfdefault \updefault \l_fontspec_fontname_bf_tl \l__fontspec_fontfeat_bf_clist + \__fontspec_add_nfssfont:oooo \mddefault \itdefault \l_fontspec_fontname_it_tl \l__fontspec_fontfeat_it_clist + \__fontspec_add_nfssfont:oooo \mddefault \sldefault \l_fontspec_fontname_sl_tl \l__fontspec_fontfeat_sl_clist + \__fontspec_add_nfssfont:oooo \bfdefault \itdefault \l_fontspec_fontname_bfit_tl \l__fontspec_fontfeat_bfit_clist + \__fontspec_add_nfssfont:oooo \bfdefault \sldefault \l_fontspec_fontname_bfsl_tl \l__fontspec_fontfeat_bfsl_clist + + \prop_map_inline:Nn \l__fontspec_nfssfont_prop { \__fontspec_set_faces_aux:nnnnn ##2 } + } +\cs_new:Nn \__fontspec_set_faces_aux:nnnnn + { + \fontspec_complete_fontname:Nn \l__fontspec_curr_fontname_tl {#3} + \__fontspec_make_font_shapes:Nnnnn \l__fontspec_curr_fontname_tl {#1} {#2} {#4} {#5} } -\cs_new:Nn \fontspec_set_font_type: +\cs_new:Nn \__fontspec_set_font_type: { - \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 + \bool_set_false:N \l__fontspec_tfm_bool + \bool_set_false:N \l__fontspec_atsui_bool + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_false:N \l__fontspec_mm_bool + \bool_set_false:N \l__fontspec_graphite_bool \ifcase\XeTeXfonttype\l_fontspec_font - \bool_set_true:N \l_fontspec_tfm_bool + \bool_set_true:N \l__fontspec_tfm_bool \or - \bool_set_true:N \l_fontspec_atsui_bool + \bool_set_true:N \l__fontspec_atsui_bool \ifnum\XeTeXcountvariations\l_fontspec_font > \c_zero - \bool_set_true:N \l_fontspec_mm_bool + \bool_set_true:N \l__fontspec_mm_bool \fi \or - \bool_set_true:N \l_fontspec_icu_bool + \bool_set_true:N \l__fontspec_ot_bool \fi \tl_if_empty:NT \l_fontspec_renderer_tl { - \bool_if:NTF \l_fontspec_atsui_bool + \bool_if:NTF \l__fontspec_atsui_bool { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} } { - \bool_if:NT \l_fontspec_icu_bool - { \tl_set:Nn \l_fontspec_renderer_tl {/ICU} } + \bool_if:NT \l__fontspec_ot_bool + { \tl_set:Nn \l_fontspec_renderer_tl {/OT} } } } } -\cs_new:Nn \fontspec_make_auto_font_shapes:nnnnn +\cs_generate_variant:Nn \tl_if_empty:nF {x} +\cs_new:Nn \__fontspec_set_autofont:Nnn { - \bool_if:NF \l_fontspec_external_bool + \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_x:nnTF { \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} } + \tl_if_empty:xF {#2} + { + \tl_if_empty:NT #1 + { + \__fontspec_if_autofont:nnTF {#2} {#3} + { \tl_set:Nx #1 {#2#3} } + { \__fontspec_info:nx {no-font-shape} {#2#3} } + } + } } } -\cs_new:Nn \fontspec_make_font_shapes:nnnn { - \group_begin: +\prg_new_conditional:Nnn \__fontspec_if_autofont:nn {T,TF} + { + \__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_x:nnTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \prg_return_false: } + { \prg_return_true: } + } +\cs_new:Nn \__fontspec_make_font_shapes:Nnnnn + { + \group_begin: \__fontspec_load_fontname:n {#1} - \fontspec_declare_shape:nnn {#2}{#3} - { \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} #4 } - - \tl_if_empty:NTF \l_fontspec_fontname_sc_tl - { - \bool_if:NF \l_fontspec_nosc_bool - { - \fontspec_make_smallcaps:T - { - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , Letters=SmallCaps , \l_fontspec_fontfeat_sc_clist - } - } - } - } - { - \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} - \fontspec_declare_shape:nnn {#2} - { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } - { - \quark_if_no_value:NF \l__fontspec_fontopts_clist {\l__fontspec_fontopts_clist,} - #4 , \l_fontspec_fontfeat_sc_clist - } - } + \__fontspec_declare_shape:nnxx {#2} {#3} { \l__fontspec_fontopts_clist, #4 } {#5} \group_end: } + \cs_new:Nn \__fontspec_load_fontname:n { \tl_set:Nx \l_fontspec_fontname_tl {#1} \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl} - \prop_get:NVN \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist - \fontspec_font_set:Nnn \l_fontspec_font {\fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} - \font_if_null:NT \l_fontspec_font { \fontspec_error:nx {font-not-found} {#1} } + \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist + { \clist_clear:N \l__fontspec_fontopts_clist } + \__fontspec_font_set:Nnn \l_fontspec_font {\__fontspec_fullname:n {\l_fontspec_fontname_tl}} {\f@size pt} + \__fontspec_font_if_null:NT \l_fontspec_font { \__fontspec_error:nx {font-not-found} {#1} } } -\cs_new:Nn \fontspec_declare_shape:nnn +\cs_new:Nn \__fontspec_declare_shape:nnnn { - \clist_if_empty:NTF \l_fontspec_sizefeat_clist - { \__fontspec_declare_shape_nosizing:n {#3} } - { \__fontspec_declare_shape_withsizing:n {#3} } - \use:x + \tl_clear:N \l__fontspec_nfss_tl + \tl_clear:N \l__fontspec_nfss_sc_tl + \tl_set_eq:NN \l__fontspec_saved_fontname_tl \l_fontspec_fontname_tl + + \exp_args:Nx \clist_map_inline:nn {#4} { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} - {#1} {#2} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} + \tl_clear:N \l__fontspec_size_tl + \tl_set_eq:NN \l__fontspec_sizedfont_tl \l__fontspec_saved_fontname_tl % in case not spec'ed + + \keys_set_known:nxN {fontspec-sizing} { \exp_after:wN \use:n ##1 } + \l__fontspec_sizing_leftover_clist + \tl_if_empty:NT \l__fontspec_size_tl { \__fontspec_error:n {no-size-info} } + + % "normal" + \__fontspec_load_fontname:n {\l__fontspec_sizedfont_tl} + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_tl {#3} {} + + % small caps + \clist_set_eq:NN \l__fontspec_fontfeat_curr_clist \l__fontspec_fontfeat_sc_clist + + \bool_if:NF \l__fontspec_nosc_bool + { + \tl_if_empty:NTF \l_fontspec_fontname_sc_tl + { + \__fontspec_make_smallcaps:TF + { + \clist_put_left:Nn \l__fontspec_fontfeat_curr_clist {Letters=SmallCaps} + } + { + \bool_set_true:N \l__fontspec_nosc_bool + } + } + { \__fontspec_load_fontname:n {\l_fontspec_fontname_sc_tl} }% local for each size + } + + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_setup_nfss:Nnn \l__fontspec_nfss_sc_tl {#3} {\l__fontspec_fontfeat_curr_clist} + } + } + + \__fontspec_declare_shapes_normal:nn {#1} {#2} \__fontspec_declare_shape_slanted:nn {#1} {#2} \__fontspec_declare_shape_loginfo:nnn {#1} {#2} {#3} } -\cs_new:Nn \__fontspec_declare_shape_nosizing:n +\cs_generate_variant:Nn \__fontspec_declare_shape:nnnn {nnxx} + +\cs_new:Nn \__fontspec_setup_nfss:Nnn { - \fontspec_get_features:n {#1} - \tl_set:Nx \l_fontspec_nfss_tl + \__fontspec_get_features:Nn \l__fontspec_rawfeatures_sclist + { #2 , \l__fontspec_sizing_leftover_clist , #3 } + + \tl_put_right:Nx #1 + { + <\l__fontspec_size_tl> \l__fontspec_scale_tl + \__fontspec_fontwrap:n { - <-> \l_fontspec_scale_tl - \fontspec_fontwrap:n - { - \fontspec_fullname:n {\l_fontspec_fontname_tl} : - \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist - } + \__fontspec_fullname:n { \l_fontspec_fontname_tl } + : \l__fontspec_pre_feat_sclist \l__fontspec_rawfeatures_sclist } + } } -\cs_new:Nn \__fontspec_declare_shape_withsizing:n - { - \tl_clear:N \l_fontspec_nfss_tl - \clist_map_inline:Nn \l_fontspec_sizefeat_clist - { - - \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl - \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 { #1 , \l_fontspec_keys_leftover_clist } +\cs_new:Nn \__fontspec_declare_shapes_normal:nn + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} {#2} {\l__fontspec_nfss_tl}{\l__fontspec_postadjust_tl} - \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 - } - } + \bool_if:NF \l__fontspec_nosc_bool + { + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl} {\l_fontspec_family_tl} + {#1} + {\str_if_eq_x:nnTF {#2} {\itdefault} \sidefault \scdefault} + {\l__fontspec_nfss_sc_tl}{\l__fontspec_postadjust_tl} } } + +\cs_new:Nn \__fontspec_DeclareFontShape:nnnnnn + { + \group_begin: + \normalsize + \cs_undefine:c {#1/#2/#3/#4/\f@size} + \group_end: + \DeclareFontShape{#1}{#2}{#3}{#4}{#5}{#6} + } +\cs_generate_variant:Nn \__fontspec_DeclareFontShape:nnnnnn {xxxxxx} \cs_new:Nn \__fontspec_declare_shape_slanted:nn { \bool_if:nT @@ -830,11 +878,8 @@ !(\str_if_eq_x_p:nn {\itdefault} {\sldefault}) } { - \use:x - { - \exp_not:N \DeclareFontShape {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} - {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l_fontspec_postadjust_tl} - } + \__fontspec_DeclareFontShape:xxxxxx {\g_fontspec_encoding_tl}{\l_fontspec_family_tl}{#1}{\sldefault} + {<->ssub*\l_fontspec_family_tl/#1/\itdefault}{\l__fontspec_postadjust_tl} } } \cs_new:Nn \__fontspec_declare_shape_loginfo:nnn @@ -845,25 +890,31 @@ *~ '\exp_not:N \str_case: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} + } {#2/#3}'~ + with~ NFSS~ spec.: \exp_not:N \\ + \l__fontspec_nfss_tl + \exp_not:n { \\ \\ } + *~ '\exp_not:N \str_case:nnn {#1/\scdefault} + { + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\sidefault} {italic~ small~ caps} {\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 + \l__fontspec_nfss_sc_tl + \tl_if_empty:NF \l__fontspec_postadjust_tl { - \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l_fontspec_postadjust_tl + \exp_not:N \\ and~ font~ adjustment~ code: \exp_not:N \\ \l__fontspec_postadjust_tl } } } -\tl_set:Nn \l_fontspec_pre_feat_sclist +\clist_set:Nn \l__fontspec_pre_feat_sclist { - \bool_if:NT \l_fontspec_icu_bool + \bool_if:NT \l__fontspec_ot_bool { \tl_if_empty:NF \l_fontspec_script_tl { @@ -872,30 +923,28 @@ } } } -\cs_new:Nn \fontspec_update_fontid:n +\cs_set:Nn \__fontspec_get_features:Nn { - \bool_if:NT \l_fontspec_firsttime_bool + \sclist_clear:N \l__fontspec_rawfeatures_sclist + \tl_clear:N \l__fontspec_scale_tl + \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_set_eq:NN \l__fontspec_postadjust_tl \g__fontspec_postadjust_tl + \tl_clear:N \l__fontspec_wordspace_adjust_tl + \tl_clear:N \l__fontspec_punctspace_adjust_tl + + \keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} + \l__fontspec_keys_leftover_clist + \keys_set:nx {fontspec} {\l__fontspec_keys_leftover_clist} + \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } + { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } { - \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} + \__fontspec_update_featstr:n { color = \l__fontspec_hexcol_tl\l__fontspec_opacity_tl } } - } -\cs_set:Nn \fontspec_get_features:n - { - \sclist_clear:N \l_fontspec_rawfeatures_sclist - \tl_clear:N \l_fontspec_scale_tl - \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 - \keys_set_known:nxN {fontspec-renderer} {\l_fontspec_fontfeat_clist,#1} - \l_fontspec_keys_leftover_clist - \keys_set:nx {fontspec} {\l_fontspec_keys_leftover_clist} - \str_if_eq_x:nnF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } - { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } - { - \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} - } + \tl_set_eq:NN #1 \l__fontspec_rawfeatures_sclist } +\tl_clear:N \l__fontspec_family_label_tl \tl_clear:N \l_fontspec_fontname_bf_tl \tl_clear:N \l_fontspec_fontname_it_tl \tl_clear:N \l_fontspec_fake_slant_tl @@ -904,61 +953,74 @@ \tl_clear:N \l_fontspec_fontname_sl_tl \tl_clear:N \l_fontspec_fontname_bfsl_tl \tl_clear:N \l_fontspec_fontname_sc_tl -\tl_clear:N \l_fontspec_fontfeat_up_clist -\tl_clear:N \l_fontspec_fontfeat_bf_clist -\tl_clear:N \l_fontspec_fontfeat_it_clist -\tl_clear:N \l_fontspec_fontfeat_bfit_clist -\tl_clear:N \l_fontspec_fontfeat_sl_clist -\tl_clear:N \l_fontspec_fontfeat_bfsl_clist -\tl_clear:N \l_fontspec_fontfeat_sc_clist -\tl_clear:N \l_fontspec_script_name_tl +\tl_clear:N \l__fontspec_fontfeat_up_clist +\tl_clear:N \l__fontspec_fontfeat_bf_clist +\tl_clear:N \l__fontspec_fontfeat_it_clist +\tl_clear:N \l__fontspec_fontfeat_bfit_clist +\tl_clear:N \l__fontspec_fontfeat_sl_clist +\tl_clear:N \l__fontspec_fontfeat_bfsl_clist +\tl_clear:N \l__fontspec_fontfeat_sc_clist +\tl_clear:N \l__fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl -\tl_clear:N \l_fontspec_lang_name_tl +\tl_clear:N \l__fontspec_lang_name_tl \tl_clear:N \l_fontspec_lang_tl -\clist_clear:N \l_fontspec_sizefeat_clist -\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~} -\cs_set:Npn \fontspec_init: - { - \bool_set_false:N \l_fontspec_icu_bool - \bool_set_true:N \l_fontspec_firsttime_bool - \cs_set:Npn \fontspec_namewrap:n ##1 { ##1 } - \tl_clear:N \l_fontspec_optical_size_tl +\tl_set:Nn \g__fontspec_postadjust_tl { \l__fontspec_wordspace_adjust_tl \l__fontspec_punctspace_adjust_tl } + +\clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} +\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~} +\cs_set:Npn \__fontspec_init: + { + \bool_set_false:N \l__fontspec_ot_bool + \bool_set_true:N \l__fontspec_firsttime_bool + \cs_set:Npn \__fontspec_namewrap:n ##1 { ##1 } + \tl_clear:N \l__fontspec_optical_size_tl \tl_clear:N \l_fontspec_renderer_tl \tl_clear:N \l_fontspec_defined_shapes_tl + \tl_clear:N \g__fontspec_curr_series_tl + + % This is for detecting font families when assigning default features. + % Replace defaults for the standard families because they're not set in the usual way: + \exp_args:NV \str_case:nnn {\l__fontspec_family_label_tl} + { + {\rmdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_rmfamily_family} } + {\sfdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_sffamily_family} } + {\ttdefault} { \tl_set:Nn \l__fontspec_family_label_tl {\g__fontspec_ttfamily_family} } + }{} + } -\cs_set:Nn \fontspec_make_ot_smallcaps:T +\cs_set:Nn \fontspec_make_ot_smallcaps:TF { - \fontspec_check_ot_feat:nT {+smcp} { #1 } + \fontspec_check_ot_feat:nTF {+smcp} {#1} {#2} } -\cs_set:Nn \fontspec_make_smallcaps:T +\cs_set:Nn \__fontspec_make_smallcaps:TF { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ot_smallcaps:T {#1} } + \bool_if:NTF \l__fontspec_ot_bool + { \fontspec_make_ot_smallcaps:TF {#1} {#2} } { - \bool_if:NT \l_fontspec_atsui_bool - { \fontspec_make_AAT_feature_string:nnT {3}{3} { #1 } } + \bool_if:NT \l__fontspec_atsui_bool + { \fontspec_make_AAT_feature_string:nnTF {3}{3} {#1} {#2} } } } \cs_set_eq:NN \sclist_clear:N \tl_clear:N \cs_new:Nn \sclist_gput_right:Nn { \tl_gput_right:Nn #1 {#2;} } \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} -\cs_new:Nn \fontspec_update_featstr:n +\cs_new:Nn \__fontspec_update_featstr:n { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} + \sclist_gput_right:Nx \l__fontspec_rawfeatures_sclist {#1} } } \cs_new:Nn \fontspec_make_feature:nnn { - \bool_if:NTF \l_fontspec_icu_bool - { \fontspec_make_ICU_feature:n {#3} } + \bool_if:NTF \l__fontspec_ot_bool + { \fontspec_make_OT_feature:n {#3} } { - \bool_if:NT \l_fontspec_atsui_bool + \bool_if:NT \l__fontspec_atsui_bool { \fontspec_make_AAT_feature:nn {#1}{#2} } } } @@ -966,44 +1028,41 @@ \cs_new:Nn \fontspec_make_AAT_feature:nn { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {aat-feature-not-exist} } + { \__fontspec_warning:n {aat-feature-not-exist} } { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} { - \fontspec_update_fontid:n {+#1,#2} - \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + \__fontspec_update_featstr:n {\l_fontspec_feature_string_tl} } - { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } + { \__fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } -\cs_new:Nn \fontspec_make_ICU_feature:n +\cs_new:Nn \fontspec_make_OT_feature:n { \tl_if_empty:nTF {#1} - { \fontspec_warning:n {icu-feature-not-exist} } + { \__fontspec_warning:n {icu-feature-not-exist} } { \fontspec_check_ot_feat:nTF {#1} { - \fontspec_update_fontid:n {#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__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} - \fontspec_update_featstr:n { #1 = #2 } + \__fontspec_update_featstr:n { #1 = #2 } } - { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } + { \__fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } \cs_generate_variant:Nn \fontspec_make_numbered_feature:nn {xn} -\cs_new:Nn \fontspec_define_font_feature:n +\cs_new:Nn \__fontspec_define_font_feature:n { \keys_define:nn {fontspec} { #1 .multichoice: } } -\cs_new:Nn \fontspec_define_feature_option:nnnnn +\cs_new:Nn \__fontspec_define_feature_option:nnnnn { \keys_define:nn {fontspec} { @@ -1136,199 +1195,270 @@ { \keys_define:nn {#1} { #2 .code:n = {#3} } } -\bool_new:N \l_fontspec_external_bool +\bool_new:N \l__fontspec_external_bool \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ExternalLocation} { - \bool_set_true:N \l_fontspec_nobf_bool - \bool_set_true:N \l_fontspec_noit_bool - \bool_set_true:N \l_fontspec_external_bool - \cs_gset:Npn \fontspec_namewrap:n ##1 { [ #1 ##1 ] } - \keys_set:nn {fontspec-renderer} {Renderer=ICU} + \bool_set_true:N \l__fontspec_nobf_bool + \bool_set_true:N \l__fontspec_noit_bool + \bool_set_true:N \l__fontspec_external_bool + \cs_gset:Npn \__fontspec_namewrap:n ##1 { [ #1 ##1 ] } + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} } \aliasfontfeature{ExternalLocation}{Path} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {Extension} { - \tl_set:Nn \l_fontspec_extension_tl {#1} - \bool_if:NF \l_fontspec_external_bool + \tl_set:Nn \l__fontspec_extension_tl {#1} + \bool_if:NF \l__fontspec_external_bool { \keys_set:nn {fontspec-preparse-external} {ExternalLocation} } } -\tl_clear:N \l_fontspec_extension_tl +\tl_clear:N \l__fontspec_extension_tl \keys_define:nn {fontspec-renderer} { Renderer .choice_code:n = { - \fontspec_update_fontid:n {+rend:\l_keys_choice_tl} \int_compare:nTF {\l_keys_choice_int <= 3} { \tl_set:Nv \l_fontspec_renderer_tl { g_fontspec_renderer_tag_ \l_keys_choice_tl } } { - \fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} + \__fontspec_warning:nx {only-luatex-feature} {Renderer=Full/Basic} } } , - Renderer .generate_choices:n = {AAT,ICU,Graphite,Full,Basic} + Renderer .generate_choices:n = {AAT,ICU,OpenType,Graphite,Full,Basic} } \tl_set:cn {g_fontspec_renderer_tag_AAT} {/AAT} -\tl_set:cn {g_fontspec_renderer_tag_ICU} {/ICU} +\tl_set:cn {g_fontspec_renderer_tag_ICU} {/OT} +\tl_set:cn {g_fontspec_renderer_tag_OpenType} {/OT} \tl_set:cn {g_fontspec_renderer_tag_Graphite} {/GR} \tl_set:cn {g_fontspec_mode_tag_Full} {node} \tl_set:cn {g_fontspec_mode_tag_Basic} {base} \__fontspec_keys_define_code:nnn {fontspec-preparse} {Script} { - \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_script_name_tl {#1} - \fontspec_update_fontid:n {+script:#1} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l__fontspec_script_name_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {Language} { - \keys_set:nn {fontspec-renderer} {Renderer=ICU} - \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \fontspec_update_fontid:n {+language:#1} + \keys_set:nn {fontspec-renderer} {Renderer=OpenType} + \tl_set:Nn \l__fontspec_lang_name_tl {#1} + } +\seq_new:N \g__fontspec_bf_series_seq +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSeries} + { + \tl_gset:Nx \g__fontspec_curr_series_tl { #1 } + \seq_gput_right:Nx \g__fontspec_bf_series_seq { #1 } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {UprightFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} - \fontspec_update_fontid:n {up:#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse-external} {FontName} + { + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + } +\cs_generate_variant:Nn \tl_if_eq:nnT {ox} +\cs_generate_variant:Nn \prop_put:Nnn {NxV} \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nobf_bool - \fontspec_update_fontid:n {nobf} + \bool_set_true:N \l__fontspec_nobf_bool } { - \bool_set_false:N \l_fontspec_nobf_bool - \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} - \fontspec_update_fontid:n {bf:#1} + \bool_set_false:N \l__fontspec_nobf_bool + \fontspec_complete_fontname:Nn \l__fontspec_curr_bfname_tl {#1} + + \seq_if_empty:NT \g__fontspec_bf_series_seq + { + \tl_gset:Nx \g__fontspec_curr_series_tl {\bfdefault} + \seq_put_right:Nx \g__fontspec_bf_series_seq {\bfdefault} + } + \tl_if_eq:oxT \g__fontspec_curr_series_tl {\bfdefault} + { \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l__fontspec_curr_bfname_tl } + + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl + } } +\prop_new:N \l__fontspec_nfss_prop \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {ItalicFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_noit_bool - \fontspec_update_fontid:n {noit} + \bool_set_true:N \l__fontspec_noit_bool } { - \bool_set_false:N \l_fontspec_noit_bool + \bool_set_false:N \l__fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} - \fontspec_update_fontid:n {it:#1} } } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldItalicFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} - \fontspec_update_fontid:n {bfit:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {SlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} - \fontspec_update_fontid:n {sl:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse-external} {BoldSlantedFont} { \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} - \fontspec_update_fontid:n {bfsl:#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFont} { \tl_if_empty:nTF {#1} { - \bool_set_true:N \l_fontspec_nosc_bool - \fontspec_update_fontid:n {nosc} + \bool_set_true:N \l__fontspec_nosc_bool } { - \bool_set_true:N \l_fontspec_nosc_bool + \bool_set_false:N \l__fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} - \fontspec_update_fontid:n {sc:#1} } } \cs_set:Nn \fontspec_complete_fontname:Nn { - \tl_set:Nn #1 {#2} - \tl_replace_all:Nnx #1 {*} {\l_fontspec_fontname_tl} + \tl_set:Nx #1 {#2} + \tl_replace_all:Nnx #1 {*} {\l__fontspec_basename_tl} } \cs_generate_variant:Nn \tl_replace_all:Nnn {Nnx} \__fontspec_keys_define_code:nnn {fontspec-preparse} {UprightFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_up_clist { , #1} - \fontspec_update_fontid:n {rmfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_up_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bf_clist {, #1} - \fontspec_update_fontid:n {bffeat:#1} + \ + \clist_set:Nn \l__fontspec_fontfeat_bf_clist {#1} + + \prop_put:NxV \l__fontspec_nfss_prop + {BoldFont-\g__fontspec_curr_series_tl} \l__fontspec_curr_bfname_tl } \__fontspec_keys_define_code:nnn {fontspec-preparse} {ItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_it_clist {, #1} - \fontspec_update_fontid:n {itfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_it_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldItalicFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfit_clist {, #1} - \fontspec_update_fontid:n {bfitfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfit_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_sl_clist {, #1} - \fontspec_update_fontid:n {slfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_sl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {BoldSlantedFeatures} { - \tl_set:Nn \l_fontspec_fontfeat_bfsl_clist {, #1} - \fontspec_update_fontid:n {bfslfeat:#1} + \clist_set:Nn \l__fontspec_fontfeat_bfsl_clist {#1} } \__fontspec_keys_define_code:nnn {fontspec} {SmallCapsFeatures} { - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { - \tl_set:Nn \l_fontspec_fontfeat_sc_clist {, #1} + \clist_set:Nn \l__fontspec_fontfeat_sc_clist {#1} } - \fontspec_update_fontid:n {scfeat:#1} } \__fontspec_keys_define_code:nnn {fontspec-preparse} {SizeFeatures} { - \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \fontspec_update_fontid:n {sizefeat:#1} + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \clist_put_right:Nn \l__fontspec_fontfeat_up_clist { SizeFeatures = {#1} } + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {SizeFeatures} + { + \clist_set:Nn \l__fontspec_sizefeat_clist {#1} + \tl_if_empty:NT \l__fontspec_this_font_tl + { \tl_set:Nn \l__fontspec_this_font_tl { -- } } % needs to be non-empty as a flag + } +\__fontspec_keys_define_code:nnn {fontspec-preparse-nested} {Font} + { + \tl_set:Nn \l__fontspec_this_font_tl {#1} + } +\__fontspec_keys_define_code:nnn {fontspec} {SizeFeatures} + { + % dummy + } +\__fontspec_keys_define_code:nnn {fontspec} {Font} + { + % dummy } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Size} { - \tl_set:Nn \l_fontspec_size_tl {#1} + \tl_set:Nn \l__fontspec_size_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec-sizing} {Font} { - \fontspec_complete_fontname:Nn \l_fontspec_sizedfont_tl {#1} + \fontspec_complete_fontname:Nn \l__fontspec_sizedfont_tl {#1} } +\__fontspec_keys_define_code:nnn {fontspec-preparse} {NFSSFamily} + { + \tl_set:Nx \l__fontspec_nfss_fam_tl { #1 } + \cs_undefine:c {g__fontspec_UID_\l__fontspec_fontid_tl} + \tl_if_exist:NT \l_fontspec_family_tl + { \cs_undefine:c {g__fontspec_ \l_fontspec_family_tl _prop} } + } +\cs_generate_variant:Nn \prop_put:Nnn {Nxx} +\prop_new:N \l__fontspec_nfssfont_prop +\__fontspec_keys_define_code:nnn {fontspec} {FontFace} + { + \tl_set:No \l__fontspec_arg_tl { \use_iii:nnn #1 } + \tl_set_eq:NN \l__fontspec_this_feat_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_font_tl + \int_compare:nT { \clist_count:N \l__fontspec_arg_tl = 1 } + { + \tl_if_in:NnF \l__fontspec_arg_tl {=} + { + \tl_set_eq:NN \l__fontspec_this_font_tl \l__fontspec_arg_tl + \tl_clear:N \l__fontspec_this_feat_tl + } + } + + \__fontspec_add_nfssfont:oooo + {\use_i:nnn #1}{\use_ii:nnn #1}{\l__fontspec_this_font_tl}{\l__fontspec_this_feat_tl} + } +\cs_new:Nn \__fontspec_add_nfssfont:nnnn + { + \tl_set:Nx \l__fontspec_this_font_tl {#3} + + \tl_if_empty:xTF {#4} + { \clist_set:Nn \l__fontspec_sizefeat_clist {Size={-}} } + { \keys_set_known:noN {fontspec-preparse-nested} {#4} \l__fontspec_tmp_tl } + + \tl_if_empty:NF \l__fontspec_this_font_tl + { + \prop_put:Nxx \l__fontspec_nfssfont_prop {#1/#2} + { {#1}{#2}{\l__fontspec_this_font_tl}{#4}{\l__fontspec_sizefeat_clist} } + } + } +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {ooo} +\cs_generate_variant:Nn \__fontspec_add_nfssfont:nnnn {oooo} +\cs_generate_variant:Nn \tl_if_empty:nTF {x} \__fontspec_keys_define_code:nnn {fontspec} {Scale} { \str_case:nnn {#1} { - {MatchLowercase} { \fontspec_calc_scale:n {5} } - {MatchUppercase} { \fontspec_calc_scale:n {8} } + {MatchLowercase} { \__fontspec_calc_scale:n {5} } + {MatchUppercase} { \__fontspec_calc_scale:n {8} } } - { \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] } + { \tl_set:Nx \l__fontspec_scale_tl {#1} } + \tl_set:Nx \l__fontspec_scale_tl { s*[\l__fontspec_scale_tl] } } -\cs_new:Nn \fontspec_calc_scale:n +\cs_new:Nn \__fontspec_calc_scale:n { \group_begin: \rmfamily - \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} + \__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: } -\cs_new:Nn \fontspec_set_font_dimen:NnN +\cs_new:Nn \__fontspec_set_font_dimen:NnN { \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} @@ -1346,15 +1476,14 @@ } \__fontspec_keys_define_code:nnn {fontspec} {WordSpace} { - \fontspec_update_fontid:n {+wordspace:#1} - \bool_if:NF \l_fontspec_firsttime_bool + \bool_if:NF \l__fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop } } \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #1 \fontdimen 3 \font @@ -1362,7 +1491,7 @@ } } { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_set:Nn \l__fontspec_wordspace_adjust_tl { \fontdimen 2 \font = #1 \fontdimen 2 \font \fontdimen 3 \font = #2 \fontdimen 3 \font @@ -1372,26 +1501,37 @@ } \__fontspec_keys_define_code:nnn {fontspec} {PunctuationSpace} { - \fontspec_update_fontid:n {+punctspace:#1} - \tl_put_right:Nx \l_fontspec_postadjust_tl - { \fontdimen 7 \font = #1 \fontdimen 7 \font } + \str_case_x:nnn {#1} + { + {WordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 0 \fontdimen 2 \font } + } + {TwiceWordSpace} + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = 1 \fontdimen 2 \font } + } + } + { + \tl_set:Nn \l__fontspec_punctspace_adjust_tl + { \fontdimen 7 \font = #1 \fontdimen 7 \font } + } } \__fontspec_keys_define_code:nnn {fontspec} {FontAdjustment} { - \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} - \tl_put_right:Nx \l_fontspec_postadjust_tl {#1} + \tl_put_right:Nx \l__fontspec_postadjust_tl {#1} } \__fontspec_keys_define_code:nnn {fontspec} {LetterSpace} { - \fontspec_update_fontid:n {+tracking:#1} - \fontspec_update_featstr:n{letterspace=#1} + \__fontspec_update_featstr:n {letterspace=#1} } \__fontspec_keys_define_code:nnn {fontspec} {HyphenChar} { - \fontspec_update_fontid:n {+hyphenchar:#1} \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { @@ -1400,106 +1540,97 @@ { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } \font_glyph_if_exist:NnTF \l_fontspec_font {\l_fontspec_hyphenchar_tl} { - \tl_put_right:Nn \l_fontspec_postadjust_tl + \tl_put_right:Nn \l__fontspec_postadjust_tl { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: } } - { \fontspec_error:nx {no-glyph}{#1} } + { \__fontspec_error:nx {no-glyph}{#1} } } } \__fontspec_keys_define_code:nnn {fontspec} {Color} { - \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF { \token_to_str:N \color@ #1 } { - \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl + \convertcolorspec{named}{#1}{HTML}\l__fontspec_hexcol_tl } { \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_fontspec_hexcol_tl {#1} } + { \tl_set:Nn \l__fontspec_hexcol_tl {#1} } { \int_compare:nTF { \tl_count:n {#1} == 8 } { \fontspec_parse_colour:viii #1 } { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {bad-colour} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {bad-colour} {#1} } } } } } \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} - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \tl_set:Nn \l__fontspec_hexcol_tl {#1#2#3#4#5#6} + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice-col} {#7#8} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice-col} {#7#8} } } - \tl_set:Nn \l_fontspec_opacity_tl {#7#8} + \tl_set:Nn \l__fontspec_opacity_tl {#7#8} } \aliasfontfeature{Color}{Colour} -\int_new:N \l_fontspec_tmp_int +\int_new:N \l__fontspec_tmp_int \__fontspec_keys_define_code:nnn {fontspec} {Opacity} { - \fontspec_update_fontid:n {+opac:#1} - \int_set:Nn \l_fontspec_tmp_int {255} - \_int_mult_truncate:Nn \l_fontspec_tmp_int { #1 } - \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl + \int_set:Nn \l__fontspec_tmp_int {255} + \__fontspec_int_mult_truncate:Nn \l__fontspec_tmp_int { #1 } + \tl_if_eq:NNF \l__fontspec_opacity_tl \g__fontspec_opacity_tl { - \bool_if:NF \l_fontspec_firsttime_bool - { \fontspec_warning:nx {opa-twice} {#1} } + \bool_if:NF \l__fontspec_firsttime_bool + { \__fontspec_warning:nx {opa-twice} {#1} } } - \tl_set:Nx \l_fontspec_opacity_tl + \tl_set:Nx \l__fontspec_opacity_tl { - \int_compare:nT { \l_fontspec_tmp_int <= "F } {0} % zero pad - \int_to_hexadecimal:n { \l_fontspec_tmp_int } + \int_compare:nT { \l__fontspec_tmp_int <= "F } {0} % zero pad + \int_to_hexadecimal:n { \l__fontspec_tmp_int } } } \__fontspec_keys_define_code:nnn {fontspec} {Mapping} { - \fontspec_update_fontid:n {+map:#1} - \fontspec_update_featstr:n{mapping=#1} + \__fontspec_update_featstr:n { mapping = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {FeatureFile} { - \fontspec_update_fontid:n {+fea:#1} - \fontspec_update_featstr:n{featurefile=#1} + \__fontspec_update_featstr:n { featurefile = #1 } } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { - \fontspec_update_fontid:n {+weight:#1} - \fontspec_update_featstr:n{weight=#1} + \__fontspec_update_featstr:n{weight=#1} } \__fontspec_keys_define_code:nnn {fontspec} {Width} { - \fontspec_update_fontid:n {+width:#1} - \fontspec_update_featstr:n{width=#1} + \__fontspec_update_featstr:n{width=#1} } \__fontspec_keys_define_code:nnn {fontspec} {OpticalSize} { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { - \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \fontspec_update_fontid:n {+size:#1} + \tl_set:Nn \l__fontspec_optical_size_tl {/ S = #1} } { - \bool_if:NT \l_fontspec_mm_bool + \bool_if:NT \l__fontspec_mm_bool { - \fontspec_update_fontid:n {+size:#1} - \fontspec_update_featstr:n{optical size=#1} + \__fontspec_update_featstr:n { optical size = #1 } } } - \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool } + \bool_if:nT { !\l__fontspec_ot_bool && !\l__fontspec_mm_bool } { - \bool_if:NT \l_fontspec_firsttime_bool - { \fontspec_warning:n {no-opticals} } + \bool_if:NT \l__fontspec_firsttime_bool + { \__fontspec_warning:n {no-opticals} } } } \keys_define:nn {fontspec} { FakeSlant .code:n = { - \fontspec_update_fontid:n {+slant:#1} - \fontspec_update_featstr:n{slant=#1} + \__fontspec_update_featstr:n{slant=#1} }, FakeSlant .default:n = {0.2} } @@ -1507,8 +1638,7 @@ { FakeStretch .code:n = { - \fontspec_update_fontid:n {+extend:#1} - \fontspec_update_featstr:n{extend=#1} + \__fontspec_update_featstr:n{extend=#1} }, FakeStretch .default:n = {1.2} } @@ -1516,8 +1646,7 @@ { FakeBold .code:n = { - \fontspec_update_fontid:n {+embolden:#1} - \fontspec_update_featstr:n{embolden=#1} + \__fontspec_update_featstr:n {embolden=#1} }, FakeBold .default:n = {1.5} } @@ -1525,20 +1654,18 @@ { AutoFakeSlant .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \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} + \clist_put_right:Nn \l__fontspec_fontfeat_it_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_noit_bool - - \fontspec_update_fontid:n {fakeit:#1} + \bool_set_false:N \l__fontspec_noit_bool \tl_if_empty:NF \l_fontspec_fake_embolden_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=\l_fontspec_fake_embolden_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeSlant=#1} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } @@ -1549,128 +1676,125 @@ { AutoFakeBold .code:n = { - \bool_if:NT \l_fontspec_firsttime_bool + \bool_if:NT \l__fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} - \clist_put_right:Nn \l_fontspec_fontfeat_bf_clist {FakeBold=#1} + \clist_put_right:Nn \l__fontspec_fontfeat_bf_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl - \bool_set_false:N \l_fontspec_nobf_bool - - \fontspec_update_fontid:n {fakebf:#1} + \bool_set_false:N \l__fontspec_nobf_bool \tl_if_empty:NF \l_fontspec_fake_slant_tl { - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeSlant=\l_fontspec_fake_slant_tl} - \clist_put_right:Nx \l_fontspec_fontfeat_bfit_clist {FakeBold=#1} + \clist_put_right:Nx \l__fontspec_fontfeat_bfit_clist {FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } } }, AutoFakeBold .default:n = {1.5} } -\fontspec_define_font_feature:n{Ligatures} -\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} -\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} -\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} -\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} +\__fontspec_define_font_feature:n{Ligatures} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\__fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} \keys_define:nn {fontspec} { Ligatures / TeX .code:n = { - \fontspec_update_fontid:n {+map:tex-text} - \fontspec_update_featstr:n{mapping=tex-text} - } - } -\fontspec_define_font_feature:n{Letters} -\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} -\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} -\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} -\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} -\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} -\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} -\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} -\fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} -\fontspec_define_font_feature:n{Numbers} -\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} -\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} -\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} -\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} + \__fontspec_update_featstr:n { mapping = tex-text } + } + } +\__fontspec_define_font_feature:n{Letters} +\__fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\__fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\__fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\__fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\__fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\__fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\__fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\__fontspec_define_feature_option:nnnnn{Letters}{Random} {} {} {+rand} +\__fontspec_define_font_feature:n{Numbers} +\__fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\__fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\__fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} \luatex_if_engine:T { - \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} - } -\fontspec_define_font_feature:n {Contextuals} -\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} -\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} -\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} -\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} -\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} -\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} -\fontspec_define_font_feature:n{Diacritics} -\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} -\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} -\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} -\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} -\fontspec_define_font_feature:n{Kerning} -\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} -\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} -\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} -\fontspec_define_font_feature:n{VerticalPosition} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} -\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\fontspec_define_font_feature:n{Fractions} -\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} -\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} -\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} -\fontspec_define_font_feature:n { Alternate } + \__fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} + } +\__fontspec_define_font_feature:n {Contextuals} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\__fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\__fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\__fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\__fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\__fontspec_define_font_feature:n{Diacritics} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\__fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\__fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\__fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\__fontspec_define_font_feature:n{Kerning} +\__fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\__fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\__fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +\__fontspec_define_font_feature:n{VerticalPosition} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\__fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\__fontspec_define_font_feature:n{Fractions} +\__fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\__fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\__fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} +\__fontspec_define_font_feature:n { Alternate } \keys_define:nn {fontspec} { Alternate .default:n = {0} , @@ -1681,7 +1805,7 @@ } } \cs_set:Nn \fontspec_salt:n { +salt = #1 } -\fontspec_define_font_feature:n {Variant} +\__fontspec_define_font_feature:n {Variant} \keys_define:nn {fontspec} { Variant .default:n = {0} , @@ -1692,7 +1816,7 @@ } } \aliasfontfeature{Variant}{StylisticSet} -\fontspec_define_font_feature:n { CharacterVariant } +\__fontspec_define_font_feature:n { CharacterVariant } \use:x { \cs_new:Npn \exp_not:N \fontspec_parse_cv:w @@ -1713,63 +1837,50 @@ } } } -\keys_define:nn {fontspec} - { - ScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=0} - \fontspec_update_featstr:n{+sstyle} - }, - ScriptScriptStyle .code:n = - { - \fontspec_update_fontid:n {+ssty=1} - \fontspec_update_featstr:n{+ssstyle} - } - } -\fontspec_define_font_feature:n{Style} -\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} -\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} -\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} -\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} -\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} -\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} -\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} -\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} -\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_font_feature:n{Style} +\__fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\__fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\__fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\__fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\__fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\__fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\__fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\__fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\__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} -\fontspec_define_font_feature:n{CJKShape} -\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} -\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} -\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} -\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} -\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} -\fontspec_define_font_feature:n{CharacterWidth} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} -\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} -\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} -\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} -\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} -\fontspec_define_font_feature:n { Annotation } +\__fontspec_define_font_feature:n{CJKShape} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\__fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\__fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\__fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\__fontspec_define_font_feature:n{CharacterWidth} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\__fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\__fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} +\__fontspec_define_font_feature:n { Annotation } \keys_define:nn {fontspec} { Annotation .default:n = {0} , @@ -1783,15 +1894,13 @@ Vertical .choice: , Vertical / RotatedGlyphs .code:n = { - \bool_if:NTF \l_fontspec_icu_bool + \bool_if:NTF \l__fontspec_ot_bool { \fontspec_make_feature:nnn{}{}{+vrt2} - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } { - \fontspec_update_fontid:n {+vert} - \fontspec_update_featstr:n{vertical} + \__fontspec_update_featstr:n {vertical} } } } @@ -2039,18 +2148,16 @@ \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} + \__fontspec_warning:nx {language-not-exist} {Turkish} \keys_set:nn {fontspec} {Language=Default} } } @@ -2058,14 +2165,12 @@ } \__fontspec_keys_define_code:nnn {fontspec}{ Language / Default } { - \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} \int_zero:N \l_fontspec_language_int } \__fontspec_keys_define_code:nnn {fontspec} {RawFeature} { - \fontspec_update_fontid:n {+Raw:#1} - \fontspec_update_featstr:n{#1} + \__fontspec_update_featstr:n {#1} } \providecommand*{\sidefault}{si} \DeclareRobustCommand{\sishape} @@ -2106,23 +2211,23 @@ } \@ifpackageloaded{euler} { - \bool_set_true:N \g_fontspec_package_euler_loaded_bool + \bool_set_true:N \g__fontspec_pkg_euler_loaded_bool } { - \bool_set_false:N \g_fontspec_package_euler_loaded_bool + \bool_set_false:N \g__fontspec_pkg_euler_loaded_bool } \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler} { - \bool_if:NTF \g_fontspec_package_euler_loaded_bool - { \bool_set_true:N \g_fontspec_math_euler_bool } - { \fontspec_error:n {euler-too-late} } + \bool_if:NTF \g__fontspec_pkg_euler_loaded_bool + { \bool_set_true:N \g__fontspec_math_euler_bool } + { \__fontspec_error:n {euler-too-late} } } {} - \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} - \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g__fontspec_math_lucida_bool}{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -2141,13 +2246,13 @@ \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi \group_end: - \bool_if:NF \g_fontspec_math_euler_bool + \bool_if:NF \g__fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63} - \bool_if:NF \g_fontspec_math_lucida_bool + \bool_if:NF \g__fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} @@ -2180,67 +2285,67 @@ \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} } } - \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 + \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}\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}\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}\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\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}\g_fontspec_encoding_tl\g_fontspec_mathsf_tl\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\g_fontspec_encoding_tl\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 } \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor} { - \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@antt@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{iwona} { - \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \ifx\define@iwona@mathversions a\bool_set_false:N \g__fontspec_math_bool\fi }{} - \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g__fontspec_math_bool}{} \@ifpackageloaded{kurier} { - \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi + \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}{} - \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} - \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} - \bool_if:NT \g_fontspec_math_bool - { - \fontspec_info:n {setup-math} + \@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}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g__fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g__fontspec_math_bool}{} + \bool_if:NT \g__fontspec_math_bool + { + \__fontspec_info:n {setup-math} \fontspec_setup_maths: } } \AtBeginDocument{\fontspec_maybe_setup_maths:} -\bool_if:NT \g_fontspec_cfg_bool +\bool_if:NT \g__fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} @@ -2255,7 +2360,7 @@ } \ExplSyntaxOff %% -%% Copyright 2004--2013 Will Robertson +%% Copyright 2004--2014 Will Robertson %% Copyright 2009--2013 Khaled Hosny %% %% Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg index 95111cba254..a028c587783 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg @@ -1,6 +1,15 @@ +\defaultfontfeatures + [\rmfamily,\sffamily] + {Ligatures=TeX} + +\defaultfontfeatures + [\ttfamily] + {WordSpace={1,0,0}, + PunctuationSpace=WordSpace} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%% diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index 94a9479d4e7..b1f2f299cbb 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -8,7 +8,7 @@ -- -- _________________________________________ -- The fontspec package for XeLaTeX/LuaLaTeX --- (C) 2004--2013 Will Robertson and Khaled Hosny +-- (C) 2004--2014 Will Robertson and Khaled Hosny -- -- License information appended. -- @@ -79,7 +79,7 @@ function fontspec.mathfontdimen(fnt, str) end end -- --- Copyright 2004--2013 Will Robertson +-- Copyright 2004--2014 Will Robertson -- Copyright 2009--2013 Khaled Hosny -- -- Distributable under the LaTeX Project Public License, diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index e8a7d357965..c20dbb3ad22 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -8,13 +8,13 @@ %% %% _________________________________________ %% The fontspec package for XeLaTeX/LuaLaTeX -%% (C) 2004--2013 Will Robertson and Khaled Hosny +%% (C) 2004--2014 Will Robertson and Khaled Hosny %% %% License information appended. %% %% \ProvidesPackage{fontspec} - [2013/05/20 v2.3c Font selection for XeLaTeX and LuaLaTeX] + [2014/06/01 v2.4 Font selection for XeLaTeX and LuaLaTeX] \RequirePackage{expl3}[2011/09/05] @@ -39,28 +39,28 @@ \msg_fatal:nn {fontspec} {cannot-use-pdftex} } } -\bool_new:N \l_fontspec_firsttime_bool -\bool_new:N \l_fontspec_nobf_bool -\bool_new:N \l_fontspec_noit_bool -\bool_new:N \l_fontspec_nosc_bool -\bool_new:N \l_fontspec_tfm_bool -\bool_new:N \l_fontspec_atsui_bool -\bool_new:N \l_fontspec_icu_bool -\bool_new:N \l_fontspec_mm_bool -\bool_new:N \l_fontspec_graphite_bool -\bool_new:N \g_fontspec_math_euler_bool -\bool_new:N \g_fontspec_math_lucida_bool -\bool_new:N \g_fontspec_package_euler_loaded_bool -\bool_new:N \g_fontspec_cfg_bool -\bool_new:N \g_fontspec_math_bool +\bool_new:N \l__fontspec_firsttime_bool +\bool_new:N \l__fontspec_nobf_bool +\bool_new:N \l__fontspec_noit_bool +\bool_new:N \l__fontspec_nosc_bool +\bool_new:N \l__fontspec_tfm_bool +\bool_new:N \l__fontspec_atsui_bool +\bool_new:N \l__fontspec_ot_bool +\bool_new:N \l__fontspec_mm_bool +\bool_new:N \l__fontspec_graphite_bool +\bool_new:N \g__fontspec_math_euler_bool +\bool_new:N \g__fontspec_math_lucida_bool +\bool_new:N \g__fontspec_pkg_euler_loaded_bool +\bool_new:N \g__fontspec_cfg_bool +\bool_new:N \g__fontspec_math_bool \int_new:N \l_fontspec_script_int \int_new:N \l_fontspec_language_int \int_new:N \l_fontspec_strnum_int -\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 +\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 \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} @@ -69,19 +69,19 @@ \cs_generate_variant:Nn \tl_gset:Nn {cV} \cs_generate_variant:Nn \keys_set:nn {nx} \cs_generate_variant:Nn \keys_set_known:nnN {nx} -\cs_new:Nn \_int_mult_truncate:Nn +\cs_new:Nn \__fontspec_int_mult_truncate:Nn { - \int_set:Nn #1 { \dim_eval:w #2 #1 \dim_eval_end: } + \int_set:Nn #1 { \__dim_eval:w #2 #1 \__dim_eval_end: } } -\cs_new:Npn \fontspec_error:n { \msg_error:nn {fontspec} } -\cs_new:Npn \fontspec_error:nx { \msg_error:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:n { \msg_warning:nn {fontspec} } -\cs_new:Npn \fontspec_warning:nx { \msg_warning:nnx {fontspec} } -\cs_new:Npn \fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } -\cs_new:Npn \fontspec_info:n { \msg_info:nn {fontspec} } -\cs_new:Npn \fontspec_info:nx { \msg_info:nnx {fontspec} } -\cs_new:Npn \fontspec_info:nxx { \msg_info:nnxx {fontspec} } -\cs_new:Npn \fontspec_trace:n { \msg_trace:nn {fontspec} } +\cs_new:Npn \__fontspec_error:n { \msg_error:nn {fontspec} } +\cs_new:Npn \__fontspec_error:nx { \msg_error:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:n { \msg_warning:nn {fontspec} } +\cs_new:Npn \__fontspec_warning:nx { \msg_warning:nnx {fontspec} } +\cs_new:Npn \__fontspec_warning:nxx { \msg_warning:nnxx {fontspec} } +\cs_new:Npn \__fontspec_info:n { \msg_info:nn {fontspec} } +\cs_new:Npn \__fontspec_info:nx { \msg_info:nnx {fontspec} } +\cs_new:Npn \__fontspec_info:nxx { \msg_info:nnxx {fontspec} } +\cs_new:Npn \__fontspec_trace:n { \msg_trace:nn {fontspec} } \msg_new:nnn {fontspec} {no-size-info} { Size~ information~ must~ be~ supplied.\\ @@ -164,13 +164,13 @@ \msg_new:nnn {fontspec} {icu-feature-not-exist} { '\l_keys_key_tl=\l_keys_value_tl'~ feature~ not~ supported~ - for~ ICU~ font~ '\l_fontspec_fontname_tl' + for~ OpenType~ font~ '\l_fontspec_fontname_tl' } \msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} { 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'. + with~ script~ '\l__fontspec_script_name_tl'~ and~ language~ '\l__fontspec_lang_name_tl'. } \msg_new:nnn {fontspec} {no-opticals} { @@ -180,7 +180,7 @@ { Language~ '#1'~ not~ available~ for~ font~ '\l_fontspec_fontname_tl'~ - with~ script~ '\l_fontspec_script_name_tl'.\\ + with~ script~ '\l__fontspec_script_name_tl'.\\ 'Default'~ language~ used~ instead. } \msg_new:nnn {fontspec} {only-xetex-feature} @@ -212,7 +212,7 @@ \msg_new:nnn {fontspec} {defining-font} { Font~ family~'\l_fontspec_family_tl'~ created~ for~ font~ '#2'~ - with~ options~ [\g_fontspec_default_fontopts_tl #1].\\ + with~ options~ [\l__fontspec_all_features_clist].\\ \\ This~ font~ family~ consists~ of~ the~ following~ shapes: \l_fontspec_defined_shapes_tl @@ -223,7 +223,7 @@ } \msg_new:nnn {fontspec} {set-scale} { - \l_fontspec_fontname_tl\space scale ~=~ \l_fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale ~=~ \l__fontspec_scale_tl. } \msg_new:nnn {fontspec} {setup-math} { @@ -252,11 +252,11 @@ *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity } \DeclareOption{cm-default} - { \fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool} -\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool} -\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool} -\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool} + { \__fontspec_warning:n {cm-default-obsolete} } +\DeclareOption{math}{\bool_set_true:N \g__fontspec_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g__fontspec_math_bool} +\DeclareOption{config}{\bool_set_true:N \g__fontspec_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g__fontspec_cfg_bool} \DeclareOption{quiet} { \msg_redirect_module:nnn { fontspec } { warning } { info } @@ -273,7 +273,7 @@ \luatex_if_engine:T { \RequirePackage{fontspec-luatex} \endinput } \xetex_if_engine:T { \RequirePackage{fontspec-xetex} \endinput } %% -%% Copyright 2004--2013 Will Robertson +%% Copyright 2004--2014 Will Robertson %% Copyright 2009--2013 Khaled Hosny %% %% Distributable under the LaTeX Project Public License, -- cgit v1.2.3