diff options
author | Karl Berry <karl@freefriends.org> | 2017-02-12 23:33:12 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-02-12 23:33:12 +0000 |
commit | 2783c1b2807e488a59202f7e4605c8d5693c9ab7 (patch) | |
tree | 9507bb165af179f4b55f0cf049b2465965909193 | |
parent | 88ad6ed6179838d65a8c79c1867b8c1de2db3079 (diff) |
fontspec (12feb17)
git-svn-id: svn://tug.org/texlive/trunk@43202 c570f23f-e606-0410-a88d-b1316a301751
26 files changed, 965 insertions, 297 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README.md b/Master/texmf-dist/doc/latex/fontspec/README.md index 1772e4da9ec..f8eb2480e86 100644 --- a/Master/texmf-dist/doc/latex/fontspec/README.md +++ b/Master/texmf-dist/doc/latex/fontspec/README.md @@ -1,5 +1,5 @@ -THE FONTSPEC PACKAGE v2.5d -========================== +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) @@ -69,6 +69,20 @@ To add features to the font family currently in use: Change history -------------- +- v2.6 (2017/02/12) + + * Change the new behaviour of `\emph` (and `\emfontdeclare`) to act only on the NFSS font shape; using the series as well was too fragile. + * Add `\strong` as the "weight" analogy to `\emph`. This will need some extra syntactic sugar from `fontspec` before it becomes truly useful. + * Add `Numbers=Tabular` alias for `Numbers=Monospaced`. + * Fix occasional bug with "chained" keyval choices such as `Numbers={Lining,Proportional}` in which only the first choice would be recognised. + * Fix interaction with `RawFeature` and "proper" `fontspec` features. + * Fix regression in which `C:\...` file paths in Windows couldn't be used. + * Fix regression in XeTeX in which `Ligatures=TeX` overrode `Mapping=..` regardless of where the former was declared in the feature list. + * Fix bug (sorry!) in `\newopentypefeature`. + * Improve monospace font in documentation. + + * N.B. There is currently a known issue with TTC fonts and LuaTeX; currently they cannot be loaded through the `fontspec` interface, but this issue should soon be addressed by the `luaotfload` package. + - v2.5d (2017/01/24) "oops" * Add `\fontspec_if_small_caps:TF` diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf Binary files differindex ab47980d461..5f028e7404b 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex index a0e95d282e6..3a1da2019ac 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-featset.tex @@ -514,9 +514,9 @@ This package redefines \LaTeX's \cmd\-\ macro such that it adjusts along with th EXAMPLE HYPHENATION% }}\qquad\qquad\null\par\bigskip} - \fontspec{Linux Libertine O}[HyphenChar=None] + \fontspec{LinLibertine_R.otf}[HyphenChar=None] \text - \fontspec{Linux Libertine O}[HyphenChar={+}] + \fontspec{LinLibertine_R.otf}[HyphenChar={+}] \text \end{Xexample} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex index 110266c858a..90892939bfc 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-fontsel.tex @@ -14,17 +14,19 @@ fonts. } These are the main font-selecting commands of this package. -The \cs{fontspec} command selects a font for one-time use; all +The \cs{fontspec} command selects a font for one-time use only; all others should be used to define the standard fonts used in a document, as shown in \exref{fontload}. 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. +Note that further options may need to be added to select appropriate bold/italic fonts, +but this shows the main idea. \begin{Lexample}{fontload}{Loading the default, sans serif, and monospaced fonts.} \setmainfont{texgyrebonum-regular.otf} \setsansfont{lmsans10-regular.otf}[Scale=MatchLowercase] - \setmonofont{Inconsolata.otf}[Scale=MatchLowercase] + \setmonofont{Inconsolatazi4-Regular.otf}[Scale=MatchLowercase] \rmfamily Pack my box with five dozen liquor jugs\par \sffamily Pack my box with five dozen liquor jugs\par @@ -390,6 +392,24 @@ The \feat{FontFace} command also interacts properly with the \feat{SizeFeatures} \end{Verbatim} Note that if the first \feat{Font} feature is omitted then each size needs its own inner \feat{Font} declaration. +\subsubsection{An example for \cs{strong}} +\label{sec:strong-example} + +If you wanted to set up a font family to allow nesting of the \cs{strong} +to easily access increasing font weights, you might use a declaration along the following lines: +\begin{Verbatim} +\setmonofont{SourceCodePro}[ + Extension = .otf , + UprightFont = *-Light , + BoldFont = *-Regular , + FontFace = {k}{n}{*-Black} , +] +\strongfontdeclare{\bfseries,\fontseries{k}\selectfont} +\end{Verbatim} + +Further `syntactic sugar' is planned to make this process somewhat easier. + + \subsection{Math(s) fonts} When \cmd\setmainfont, \cmd\setsansfont\ and \cmd\setmonofont\ are used in the diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex index 560a68e003b..61636f44ac0 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-intro.tex @@ -180,16 +180,15 @@ For example, will produce small caps within |\emph{\emph{...}}|. \DescribeMacro{\emfontdeclare} -The \pkg{fontspec} package takes this idea one step further to allow arbitrary font changes (e.g., boldness) and arbitrary levels of nesting within emphasis. +The \pkg{fontspec} package takes this idea one step further to allow arbitrary font shape changes and arbitrary levels of nesting within emphasis. This is performed using the |\emfontdeclare| command, which takes a comma-separated list of font switches corresponding to increasing levels of emphasis. -Two examples: +An example: \begin{enumerate} \item |\emfontdeclare{\itshape,\upshape\scshape,\itshape}| will lead to `italics', `small caps', then `italic small caps' as the level of emphasis increases, as long as italic small caps are defined for the font. Note that |\upshape| is required because the font changes are cascading. -\item |\emfontdeclare{\bfseries,\fontseries{h}\selectfont,\fontseries{x}\selectfont}| could lead to (if fonts are set up correctly) `bold', `heavy', and `extra bold'. \end{enumerate} -The implementation of these feature tries to be `smart' and guess what level of emphasis to use in the case of manual font changing. -This is reliable only if you use series- and/or shape- changing commands in \cs{emfontdeclare}. +The implementation of this feature tries to be `smart' and guess what level of emphasis to use in the case of manual font changing. +This is reliable only if you use shape-changing commands in \cs{emfontdeclare}. For example: \begin{Verbatim} \emfontdeclare{\itshape,\upshape\scshape,\itshape} @@ -200,3 +199,31 @@ Here, the emphasised text `hello' will be printed in italic small caps since |\e \DescribeMacro{\emreset} Finally, if you have so much nested emphasis that |\emfontdeclare| runs out of options, it will insert |\emreset| (by default just |\upshape|) and start again from the beginning. + + +\subsection{Strong emphasis} + +\DescribeMacro{\strong} +\DescribeMacro{\strongenv} +The \cs{strong} macro is used analogously to \cs{emph} but produces variations in weight. +If you need it in environment form, use |\begin{strongenv}...\end{strongenv}|. + +As with emphasis, this font-switching command is intended to move through a range +of font weights. For example, if the fonts are set up correctly it allows usage such as +|\strong{...\strong{...}}| in which each nested \cs{strong} macro increases the +weight of the font. + +\DescribeMacro{\strongfontdeclare} +Currently this feature set is somewhat experimental and there is no syntactic sugar +to easily define a range of font weights using \pkg{fontspec} commands. +Use, say, the following to define first bold and then black (|k|) font faces for \cs{strong}: +\begin{Verbatim} + \strongfontdeclare{\bfseries,\fontseries{k}\selectfont} +\end{Verbatim} + +\DescribeMacro{\strongreset} +If too many levels of \cs{strong} are reached, \cs{strongreset} is inserted. +By default this is a no-op and the font will simply remain the same. +Use \cs{renewcommand}\cs{strongreset}|{\mdseries}| to start again from the beginning if desired. + +An example for setting up a font family for use with \cs{strong} is discussed in \vref{sec:strong-example}. diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex index c2ae7daf5ad..87b95db3687 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-luatex.tex @@ -21,13 +21,10 @@ Please refer to the \LuaTeX/\pkg{luaotfload} documentation for more details. \directlua{ fonts.handlers.otf.addfeature { name = "oneb", - { - type = "substitution", - data = { + type = "substitution", + data = { ["1"] = "one.ss01", - }, - }, - "feature oneb for vollkorn font", + } } } \setmainfont{Vollkorn-Regular.otf}[RawFeature=+oneb] diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex index cd4ac0b5724..31923746f9d 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-opentype.tex @@ -280,7 +280,7 @@ will look. OpenType fonts may contain the following options: \Huge\centering \def\test#1#2{% #2 $\to$ {\addfontfeature{#1} #2}\\} - \fontspec{Linux Libertine O} + \fontspec{LinLibertine_R.otf} \test{Ligatures=Historic}{strict} \test{Ligatures=Rare}{wurtzite} \test{Ligatures=NoCommon}{firefly} @@ -324,7 +324,7 @@ in \exref{letters-uppercase}; note the raised position of the hyphen to better match the surrounding letters. \begin{Lexample}{letters-uppercase}{An example of the \opt{Uppercase} option of the \feat{Letters} feature.} - \fontspec{Linux Libertine O} + \fontspec{LinLibertine_R.otf} UPPER-CASE example \\ \addfontfeature{Letters=Uppercase} UPPER-CASE example @@ -775,7 +775,7 @@ to \texttt{Alternate=0} to access the default case. \begin{Xexample}[firstline=2]{salt}{The \feat{Alternate} feature.} \huge - \fontspec{Linux Libertine O} + \fontspec{LinLibertine_R.otf} \textsc{a} \& h \\ \addfontfeature{Alternate=0} \textsc{a} \& h diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-style.sty b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-style.sty new file mode 100644 index 00000000000..115d52a3b18 --- /dev/null +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-style.sty @@ -0,0 +1,288 @@ +\ProvidesPackage{fontspec-doc-style} + +\usepackage{fontspec,booktabs,calc,caption,color,enumitem,flafter,fancyvrb,hologo,graphicx, + ifthen,url,varioref,varwidth,microtype,tocloft,framed,xparse,docmute} + +%% Various labelling commands: +\newcommand*\name[1]{{#1}} +\newcommand*\pkg[1]{\textsf{#1}} +\newcommand*\opt[1]{\texttt{#1}} +\newcommand*\feat[1]{\texttt{#1}} + +\let\latin\textit +\def\eg{\latin{e.g.}} +\def\ie{\latin{i.e.}} +\def\Eg{\latin{E.g.}} +\def\Ie{\latin{I.e.}} +\def\etc{\@ifnextchar.{\latin{etc}}{\latin{etc.}\@}} + +\newcommand\note[1]{\unskip\footnote{#1}} + +\def\MacOSX{Mac~OS~X} +\def\AAT{\textsc{aat}} +\def\ATSUI{\textsc{atsui}} + +\newcommand\NFSS{\textsc{nfss}} +\newcommand\XeTeX{\hologo{XeTeX}} +\newcommand\XeLaTeX{\hologo{XeLaTeX}} +\newcommand\LuaTeX{\hologo{LuaTeX}} +\newcommand\LuaLaTeX{\hologo{LuaLaTeX}} + +% ToC formatting: +\setlength\cftsubsecnumwidth{1.4\cftsubsecnumwidth} +%\def\@cfttocstart{\small\begin{multicols}{2}} +%\def\@cfttocfinish{\end{multicols}} + +\fvset{gobble=0} + +\captionsetup[table]{position=above} +\captionsetup[figure]{position=above} + + +%% Fonts + +\defaultfontfeatures{Numbers=OldStyle} +\IfFontExistsTF{AldusNovaPro-Book.otf} + { + \setmainfont{aldus-nova} + \setsansfont{palatino-sans-light} + } + { +\setmainfont{texgyrepagella}[ + Extension = .otf, + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , +] +\setsansfont{texgyreheros}[ + Extension = .otf, + UprightFont = *-regular , + ItalicFont = *-italic , + BoldFont = *-bold , + BoldItalicFont = *-bolditalic , +] + } +\setmonofont{lmmono10-regular.otf}[ + Numbers={Lining,SlashedZero}, + ItalicFont=lmmonoslant10-regular.otf, + BoldFont=lmmonolt10-bold.otf, + BoldItalicFont=lmmonolt10-boldoblique.otf, +] +\newfontfamily\ttcondensed{lmmonoltcond10-regular.otf} + +%% (La)TeX font-related declarations: +\linespread{1.05} % Pagella needs more space between lines +\frenchspacing % Remove ugly extra space after punctuation + +\usepackage[ + bookmarks=true, + colorlinks=true, + linkcolor=niceblue, + urlcolor=niceblue, + citecolor=niceblue, + pdftitle={The fontspec package}, + pdfsubject={Advanced font selection for XeLaTeX/LuaLaTeX}, + pdfauthor={Will Robertson}, + pdfkeywords={xetex, xelatex, luatex, lualatex, unicode, opentype, aat} + ]{hyperref} + + + +%% ToC +\def\@dotsep{1000} +\setcounter{tocdepth}{2} +\setlength\columnseprule{0.4pt} +\renewcommand\tableofcontents{\relax + \begin{multicols}{2}[\section*{\contentsname}]\relax + \@starttoc{toc}\relax + \end{multicols}} + + +%% Index +\setcounter{IndexColumns}{2} +\renewenvironment{theglossary} + {\small\list{}{} + \item\relax + \glossary@prologue\GlossaryParms + \let\item\@idxitem \ignorespaces + \def\pfill{\hspace*{\fill}}} + {\endlist} + + + +%% varioref definitions: +\labelformat{table}{Table~#1} +\labelformat{section}{Section~#1} +\labelformat{subsection}{Section~#1} + +\definecolor{niceblue}{rgb}{0.1,0.2,0.8} + + + + +%% EXAMPLES + +\newsavebox\X +\newsavebox\Y + +\newcounter{example} + +\newcommand\exref[1]{Example~\ref{ex:#1}} +\newcommand\Exref[1]{Example~\ref{ex:#1}} + +\newenvironment{Xexample}[3][] + {\VerbatimEnvironment\begin{Fexample}[#1]{#2}{#3}{X}} + {\end{Fexample}} + +\newenvironment{Lexample}[3][] + {\VerbatimEnvironment\begin{Fexample}[#1]{#2}{#3}{L}} + {\end{Fexample}} + +\newenvironment{Fexample}[4][] + {% + \def\options{#1}% + \def\filename{#2}% + \def\captiontext{#3}% + \def\prefix{#4} + \refstepcounter{example}% + \label{ex:\filename}% + \IfFileExists{zzz-\theexample-\prefix-\filename.tex}{}{% + \immediate\write18{rm -f zzz-\theexample-* ;}% + }% + \VerbatimEnvironment + \begin{VerbatimOut}{zzz-\theexample-\prefix-\filename.tex}} +% text in the environment + {\end{VerbatimOut} + \begin{figure} + \setlength\parindent{0pt}% + \edef\@tempa{[gobble=0,fontsize=\noexpand\small,\options]}% + \savebox\X{% + \expandafter\BVerbatimInput + \@tempa{zzz-\theexample-\prefix-\filename.tex}% + }% + \IfFileExists{zzz-\theexample-\prefix-\filename.pdf}{} + {% + \edef\XXcmd{% + \unexpanded{% + \RequirePackage{luatex85} + \documentclass[margin=0.2mm]{standalone} + \usepackage{booktabs,ifthen,graphicx,xcolor,varwidth} + \usepackage{fontspec} + \defaultfontfeatures{Ligatures=TeX} + \begin{document} + \begin{varwidth}{0.7\linewidth} + \input} zzz-\theexample-\prefix-\filename.tex + \unexpanded{ + \end{varwidth} + \end{document} + }% + }% + \edef\1{% + \csname prog@\prefix\endcsname "\unexpanded\expandafter{\XXcmd}"; + printf '\@percentchar s' '\unexpanded\expandafter{\XXcmd}' > zzz-\theexample-\prefix-\filename-test.tex; + }% + \immediate\write18{\unexpanded\expandafter{\1}}% + }% + \savebox\Y{% + \IfFileExists{zzz-\theexample-\prefix-\filename.pdf} + {\includegraphics{zzz-\theexample-\prefix-\filename.pdf}} + {\color{red}\itshape ---Graphic not generated---}% + } + % TYPESETTING + \rule[0.5\baselineskip]{\columnwidth}{1pt}% + \vspace{-1.2ex}% + \def\@tempa{\small\textsf{Example~\theexample:~}}% + \settowidth\@tempdima{\@tempa\captiontext}% + \par + \ifdim\@tempdima>\linewidth + \settowidth\@tempdima{\@tempa}% + \@tempa\parbox[t]{\linewidth-\@tempdima}{\small\captiontext}% + \vspace{0.4\baselineskip}% + \else + \parbox{\linewidth}{\centering\@tempa~\captiontext}% + \fi + \par\rule[0.4\baselineskip]{\columnwidth}{0.4pt}\par + \ifdim\dimexpr\wd\X+\wd\Y>\linewidth\relax + \null\hfill\makebox[0pt][r]{\usebox\Y}\usebox\X + \else + \hfill\usebox\Y\hfill\usebox\X + \fi + \par\rule[0.5\baselineskip]{\columnwidth}{1pt} + \end{figure} +} + +\def\prog@X{xelatex + -jobname=zzz-\theexample-X-\filename\space} + +\def\prog@L{lualatex + -jobname=zzz-\theexample-L-\filename\space} + +%%%%%%%%%%%%%%%%%%%%%% + +\newcommand*\setexsize[1]{\let\examplesize#1} +\newcommand*\setverbwidth[1]{\def\auxwidth{#1}} + + + +\newcounter{argument} +\g@addto@macro\endmacro{\setcounter{argument}{0}} +\newcommand*\darg[1]{% + \stepcounter{argument}% + \noindent{\ttfamily\char`\#\theargument~:~}#1\par} +\newcommand*\doarg[1]{% + \stepcounter{argument}% + \noindent{\ttfamily\makebox[0pt][r]{[}\char`\#\theargument]:~}#1\par} + +\newcommand\unichar[2]{\textsc{\MakeLowercase{u+#1: #2}}} + +\newcommand\cmdbox[1]{% + \smallskip\par\noindent + \fbox{\begin{varwidth}{\linewidth} + #1% + \end{varwidth}}% + \smallskip +} +\def\CMD#1{\texttt{\null#1\unskip}} + + +\NewDocumentCommand \otf {somm} {% + \featname & #3 & \texttt{#4} + \IfBooleanT #1 { & \textdagger } + \\ +} +\newenvironment{features}[1]{% + \def\NOTE{} + \def\thisfeatname{#1}% + \def\featname{\thisfeatname~~\texttt=~~\null\gdef\featname{}}% + \begin{table} + \caption{Options for the OpenType font feature `\thisfeatname'.} + \edef\@tempa{\noexpand\label{feat:\thisfeatname}}\@tempa + \centering + \begin{tabular}{@{}l@{}l@{\hspace{0.5\tabcolsep}}l@{\hspace{0.5\tabcolsep}}l@{}} + \toprule + Feature & Option & Tag & \\ + \midrule +}{ + \bottomrule + \end{tabular} + \par\smallskip + \footnotesize + \textdagger\ These feature options can be disabled with \texttt{..Off} variants, and reset \\ to default state (neither explicitly on nor off) with \texttt{..Reset}. + \NOTE + \end{table} +} + + +%%%%%%%%%%% + +\def \MakePrivateLetters {% + \catcode `\@ = 11 + \catcode `\_ = 11 + \catcode `\: = 11 +} + +%% for LaTeX3 csnames +\catcode `\_= 11 + +\renewcommand\partname{Part} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex index c4684d8c915..62bae7e44d1 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc-xetex.tex @@ -18,6 +18,8 @@ selected by \pkg{fontspec}. ``!`A small amount of---text!'' \end{Xexample} +Only one mapping can be active at a time and a second call to \feat{Mapping} +will simply override the first. Using the |tex-text| mapping is also equivalent to writing |Ligatures=TeX|. The use of the latter syntax is recommended for better compatibility with \LuaTeX\ documents. @@ -53,8 +55,8 @@ select the \opt{OpenType} renderer.} Multiple Master fonts are parameterised over orthogonal font axes, allowing continuous selection along such -features as weight, width, and optical size~(see \vref{sec:mm} for -further details). Whereas an OpenType font will have only a few separate +features as weight, width, and optical size. +Whereas an OpenType font will have only a few separate optical sizes, a Multiple Master font's optical size can be specified over a continuous range. Unfortunately, this flexibility makes it harder to create an automatic interface through \LaTeX, and the diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-doc.tex b/Master/texmf-dist/source/latex/fontspec/fontspec-doc.tex index ccd3f1f80c5..537510a8b91 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-doc.tex +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-doc.tex @@ -19,7 +19,7 @@ \title{The \textsf{fontspec} package\\Font selection for \XeLaTeX\ and \LuaLaTeX} \author{ \textsc{Will Robertson} and \textsc{Khaled Hosny}\\ - \texttt{will.robertson@latex-project.org} + \url{http://wspr.io/fontspec/} } \date{\filedate \qquad \fileversion} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx index deda43cc049..eeabacc0742 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-feat-aat.dtx @@ -39,7 +39,7 @@ { Ligatures / TeX .code:n = { - \@@_update_featstr:n { mapping = tex-text } + \tl_set:Nn \l_@@_mapping_tl { tex-text } } } % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx index 7bfada24d79..168f1f36d9e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-feat-opentype.dtx @@ -39,7 +39,13 @@ % \end{macrocode} % Emulate CM extra ligatures. % \begin{macrocode} -%<xetexx>\@@_define_opentype_onreset:nnnnn {Ligatures} {TeX} {} { mapping = tex-text } {} +%<*xetexx> +\keys_define:nn {fontspec-opentype} + { + Ligatures / TeX .code:n = { \tl_set:Nn \l_@@_mapping_tl {tex-text} }, + Ligatures / TeXReset .code:n = { \tl_clear:N \l_@@_mapping_tl }, + } +%</xetexx> %<luatex>\@@_define_opentype_onreset:nnnnn {Ligatures} {TeX} {} { +tlig } {} % \end{macrocode} % @@ -86,8 +92,9 @@ % \end{macrocode} % % \begin{macrocode} -\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} -\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} +\aliasfontfeatureoption {Numbers} {Monospaced} {Tabular} +\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} +\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} % \end{macrocode} % % |luaotload| provides a custom |anum| feature for replacing Latin diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx index 88d5d1407dd..0f0bfedb9f3 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-fontload.dtx @@ -1,5 +1,5 @@ -% \section{expl3 interface for font loading} +% \section{expl3 interface for primitive font loading} % % \iffalse % \begin{macrocode} @@ -13,6 +13,8 @@ { \font #1 = #2 ~at~ #3 \scan_stop: } +% \end{macrocode} +% \begin{macrocode} \cs_set:Npn \@@_primitive_font_gset:Nnn #1#2#3 { \global \font #1 = #2 ~at~ #3 \scan_stop: diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx index c57f0890a92..2de5752f0df 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-internal.dtx @@ -247,7 +247,9 @@ % \begin{macrocode} \cs_set:Nn \@@_construct_font_call:nnnnnn { - " \@@_fontname_wrap:n { #1 #2 #3 } #4 #5 +%<xetexx> " \@@_fontname_wrap:n { #1 #2 #3 } +%<luatex> " \@@_fontname_wrap:n { #1 #2 } #3 + #4 #5 \str_if_eq_x:nnF {#6}{} {:#6} " } % \end{macrocode} @@ -276,8 +278,7 @@ } \cs_new:Nn \@@_font_is_file: { -%<xetexx> \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] } -%<luatex> \cs_set:Npn \@@_fontname_wrap:n ##1 { file:\l_@@_font_path_tl ##1 } + \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] } } % \end{macrocode} % \end{macro} @@ -341,19 +342,24 @@ \bool_if:NTF \l_@@_ot_bool { %<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"} - \keys_set:nx {fontspec-opentype} {\l_@@_keys_leftover_clist} + % \tracingall + \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist + % \EROROR } { %<debug> \typeout{::: Setting~ keys~ for~ AAT~ font~ features:~"\l_@@_keys_leftover_clist"} \bool_if:NT \l_@@_atsui_bool - { \keys_set:nx {fontspec-aat} {\l_@@_keys_leftover_clist} } + { \keys_set:nV {fontspec-aat} \l_@@_keys_leftover_clist } } %</xetexx> %<*luatex> %<debug> \typeout{::: Setting~ keys~ for~ OpenType~ font~ features:~"\l_@@_keys_leftover_clist"} - \keys_set:nx {fontspec-opentype} {\l_@@_keys_leftover_clist} + \keys_set:nV {fontspec-opentype} \l_@@_keys_leftover_clist %</luatex> + \tl_if_empty:NF \l_@@_mapping_tl + { \@@_update_featstr:n { mapping = \l_@@_mapping_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 } } diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx index de3a804aabe..f81e1680d5b 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-keyval.dtx @@ -646,13 +646,18 @@ % % \paragraph{Mapping} % \begin{macrocode} -\@@_keys_define_code:nnn {fontspec} {Mapping} %<*xetexx> - { - \@@_update_featstr:n { mapping = #1 } - } +\@@_keys_define_code:nnn {fontspec-aat} {Mapping} + { + \tl_set:Nn \l_@@_mapping_tl { #1 } + } +\@@_keys_define_code:nnn {fontspec-opentype} {Mapping} + { + \tl_set:Nn \l_@@_mapping_tl { #1 } + } %</xetexx> %<*luatex> +\@@_keys_define_code:nnn {fontspec-opentype} {Mapping} { \str_if_eq:nnTF {#1} {tex-text} { @@ -805,7 +810,11 @@ % This allows savvy \XeTeX-ers to input font features manually if they have % already memorised the OpenType abbreviations and don't mind not having error checking. % \begin{macrocode} -\@@_keys_define_code:nnn {fontspec} {RawFeature} +\@@_keys_define_code:nnn {fontspec-opentype} {RawFeature} + { + \@@_update_featstr:n {#1} + } +\@@_keys_define_code:nnn {fontspec-aat} {RawFeature} { \@@_update_featstr:n {#1} } diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx index 20a2e97e070..269d18a4d6e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-lua.dtx @@ -3,20 +3,7 @@ % \begin{macrocode} %<*lua> % \end{macrocode} -% First we define some metadata. % \begin{macrocode} -fontspec = fontspec or {} -local fontspec = fontspec -fontspec.module = { - name = "fontspec", - version = "2.5a", - date = "2016/02/01", - description = "Advanced font selection for LuaLaTeX.", - author = "Khaled Hosny, Philipp Gesang, Will Robertson", - copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", - license = "LPPL" -} - local err, warn, info, log = luatexbase.provides_module(fontspec.module) % \end{macrocode} % Some utility functions diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx index cf655be78b2..5e04573ff23 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-opentype.dtx @@ -39,7 +39,11 @@ \@@_feat_prop_add:nn {#3} {#1\,=\,#2} \keys_define:nn {fontspec-opentype} { - #1/#2 .code:n = { \@@_make_OT_feature:nnn {#3} {#4} {#5} } + #1/#2 .code:n = + { +%<debug> \typeout{::::::::fontspec-opentype~#1/#2~=~#3/#4/#5} + \@@_make_OT_feature:nnn {#3} {#4} {#5} + } } } % \end{macrocode} @@ -119,9 +123,9 @@ % \end{macrocode} % % \begin{macrocode} -\cs_new:Nn \@@_swap_plus_minus:n { \@@_swap_plus_minus_aux:NNNNN #1 } -\cs_new:Nn \@@_swap_plus_minus_aux:NNNNN - { \str_case:nn {#1} { {+} {-#2#3#4#5} {-} {+#2#3#4#5} } } +\cs_new:Nn \@@_swap_plus_minus:n { \@@_swap_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \@@_swap_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nn {#1} { {+} {-#2} {-} {+#2} } } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx index 44d9f52fd2c..ca1ac793c29 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-patches.dtx @@ -4,164 +4,6 @@ %<*fontspec> % \end{macrocode} % -% -% \subsection{Italic small caps and so on} \label{sec:sishape} -% -% \begin{macro}{\sishape} -% \begin{macro}{\textsi} -% These commands for actually selecting italic small caps have been defined for many years; I'm inclined to drop them. -% They're probably used very infrequently; I personally prefer just writing -% |\textit{\textsc{...}}| instead. -% -% \begin{macrocode} -\providecommand*\itscdefault{\itdefault\scdefault} -\providecommand*\slscdefault{\sldefault\scdefault} -\DeclareRobustCommand{\sishape} - { - \not@math@alphabet\sishape\relax - \fontshape{\itscdefault}\selectfont - } -\DeclareTextFontCommand{\textsi}{\sishape} -% \end{macrocode} -% \end{macro} \end{macro} -% -% \LaTeX's `shape' font axis needs to be overloaded to support italic small caps and slanted small caps. -% These are the combinations to support: -% \begin{macrocode} -\cs_new:Nn \@@_shape_merge:nn { c_@@_shape_#1_#2_tl } -\tl_const:cn { \@@_shape_merge:nn \itdefault \scdefault } {\itscdefault} -\tl_const:cn { \@@_shape_merge:nn \sldefault \scdefault } {\slscdefault} -\tl_const:cn { \@@_shape_merge:nn \scdefault \itdefault } {\itscdefault} -\tl_const:cn { \@@_shape_merge:nn \scdefault \sldefault } {\slscdefault} -\tl_const:cn { \@@_shape_merge:nn \slscdefault \itdefault } {\itscdefault} -\tl_const:cn { \@@_shape_merge:nn \itscdefault \sldefault } {\slscdefault} -\tl_const:cn { \@@_shape_merge:nn \itscdefault \updefault } {\scdefault} -\tl_const:cn { \@@_shape_merge:nn \slscdefault \updefault } {\scdefault} -% \end{macrocode} -% -% \begin{macro}{\fontspec_merge_shape:n} -% These macros enable the overload on the |\..shape| commands. -% First, a shape `new+current' (prefix) or `current+new' (suffix) is tried. -% If not found, fall back on the `new' shape. -% \begin{macrocode} -\cs_new:Nn \fontspec_merge_shape:n - { - \@@_if_merge_shape:nTF {#1} - { \fontshape { \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} } } \selectfont } - { \fontshape {#1} \selectfont } - } -% \end{macrocode} -% The following is rather specific; it only returns true if the merged shape exists, -% but more importantly also if the merged shape is defined for the current font. -% \begin{macrocode} -\prg_new_conditional:Nnn \@@_if_merge_shape:n {TF} - { - \bool_if:nTF - { - \tl_if_exist_p:c { \@@_shape_merge:nn {\f@shape} {#1} } && - \cs_if_exist_p:c - { - \f@encoding/\f@family/\f@series/ - \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} } - } - } - \prg_return_true: \prg_return_false: - } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\itshape} \begin{macro}{\scshape} \begin{macro}{\upshape} \begin{macro}{\slshape} -% The original |\..shape| commands are redefined to use the merge shape macro. -% \begin{macrocode} -\DeclareRobustCommand \itshape - { - \not@math@alphabet\itshape\mathit - \fontspec_merge_shape:n\itdefault - } -\DeclareRobustCommand \slshape - { - \not@math@alphabet\slshape\relax - \fontspec_merge_shape:n\sldefault - } -\DeclareRobustCommand \scshape - { - \not@math@alphabet\scshape\relax - \fontspec_merge_shape:n\scdefault - } -\DeclareRobustCommand \upshape - { - \not@math@alphabet\upshape\relax - \fontspec_merge_shape:n\updefault - } -% \end{macrocode} -% \end{macro} \end{macro} \end{macro} \end{macro} -% -% -% -% \subsection{Emphasis} -% -% \begin{macro}{\em} -% \begin{macro}{\emph} -% \begin{macro}{\emshape} -% \begin{macro}{\eminnershape} -% \begin{macro}{\emfontdeclare} -% Redefinition of |{\em ...}| and |\emph{...}| to allow nesting of emphases. -% -% \begin{macrocode} -\cs_new_protected:Npn \emfontdeclare #1 - { - \prop_clear:N \g_@@_em_prop - \int_zero:N \l_@@_emdef_int - \group_begin: - \normalfont - \clist_map_inline:nn {\emreset,#1} - { - ##1 - \prop_gput_if_new:NxV \g_@@_em_prop { \f@series/\f@shape } { \l_@@_emdef_int } - \prop_gput:Nxn \g_@@_em_prop { switch-\int_use:N \l_@@_emdef_int } { ##1 } - \int_incr:N \l_@@_emdef_int - } - \group_end: - } -% \end{macrocode} -% -% \begin{macrocode} -\DeclareRobustCommand \em - { - \@nomath\em - - \prop_get:NxNT \g_@@_em_prop { \f@series/\f@shape } \l_@@_em_tmp_tl - { \int_set:Nn \l_@@_em_int { \l_@@_em_tmp_tl } } - - \int_incr:N \l_@@_em_int - - \prop_get:NxNTF \g_@@_em_prop { switch-\int_use:N \l_@@_em_int } \l_@@_em_switch_tl - { \l_@@_em_switch_tl } - { - \int_zero:N \l_@@_em_int - \emreset - } - - } -% \end{macrocode} -% Document commands: -% \begin{macrocode} -\DeclareTextFontCommand{\emph}{\em} -\cs_set:Npn \emreset { \upshape } -\cs_set:Npn \emshape { \itshape } -\cs_set:Npn \eminnershape { \upshape } -\emfontdeclare{ \emshape, \eminnershape } -% \end{macrocode} -% Ensure nesting resets when necessary: -% \begin{macrocode} -\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int } -% \end{macrocode} -% Programmer's interface for setting nesting level: -% \begin{macrocode} -\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l_@@_em_int {#1} } -% \end{macrocode} -% \end{macro} \end{macro} \end{macro} \end{macro} \end{macro} -% % \subsection{\cmd\-} % % \begin{macro}{\-} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx index 7800ec00a7e..89fe42b971e 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-user.dtx @@ -337,10 +337,17 @@ { \keys_if_exist:nnF { fontspec / options } {#1} { \@@_define_opentype_feature_group:n {#1} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \@@_warning:nxx {feature-option-overwrite} {#1} {#2} } - \@@_define_opentype_feature:nnn {#1}{#2}{#3} + + \exp_args:Nnnx \@@_define_opentype_feature:nnnnn {#1}{#2}{ \@@_strip_plus_minus:n {#3} }{#3}{} } + +\cs_new:Nn \@@_strip_plus_minus:n { \@@_strip_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \@@_strip_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} } + % \end{macrocode} % \end{macro} % @@ -359,11 +366,8 @@ %<debug> \typeout{::::::::::::::::::::^^J:: aliasfontfeature{#1}{#2}} \bool_set_false:N \l_@@_alias_bool - \clist_map_inline:nn - { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-external, - fontspec-preparse-nested, fontspec-renderer } + \clist_map_inline:Nn \g_@@_all_keyval_modules_clist { - \keys_if_exist:nnT {##1} {#1} { %<debug> \typeout{:::: Key~exists~##1~/~#1} @@ -387,16 +391,17 @@ \clist_map_inline:Nn \g_@@_all_keyval_modules_clist { - - \keys_if_exist:nnT {##1} {#1} + \keys_if_exist:nnT { ##1 / #1 } {#2} { +%<debug> \typeout{:::: Keyval~exists~##1~/~#1~=~#2} \bool_set_true:N \l_@@_alias_bool - \keys_define:nn { ##1 / #1 } { #3 .meta:n = {#2} } + \keys_define:nn { ##1 / #1 } + { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } } } \bool_if:NF \l_@@_alias_bool - { \@@_warning:nx {rename-feature-not-exist} {#1} } + { \@@_warning:nx {rename-feature-not-exist} {#1/#2} } } % \end{macrocode} % \end{macro} @@ -437,7 +442,7 @@ % \end{macro} -% \begin{macro}{\IfFontFeaturesTF} +% \begin{macro}{\IfFontFeatureActiveTF} % \begin{macrocode} \DeclareDocumentCommand \IfFontFeatureActiveTF {mmm} { diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx index ea35f1d3608..eb2f0e0b39c 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-vars.dtx @@ -53,6 +53,7 @@ \bool_new:N \l_@@_never_check_bool \bool_new:N \l_@@_defining_encoding_bool \bool_new:N \l_@@_script_exist_bool +\bool_new:N \g_@@_em_normalise_slant_bool % \end{macrocode} % % \paragraph{Counters} @@ -63,6 +64,8 @@ \int_new:N \l_@@_tmp_int \int_new:N \l_@@_em_int \int_new:N \l_@@_emdef_int +\int_new:N \l_@@_strong_int +\int_new:N \l_@@_strongdef_int % \end{macrocode} % % \paragraph{Floating point} @@ -139,6 +142,7 @@ % \end{macrocode} % % \begin{macrocode} +\tl_new:N \l_@@_mapping_tl \tl_new:N \g_@@_hexcol_tl \tl_new:N \g_@@_opacity_tl \tl_set:Nn \g_@@_hexcol_tl {000000} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec-xfss.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec-xfss.dtx new file mode 100644 index 00000000000..e62bed49f9e --- /dev/null +++ b/Master/texmf-dist/source/latex/fontspec/fontspec-xfss.dtx @@ -0,0 +1,266 @@ +% \section{Changes to the NFSS} +% +% \begin{macrocode} +%<*fontspec> +% \end{macrocode} +% +% +% \subsection{Italic small caps and so on} \label{sec:sishape} +% +% \begin{macro}{\sishape} +% \begin{macro}{\textsi} +% These commands for actually selecting italic small caps have been defined for many years; I'm inclined to drop them. +% They're probably used very infrequently; I personally prefer just writing +% |\textit{\textsc{...}}| instead. +% +% \begin{macrocode} +\providecommand*\itscdefault{\itdefault\scdefault} +\providecommand*\slscdefault{\sldefault\scdefault} +\DeclareRobustCommand{\sishape} + { + \not@math@alphabet\sishape\relax + \fontshape{\itscdefault}\selectfont + } +\DeclareTextFontCommand{\textsi}{\sishape} +% \end{macrocode} +% \end{macro} \end{macro} +% +% \LaTeX's `shape' font axis needs to be overloaded to support italic small caps and slanted small caps. +% These are the combinations to support: +% \begin{macrocode} +\cs_new:Nn \@@_shape_merge:nn { c_@@_shape_#1_#2_tl } +\tl_const:cn { \@@_shape_merge:nn \itdefault \scdefault } {\itscdefault} +\tl_const:cn { \@@_shape_merge:nn \sldefault \scdefault } {\slscdefault} +\tl_const:cn { \@@_shape_merge:nn \scdefault \itdefault } {\itscdefault} +\tl_const:cn { \@@_shape_merge:nn \scdefault \sldefault } {\slscdefault} +\tl_const:cn { \@@_shape_merge:nn \slscdefault \itdefault } {\itscdefault} +\tl_const:cn { \@@_shape_merge:nn \itscdefault \sldefault } {\slscdefault} +\tl_const:cn { \@@_shape_merge:nn \itscdefault \updefault } {\scdefault} +\tl_const:cn { \@@_shape_merge:nn \slscdefault \updefault } {\scdefault} +% \end{macrocode} +% +% \begin{macro}{\fontspec_merge_shape:n} +% These macros enable the overload on the |\..shape| commands. +% First, a shape `new+current' (prefix) or `current+new' (suffix) is tried. +% If not found, fall back on the `new' shape. +% \begin{macrocode} +\cs_new:Nn \fontspec_merge_shape:n + { + \@@_if_merge_shape:nTF {#1} + { \fontshape { \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} } } \selectfont } + { \fontshape {#1} \selectfont } + } +% \end{macrocode} +% The following is rather specific; it only returns true if the merged shape exists, +% but more importantly also if the merged shape is defined for the current font. +% \begin{macrocode} +\prg_new_conditional:Nnn \@@_if_merge_shape:n {TF} + { + \bool_if:nTF + { + \tl_if_exist_p:c { \@@_shape_merge:nn {\f@shape} {#1} } && + \cs_if_exist_p:c + { + \f@encoding/\f@family/\f@series/ + \tl_use:c { \@@_shape_merge:nn {\f@shape} {#1} } + } + } + \prg_return_true: \prg_return_false: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\itshape} \begin{macro}{\scshape} \begin{macro}{\upshape} \begin{macro}{\slshape} +% The original |\..shape| commands are redefined to use the merge shape macro. +% \begin{macrocode} +\DeclareRobustCommand \itshape + { + \not@math@alphabet\itshape\mathit + \fontspec_merge_shape:n\itdefault + } +\DeclareRobustCommand \slshape + { + \not@math@alphabet\slshape\relax + \fontspec_merge_shape:n\sldefault + } +\DeclareRobustCommand \scshape + { + \not@math@alphabet\scshape\relax + \fontspec_merge_shape:n\scdefault + } +\DeclareRobustCommand \upshape + { + \not@math@alphabet\upshape\relax + \fontspec_merge_shape:n\updefault + } +% \end{macrocode} +% \end{macro} \end{macro} \end{macro} \end{macro} +% +% +% +% \subsection{Emphasis} +% +% \begin{macro}{\emfontdeclare} +% \begin{macrocode} +\cs_new_protected:Npn \emfontdeclare #1 + { + \prop_clear:N \g_@@_em_prop + \int_zero:N \l_@@_emdef_int + \bool_set_true:N \g_@@_em_normalise_slant_bool + + \tl_if_in:nnT {#1} {\slshape} + { + \tl_if_in:nnT {#1} {\itshape} + { + \bool_set_false:N \g_@@_em_normalise_slant_bool + } + } + + \group_begin: + \normalfont + \clist_map_inline:nn {\emreset,#1} + { + ##1 + \prop_gput_if_new:NxV \g_@@_em_prop { \f@shape } { \l_@@_emdef_int } + \prop_gput:Nxn \g_@@_em_prop { switch-\int_use:N \l_@@_emdef_int } { ##1 } + \int_incr:N \l_@@_emdef_int + } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\em} +% \begin{macrocode} +\DeclareRobustCommand \em + { + \@nomath\em + \tl_set:Nx \l_@@_emshape_query_tl { \f@shape } + + \bool_if:NT \g_@@_em_normalise_slant_bool + { + \tl_replace_all:Nnn \l_@@_emshape_query_tl {/sl} {/it} + } + +%<debug> \typeout{Emph~ level:~\int_use:N \l_@@_em_int} + \prop_get:NxNT \g_@@_em_prop { \l_@@_emshape_query_tl } \l_@@_em_tmp_tl + { + \int_set:Nn \l_@@_em_int { \l_@@_em_tmp_tl } +%<debug> \typeout{Shape~ (\l_@@_emshape_query_tl)~ detected;~ new~ level:~\int_use:N \l_@@_em_int} + } + + \int_incr:N \l_@@_em_int + + \prop_get:NxNTF \g_@@_em_prop { switch-\int_use:N \l_@@_em_int } \l_@@_em_switch_tl + { \l_@@_em_switch_tl } + { + \int_zero:N \l_@@_em_int + \emreset + } + + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\emph} +% \begin{macro}{\emshape} +% \begin{macro}{\eminnershape} +% \begin{macro}{\emreset} +% \begin{macrocode} +\DeclareTextFontCommand{\emph}{\em} +\cs_set:Npn \emreset { \upshape } +\cs_set:Npn \emshape { \itshape } +\cs_set:Npn \eminnershape { \upshape } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% +% +% +% \subsection{Strong emphasis} +% +% \begin{macro}{\strongfontdeclare} +% \begin{macrocode} +\cs_new_protected:Npn \strongfontdeclare #1 + { + \prop_clear:N \g_@@_strong_prop + \int_zero:N \l_@@_strongdef_int + + \group_begin: + \normalfont + \clist_map_inline:nn {\strongreset,#1} + { + ##1 + \prop_gput_if_new:NxV \g_@@_strong_prop { \f@series } { \l_@@_strongdef_int } + \prop_gput:Nxn \g_@@_strong_prop { switch-\int_use:N \l_@@_strongdef_int } { ##1 } + \int_incr:N \l_@@_strongdef_int + } + \group_end: + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\strongenv} +% \begin{macrocode} +\DeclareRobustCommand \strongenv + { + \@nomath\strongenv + +%<debug> \typeout{Strong~ level:~\int_use:N \l_@@_strong_int} + \prop_get:NxNT \g_@@_strong_prop { \f@series } \l_@@_strong_tmp_tl + { + \int_set:Nn \l_@@_strong_int { \l_@@_strong_tmp_tl } +%<debug> \typeout{Series~ (\f@series)~ detected;~ new~ level:~\int_use:N \l_@@_strong_int} + } + + \int_incr:N \l_@@_strong_int + + \prop_get:NxNTF \g_@@_strong_prop { switch-\int_use:N \l_@@_strong_int } \l_@@_strong_switch_tl + { \l_@@_strong_switch_tl } + { + \int_zero:N \l_@@_strong_int + \strongreset + } + + } +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\strong} +% \begin{macro}{\strongreset} +% \begin{macrocode} +\DeclareTextFontCommand{\strong}{\strongenv} +\cs_set:Npn \strongreset {} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\reset@font} +% Ensure nesting resets when necessary: +% \begin{macrocode} +\cs_set:Npn \reset@font + { + \normalfont + \int_zero:N \l_@@_em_int + \int_zero:N \l_@@_strong_int + } +% \end{macrocode} +% \end{macro} +% +% Programmer's interface for setting nesting levels: +% \begin{macrocode} +\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l_@@_em_int {#1} } +\cs_new:Nn \fontspec_set_strong_level:n { \int_set:Nn \l_@@_strong_int {#1} } +% \end{macrocode} +% +% Defaults: +% \begin{macrocode} +\strongfontdeclare{ \bfseries } +\emfontdeclare{ \emshape, \eminnershape } +% \end{macrocode} +% +% \begin{macrocode} +%</fontspec> +% \end{macrocode} diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index ad626585c1a..504b41c337a 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -14,7 +14,7 @@ License information appended. \endpreamble \postamble ------------------------------------------------ -Copyright 2004--2017 Will Robertson <wspr81@gmail.com> +Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org> Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> Distributable under the LaTeX Project Public License, version 1.3c or higher. @@ -27,7 +27,7 @@ And the derived files: fontspec*.sty,fontspec.lua, fontspec.pdf. \endpostamble \askforoverwritefalse \def\MetaPrefix{-- } -\generate{\file{fontspec.lua}{\from{fontspec-lua.dtx}{lua}}} +\generate{\file{fontspec.lua}{\from{fontspec.dtx}{lua}\from{fontspec-lua.dtx}{lua}}} \let\MetaPrefix\DoubleperCent \ifx\FontspecDebug\undefined\def\FSDEBUG{}\else\def\FSDEBUG{,debug}\fi @@ -54,6 +54,7 @@ And the derived files: fontspec*.sty,fontspec.lua, fontspec.pdf. \DTX{fontspec-enc.dtx} \DTX{fontspec-math.dtx} \DTX{fontspec-closing.dtx} + \DTX{fontspec-xfss.dtx} \DTX{fontspec-patches.dtx} } @@ -78,8 +79,19 @@ And the derived files: fontspec*.sty,fontspec.lua, fontspec.pdf. %<fontspec&xetexx>\ProvidesExplPackage{fontspec-xetex}% %<fontspec&luatex>\ProvidesExplPackage{fontspec-luatex}% %<*fontspec> - {2017/01/24}{2.5d}{Font selection for XeLaTeX and LuaLaTeX} + {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX} %</fontspec> +%<lua>fontspec = fontspec or {} +%<lua>local fontspec = fontspec +%<lua>fontspec.module = { +%<lua> name = "fontspec", +%<lua> version = "2.6", +%<lua> date = "2017/02/12", +%<lua> description = "Font selection for XeLaTeX and LuaLaTeX", +%<lua> author = "Khaled Hosny, Philipp Gesang, Will Robertson", +%<lua> copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", +%<lua> license = "LPPL" +%<lua>} % %<*driver> \ExplSyntaxOff diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty index bec92bbe616..19f343fc5f4 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty @@ -22,6 +22,7 @@ %% fontspec-enc.dtx (with options: `fontspec,luatex') %% fontspec-math.dtx (with options: `fontspec,luatex') %% fontspec-closing.dtx (with options: `fontspec,luatex') +%% fontspec-xfss.dtx (with options: `fontspec,luatex') %% fontspec-patches.dtx (with options: `fontspec,luatex') %% ------------------------------------------------ %% The FONTSPEC package for XeLaTeX/LuaLaTeX @@ -31,7 +32,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} \ProvidesExplPackage{fontspec-luatex}% - {2017/01/24}{2.5d}{Font selection for XeLaTeX and LuaLaTeX} + {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX} \bool_new:N \l__fontspec_firsttime_bool \bool_new:N \l__fontspec_nobf_bool \bool_new:N \l__fontspec_noit_bool @@ -56,12 +57,15 @@ \bool_new:N \l__fontspec_never_check_bool \bool_new:N \l__fontspec_defining_encoding_bool \bool_new:N \l__fontspec_script_exist_bool +\bool_new:N \g__fontspec_em_normalise_slant_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int \int_new:N \l__fontspec_tmp_int \int_new:N \l__fontspec_em_int \int_new:N \l__fontspec_emdef_int +\int_new:N \l__fontspec_strong_int +\int_new:N \l__fontspec_strongdef_int \fp_new:N \l__fontspec_tmpa_fp \fp_new:N \l__fontspec_tmpb_fp \dim_new:N \l__fontspec_tmpa_dim @@ -102,6 +106,7 @@ \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl \tl_new:N \l_fontspec_lang_tl +\tl_new:N \l__fontspec_mapping_tl \tl_new:N \g__fontspec_hexcol_tl \tl_new:N \g__fontspec_opacity_tl \tl_set:Nn \g__fontspec_hexcol_tl {000000} @@ -642,20 +647,24 @@ { \keys_if_exist:nnF { fontspec / options } {#1} { \__fontspec_define_opentype_feature_group:n {#1} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \__fontspec_define_opentype_feature:nnn {#1}{#2}{#3} + + \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn {#1}{#2}{ \__fontspec_strip_plus_minus:n {#3} }{#3}{} } + +\cs_new:Nn \__fontspec_strip_plus_minus:n { \__fontspec_strip_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \__fontspec_strip_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} } + \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \bool_set_false:N \l__fontspec_alias_bool - \clist_map_inline:nn - { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-external, - fontspec-preparse-nested, fontspec-renderer } + \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - \keys_if_exist:nnT {##1} {#1} { \bool_set_true:N \l__fontspec_alias_bool @@ -673,16 +682,16 @@ \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - - \keys_if_exist:nnT {##1} {#1} + \keys_if_exist:nnT { ##1 / #1 } {#2} { \bool_set_true:N \l__fontspec_alias_bool - \keys_define:nn { ##1 / #1 } { #3 .meta:n = {#2} } + \keys_define:nn { ##1 / #1 } + { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } } } \bool_if:NF \l__fontspec_alias_bool - { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } + { \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} } } \DeclareDocumentCommand \newfontscript {mm} { @@ -1069,7 +1078,8 @@ } \cs_set:Nn \__fontspec_construct_font_call:nnnnnn { - " \__fontspec_fontname_wrap:n { #1 #2 #3 } #4 #5 + " \__fontspec_fontname_wrap:n { #1 #2 } #3 + #4 #5 \str_if_eq_x:nnF {#6}{} {:#6} " } \cs_set:Nn \__fontspec_construct_font_call:nn @@ -1088,7 +1098,7 @@ } \cs_new:Nn \__fontspec_font_is_file: { - \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { file:\l__fontspec_font_path_tl ##1 } + \cs_set:Npn \__fontspec_fontname_wrap:n ##1 { [ \l__fontspec_font_path_tl ##1 ] } } \cs_new:Nn \__fontspec_set_scriptlang: { @@ -1126,7 +1136,10 @@ \__fontspec_keys_set_known:nxN {fontspec-renderer} {\l__fontspec_fontfeat_clist,#2} \l__fontspec_keys_leftover_clist \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist - \keys_set:nx {fontspec-opentype} {\l__fontspec_keys_leftover_clist} + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } \str_if_eq_x:nnF { \l__fontspec_hexcol_tl \l__fontspec_opacity_tl } { \g__fontspec_hexcol_tl \g__fontspec_opacity_tl } @@ -1515,7 +1528,10 @@ \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2} \keys_define:nn {fontspec-opentype} { - #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} } + #1/#2 .code:n = + { + \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} + } } } \cs_new:Nn \__fontspec_feat_off:n {#1Off} @@ -1556,9 +1572,9 @@ } } \cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx} -\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:NNNNN #1 } -\cs_new:Nn \__fontspec_swap_plus_minus_aux:NNNNN - { \str_case:nn {#1} { {+} {-#2#3#4#5} {-} {+#2#3#4#5} } } +\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \__fontspec_swap_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nn {#1} { {+} {-#2} {-} {+#2} } } \prg_new_conditional:Nnn \__fontspec_check_script:n {TF} { \bool_if:NTF \l__fontspec_never_check_bool @@ -2121,7 +2137,7 @@ \int_to_hex:n { \l__fontspec_tmp_int } } } -\__fontspec_keys_define_code:nnn {fontspec} {Mapping} +\__fontspec_keys_define_code:nnn {fontspec-opentype} {Mapping} { \str_if_eq:nnTF {#1} {tex-text} { @@ -2207,7 +2223,11 @@ }, AutoFakeBold .default:n = {1.5} } -\__fontspec_keys_define_code:nnn {fontspec} {RawFeature} +\__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature} + { + \__fontspec_update_featstr:n {#1} + } +\__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature} { \__fontspec_update_featstr:n {#1} } @@ -2258,8 +2278,9 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Lowercase} {onum} {onum} {+lnum,-lnum} \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Uppercase} {lnum} {lnum} {+onum,-onum} \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {SlashedZero} {zero} {zero} {} -\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} -\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} +\aliasfontfeatureoption {Numbers} {Monospaced} {Tabular} +\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} +\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Arabic} {anum} {anum} {} \__fontspec_define_opentype_feature_group:n {VerticalPosition} \__fontspec_define_opentype_feature:nnnnn {VerticalPosition} {ResetAll} {} {} @@ -3308,14 +3329,24 @@ } \cs_new_protected:Npn \emfontdeclare #1 { - \prop_clear:N \g__fontspec_em_prop - \int_zero:N \l__fontspec_emdef_int + \prop_clear:N \g__fontspec_em_prop + \int_zero:N \l__fontspec_emdef_int + \bool_set_true:N \g__fontspec_em_normalise_slant_bool + + \tl_if_in:nnT {#1} {\slshape} + { + \tl_if_in:nnT {#1} {\itshape} + { + \bool_set_false:N \g__fontspec_em_normalise_slant_bool + } + } + \group_begin: \normalfont \clist_map_inline:nn {\emreset,#1} { ##1 - \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@series/\f@shape } { \l__fontspec_emdef_int } + \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@shape } { \l__fontspec_emdef_int } \prop_gput:Nxn \g__fontspec_em_prop { switch-\int_use:N \l__fontspec_emdef_int } { ##1 } \int_incr:N \l__fontspec_emdef_int } @@ -3324,9 +3355,17 @@ \DeclareRobustCommand \em { \@nomath\em + \tl_set:Nx \l__fontspec_emshape_query_tl { \f@shape } - \prop_get:NxNT \g__fontspec_em_prop { \f@series/\f@shape } \l__fontspec_em_tmp_tl - { \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } } + \bool_if:NT \g__fontspec_em_normalise_slant_bool + { + \tl_replace_all:Nnn \l__fontspec_emshape_query_tl {/sl} {/it} + } + + \prop_get:NxNT \g__fontspec_em_prop { \l__fontspec_emshape_query_tl } \l__fontspec_em_tmp_tl + { + \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } + } \int_incr:N \l__fontspec_em_int @@ -3342,9 +3381,53 @@ \cs_set:Npn \emreset { \upshape } \cs_set:Npn \emshape { \itshape } \cs_set:Npn \eminnershape { \upshape } +\cs_new_protected:Npn \strongfontdeclare #1 + { + \prop_clear:N \g__fontspec_strong_prop + \int_zero:N \l__fontspec_strongdef_int + + \group_begin: + \normalfont + \clist_map_inline:nn {\strongreset,#1} + { + ##1 + \prop_gput_if_new:NxV \g__fontspec_strong_prop { \f@series } { \l__fontspec_strongdef_int } + \prop_gput:Nxn \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strongdef_int } { ##1 } + \int_incr:N \l__fontspec_strongdef_int + } + \group_end: + } +\DeclareRobustCommand \strongenv + { + \@nomath\strongenv + + \prop_get:NxNT \g__fontspec_strong_prop { \f@series } \l__fontspec_strong_tmp_tl + { + \int_set:Nn \l__fontspec_strong_int { \l__fontspec_strong_tmp_tl } + } + + \int_incr:N \l__fontspec_strong_int + + \prop_get:NxNTF \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strong_int } \l__fontspec_strong_switch_tl + { \l__fontspec_strong_switch_tl } + { + \int_zero:N \l__fontspec_strong_int + \strongreset + } + + } +\DeclareTextFontCommand{\strong}{\strongenv} +\cs_set:Npn \strongreset {} +\cs_set:Npn \reset@font + { + \normalfont + \int_zero:N \l__fontspec_em_int + \int_zero:N \l__fontspec_strong_int + } +\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} } +\cs_new:Nn \fontspec_set_strong_level:n { \int_set:Nn \l__fontspec_strong_int {#1} } +\strongfontdeclare{ \bfseries } \emfontdeclare{ \emshape, \eminnershape } -\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int } -\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} } \DeclareRobustCommand{\-} { \discretionary @@ -3446,7 +3529,7 @@ { \addfontfeature{Numbers=Lining} #1 } } %% ------------------------------------------------ -%% Copyright 2004--2017 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, version 1.3c or higher. diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty index e5f6bb5454e..5162253dd0b 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty @@ -22,6 +22,7 @@ %% fontspec-enc.dtx (with options: `fontspec,xetexx') %% fontspec-math.dtx (with options: `fontspec,xetexx') %% fontspec-closing.dtx (with options: `fontspec,xetexx') +%% fontspec-xfss.dtx (with options: `fontspec,xetexx') %% fontspec-patches.dtx (with options: `fontspec,xetexx') %% ------------------------------------------------ %% The FONTSPEC package for XeLaTeX/LuaLaTeX @@ -31,7 +32,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} \ProvidesExplPackage{fontspec-xetex}% - {2017/01/24}{2.5d}{Font selection for XeLaTeX and LuaLaTeX} + {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX} \bool_new:N \l__fontspec_firsttime_bool \bool_new:N \l__fontspec_nobf_bool \bool_new:N \l__fontspec_noit_bool @@ -56,12 +57,15 @@ \bool_new:N \l__fontspec_never_check_bool \bool_new:N \l__fontspec_defining_encoding_bool \bool_new:N \l__fontspec_script_exist_bool +\bool_new:N \g__fontspec_em_normalise_slant_bool \int_new:N \l__fontspec_script_int \int_new:N \l__fontspec_language_int \int_new:N \l__fontspec_strnum_int \int_new:N \l__fontspec_tmp_int \int_new:N \l__fontspec_em_int \int_new:N \l__fontspec_emdef_int +\int_new:N \l__fontspec_strong_int +\int_new:N \l__fontspec_strongdef_int \fp_new:N \l__fontspec_tmpa_fp \fp_new:N \l__fontspec_tmpb_fp \dim_new:N \l__fontspec_tmpa_dim @@ -102,6 +106,7 @@ \tl_new:N \l_fontspec_script_tl \tl_new:N \l__fontspec_lang_name_tl \tl_new:N \l_fontspec_lang_tl +\tl_new:N \l__fontspec_mapping_tl \tl_new:N \g__fontspec_hexcol_tl \tl_new:N \g__fontspec_opacity_tl \tl_set:Nn \g__fontspec_hexcol_tl {000000} @@ -639,20 +644,24 @@ { \keys_if_exist:nnF { fontspec / options } {#1} { \__fontspec_define_opentype_feature_group:n {#1} } + \keys_if_choice_exist:nnnT {fontspec} {#1} {#2} { \__fontspec_warning:nxx {feature-option-overwrite} {#1} {#2} } - \__fontspec_define_opentype_feature:nnn {#1}{#2}{#3} + + \exp_args:Nnnx \__fontspec_define_opentype_feature:nnnnn {#1}{#2}{ \__fontspec_strip_plus_minus:n {#3} }{#3}{} } + +\cs_new:Nn \__fontspec_strip_plus_minus:n { \__fontspec_strip_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \__fontspec_strip_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nnF {#1} { {+} {#2} {-} {#2} } {#1#2} } + \cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated \DeclareDocumentCommand \aliasfontfeature {mm} { \bool_set_false:N \l__fontspec_alias_bool - \clist_map_inline:nn - { fontspec, fontspec-opentype, fontspec-aat, fontspec-preparse, fontspec-preparse-external, - fontspec-preparse-nested, fontspec-renderer } + \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - \keys_if_exist:nnT {##1} {#1} { \bool_set_true:N \l__fontspec_alias_bool @@ -670,16 +679,16 @@ \clist_map_inline:Nn \g__fontspec_all_keyval_modules_clist { - - \keys_if_exist:nnT {##1} {#1} + \keys_if_exist:nnT { ##1 / #1 } {#2} { \bool_set_true:N \l__fontspec_alias_bool - \keys_define:nn { ##1 / #1 } { #3 .meta:n = {#2} } + \keys_define:nn { ##1 / #1 } + { #3 .code:n = { \keys_set:nn {##1} { #1 = {#2} } } } } } \bool_if:NF \l__fontspec_alias_bool - { \__fontspec_warning:nx {rename-feature-not-exist} {#1} } + { \__fontspec_warning:nx {rename-feature-not-exist} {#1/#2} } } \DeclareDocumentCommand \newfontscript {mm} { @@ -1065,7 +1074,8 @@ } \cs_set:Nn \__fontspec_construct_font_call:nnnnnn { - " \__fontspec_fontname_wrap:n { #1 #2 #3 } #4 #5 + " \__fontspec_fontname_wrap:n { #1 #2 #3 } + #4 #5 \str_if_eq_x:nnF {#6}{} {:#6} " } \cs_set:Nn \__fontspec_construct_font_call:nn @@ -1124,13 +1134,18 @@ \__fontspec_keys_set_known:nxN {fontspec} {\l__fontspec_keys_leftover_clist} \l__fontspec_keys_leftover_clist \bool_if:NTF \l__fontspec_ot_bool { - \keys_set:nx {fontspec-opentype} {\l__fontspec_keys_leftover_clist} + % \tracingall + \keys_set:nV {fontspec-opentype} \l__fontspec_keys_leftover_clist + % \EROROR } { \bool_if:NT \l__fontspec_atsui_bool - { \keys_set:nx {fontspec-aat} {\l__fontspec_keys_leftover_clist} } + { \keys_set:nV {fontspec-aat} \l__fontspec_keys_leftover_clist } } + \tl_if_empty:NF \l__fontspec_mapping_tl + { \__fontspec_update_featstr:n { mapping = \l__fontspec_mapping_tl } } + \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 } } @@ -1546,7 +1561,10 @@ \__fontspec_feat_prop_add:nn {#3} {#1\,=\,#2} \keys_define:nn {fontspec-opentype} { - #1/#2 .code:n = { \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} } + #1/#2 .code:n = + { + \__fontspec_make_OT_feature:nnn {#3} {#4} {#5} + } } } \cs_new:Nn \__fontspec_feat_off:n {#1Off} @@ -1587,9 +1605,9 @@ } } \cs_generate_variant:Nn \__fontspec_make_OT_feature:nnn {xxx} -\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:NNNNN #1 } -\cs_new:Nn \__fontspec_swap_plus_minus_aux:NNNNN - { \str_case:nn {#1} { {+} {-#2#3#4#5} {-} {+#2#3#4#5} } } +\cs_new:Nn \__fontspec_swap_plus_minus:n { \__fontspec_swap_plus_minus_aux:Nq #1 \q_nil } +\cs_new:Npn \__fontspec_swap_plus_minus_aux:Nq #1#2 \q_nil + { \str_case:nn {#1} { {+} {-#2} {-} {+#2} } } \prg_new_conditional:Nnn \__fontspec_check_script:n {TF} { \bool_if:NTF \l__fontspec_never_check_bool @@ -2240,10 +2258,14 @@ \int_to_hex:n { \l__fontspec_tmp_int } } } -\__fontspec_keys_define_code:nnn {fontspec} {Mapping} - { - \__fontspec_update_featstr:n { mapping = #1 } - } +\__fontspec_keys_define_code:nnn {fontspec-aat} {Mapping} + { + \tl_set:Nn \l__fontspec_mapping_tl { #1 } + } +\__fontspec_keys_define_code:nnn {fontspec-opentype} {Mapping} + { + \tl_set:Nn \l__fontspec_mapping_tl { #1 } + } \__fontspec_keys_define_code:nnn {fontspec} {Weight} { \__fontspec_update_featstr:n{weight=#1} @@ -2338,7 +2360,11 @@ }, AutoFakeBold .default:n = {1.5} } -\__fontspec_keys_define_code:nnn {fontspec} {RawFeature} +\__fontspec_keys_define_code:nnn {fontspec-opentype} {RawFeature} + { + \__fontspec_update_featstr:n {#1} + } +\__fontspec_keys_define_code:nnn {fontspec-aat} {RawFeature} { \__fontspec_update_featstr:n {#1} } @@ -2360,7 +2386,11 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Discretionary} {dlig} {dlig} {} \__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Contextual} {clig} {clig} {} \__fontspec_define_opentype_onoffreset:nnnnn {Ligatures} {Historic} {hlig} {hlig} {} -\__fontspec_define_opentype_onreset:nnnnn {Ligatures} {TeX} {} { mapping = tex-text } {} +\keys_define:nn {fontspec-opentype} + { + Ligatures / TeX .code:n = { \tl_set:Nn \l__fontspec_mapping_tl {tex-text} }, + Ligatures / TeXReset .code:n = { \tl_clear:N \l__fontspec_mapping_tl }, + } \__fontspec_define_opentype_feature_group:n {Letters} \__fontspec_define_opentype_feature:nnnnn {Letters} {ResetAll} {} {} { @@ -2389,8 +2419,9 @@ \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Lowercase} {onum} {onum} {+lnum,-lnum} \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {Uppercase} {lnum} {lnum} {+onum,-onum} \__fontspec_define_opentype_onoffreset:nnnnn {Numbers} {SlashedZero} {zero} {zero} {} -\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} -\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} +\aliasfontfeatureoption {Numbers} {Monospaced} {Tabular} +\aliasfontfeatureoption {Numbers} {Lowercase} {OldStyle} +\aliasfontfeatureoption {Numbers} {Uppercase} {Lining} \__fontspec_define_opentype_feature_group:n {VerticalPosition} \__fontspec_define_opentype_feature:nnnnn {VerticalPosition} {ResetAll} {} {} { @@ -3179,7 +3210,7 @@ { Ligatures / TeX .code:n = { - \__fontspec_update_featstr:n { mapping = tex-text } + \tl_set:Nn \l__fontspec_mapping_tl { tex-text } } } \__fontspec_define_aat_feature_group:n {Letters} @@ -3574,14 +3605,24 @@ } \cs_new_protected:Npn \emfontdeclare #1 { - \prop_clear:N \g__fontspec_em_prop - \int_zero:N \l__fontspec_emdef_int + \prop_clear:N \g__fontspec_em_prop + \int_zero:N \l__fontspec_emdef_int + \bool_set_true:N \g__fontspec_em_normalise_slant_bool + + \tl_if_in:nnT {#1} {\slshape} + { + \tl_if_in:nnT {#1} {\itshape} + { + \bool_set_false:N \g__fontspec_em_normalise_slant_bool + } + } + \group_begin: \normalfont \clist_map_inline:nn {\emreset,#1} { ##1 - \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@series/\f@shape } { \l__fontspec_emdef_int } + \prop_gput_if_new:NxV \g__fontspec_em_prop { \f@shape } { \l__fontspec_emdef_int } \prop_gput:Nxn \g__fontspec_em_prop { switch-\int_use:N \l__fontspec_emdef_int } { ##1 } \int_incr:N \l__fontspec_emdef_int } @@ -3590,9 +3631,17 @@ \DeclareRobustCommand \em { \@nomath\em + \tl_set:Nx \l__fontspec_emshape_query_tl { \f@shape } - \prop_get:NxNT \g__fontspec_em_prop { \f@series/\f@shape } \l__fontspec_em_tmp_tl - { \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } } + \bool_if:NT \g__fontspec_em_normalise_slant_bool + { + \tl_replace_all:Nnn \l__fontspec_emshape_query_tl {/sl} {/it} + } + + \prop_get:NxNT \g__fontspec_em_prop { \l__fontspec_emshape_query_tl } \l__fontspec_em_tmp_tl + { + \int_set:Nn \l__fontspec_em_int { \l__fontspec_em_tmp_tl } + } \int_incr:N \l__fontspec_em_int @@ -3608,9 +3657,53 @@ \cs_set:Npn \emreset { \upshape } \cs_set:Npn \emshape { \itshape } \cs_set:Npn \eminnershape { \upshape } +\cs_new_protected:Npn \strongfontdeclare #1 + { + \prop_clear:N \g__fontspec_strong_prop + \int_zero:N \l__fontspec_strongdef_int + + \group_begin: + \normalfont + \clist_map_inline:nn {\strongreset,#1} + { + ##1 + \prop_gput_if_new:NxV \g__fontspec_strong_prop { \f@series } { \l__fontspec_strongdef_int } + \prop_gput:Nxn \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strongdef_int } { ##1 } + \int_incr:N \l__fontspec_strongdef_int + } + \group_end: + } +\DeclareRobustCommand \strongenv + { + \@nomath\strongenv + + \prop_get:NxNT \g__fontspec_strong_prop { \f@series } \l__fontspec_strong_tmp_tl + { + \int_set:Nn \l__fontspec_strong_int { \l__fontspec_strong_tmp_tl } + } + + \int_incr:N \l__fontspec_strong_int + + \prop_get:NxNTF \g__fontspec_strong_prop { switch-\int_use:N \l__fontspec_strong_int } \l__fontspec_strong_switch_tl + { \l__fontspec_strong_switch_tl } + { + \int_zero:N \l__fontspec_strong_int + \strongreset + } + + } +\DeclareTextFontCommand{\strong}{\strongenv} +\cs_set:Npn \strongreset {} +\cs_set:Npn \reset@font + { + \normalfont + \int_zero:N \l__fontspec_em_int + \int_zero:N \l__fontspec_strong_int + } +\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} } +\cs_new:Nn \fontspec_set_strong_level:n { \int_set:Nn \l__fontspec_strong_int {#1} } +\strongfontdeclare{ \bfseries } \emfontdeclare{ \emshape, \eminnershape } -\cs_set:Npn \reset@font { \normalfont \int_zero:N \l__fontspec_em_int } -\cs_new:Nn \fontspec_set_em_level:n { \int_set:Nn \l__fontspec_em_int {#1} } \DeclareRobustCommand{\-} { \discretionary @@ -3712,7 +3805,7 @@ { \addfontfeature{Numbers=Lining} #1 } } %% ------------------------------------------------ -%% Copyright 2004--2017 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, version 1.3c or higher. diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index 9ab8febf070..771b29a7deb 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -4,6 +4,7 @@ -- -- The original source files were: -- +-- fontspec.dtx (with options: `lua') -- fontspec-lua.dtx (with options: `lua') -- ------------------------------------------------ -- The FONTSPEC package for XeLaTeX/LuaLaTeX @@ -14,14 +15,13 @@ fontspec = fontspec or {} local fontspec = fontspec fontspec.module = { name = "fontspec", - version = "2.5a", - date = "2016/02/01", - description = "Advanced font selection for LuaLaTeX.", + version = "2.6", + date = "2017/02/12", + description = "Font selection for XeLaTeX and LuaLaTeX", author = "Khaled Hosny, Philipp Gesang, Will Robertson", copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", license = "LPPL" } - local err, warn, info, log = luatexbase.provides_module(fontspec.module) fontspec.log = log or (function (s) luatexbase.module_info("fontspec", s) end) fontspec.warning = warn or (function (s) luatexbase.module_warning("fontspec", s) end) @@ -71,7 +71,7 @@ function fontspec.mathfontdimen(fnt, str) end end -- ------------------------------------------------ --- Copyright 2004--2017 Will Robertson <wspr81@gmail.com> +-- Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org> -- Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> -- -- Distributable under the LaTeX Project Public License, version 1.3c or higher. diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index 008b2b83f8b..7d29a5e6623 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty @@ -13,7 +13,7 @@ \RequirePackage{expl3} \RequirePackage{xparse} \ProvidesExplPackage{fontspec}% - {2017/01/24}{2.5d}{Font selection for XeLaTeX and LuaLaTeX} + {2017/02/12}{2.6}{Font selection for XeLaTeX and LuaLaTeX} \sys_if_engine_luatex:T { \RequirePackage{luaotfload} \directlua{require("fontspec")} @@ -27,7 +27,7 @@ } \msg_fatal:nn {fontspec} {cannot-use-pdftex} %% ------------------------------------------------ -%% Copyright 2004--2017 Will Robertson <wspr81@gmail.com> +%% Copyright 2004--2017 Will Robertson <will.robertson@latex-project.org> %% Copyright 2009--2013 Khaled Hosny <khaledhosny@eglug.org> %% %% Distributable under the LaTeX Project Public License, version 1.3c or higher. |