summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-03-14 22:59:51 +0000
committerKarl Berry <karl@freefriends.org>2015-03-14 22:59:51 +0000
commitc493011f1ad4ff5cd2973ed6a6a3d4c9fec6470f (patch)
tree8031fe6db1684b5d12e9ae321631fda0a7b8534c
parent9c90dced35ede94c9693dfc8cdf67cbd4537caf1 (diff)
fontspec (14mar15)
git-svn-id: svn://tug.org/texlive/trunk@36512 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/README21
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec.pdfbin1028734 -> 1004512 bytes
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec.dtx293
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty177
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty41
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty177
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.sty2
7 files changed, 428 insertions, 283 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README
index 6792af2d9ef..f934a6ea66b 100644
--- a/Master/texmf-dist/doc/latex/fontspec/README
+++ b/Master/texmf-dist/doc/latex/fontspec/README
@@ -53,7 +53,9 @@ Default document fonts are selected with
Features to be used for every subsequently defined font are specified with
\defaultfontfeatures{<default font options>}
+ \defaultfontfeatures+{<add to default font options>}
\defaultfontfeatures[<font name>]{<default font options for "font name">}
+ \defaultfontfeatures+[<font name>]{<add to default font options for "font name">}
Features may be added to the font currently in use with
@@ -65,6 +67,23 @@ Features may be added to the font currently in use with
Change history
--------------
+- v2.4c (2015/03/14)
+
+ * v2.4b was never released, sorry!
+ * This time *really* fix \@fnsymbol and avoid overwriting it if already fixed.
+ * Fix "Renderer=Graphite" (off-by-one error).
+ * Fix some edge cases for \aliasfontfeature.
+
+- v2.4b (2014/08/23)
+
+ * Improve backwards compatibility w.r.t. recent argument order change;
+ specifically, if an optional argument is presented before the font name
+ then avoid looking for one afterwards.
+ * Fix \@fnsymbol; it was defined as a \protected macro, where in fact its internal text-or-math switch needed to be instead.
+ * No longer lowercase fontnames internally; this fixes a bug with loading
+ mixed-case ".fontspec" files.
+ * Fixed some documentation typos/inconsistencies related to recent changes.
+
- v2.4a (2014/06/21)
* No longer load fixltx2e.sty -- this package should really be loaded before \documentclass.
@@ -85,7 +104,7 @@ Change history
or
\defaultfontfeatures[\headingsfont]{...}
- \setfontfamily\headingsfont{...}
+ \newfontfamily\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.
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
index b4f271d9f8a..f1ecf195f91 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
Binary files differ
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
index 11582be7e05..3683519f769 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
@@ -93,7 +93,7 @@ This work consists of this file fontspec.dtx
%<fontspec&luatex>\ProvidesPackage{fontspec-luatex}
%<patches>\ProvidesPackage{fontspec-patches}
%<*fontspec|patches>
- [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]
+ [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX]
%</fontspec|patches>
%
%<*driver>
@@ -762,7 +762,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}.
+% This functionality is provided with the same interface as the \pkg{fixltx2e} package, with a slightly different internal implementation.
%
%
%
@@ -841,11 +841,12 @@ This work consists of this file fontspec.dtx
% called \texttt{TeXGyreAdventor.fontspec}, or for specifying options for
% \texttt{texgyreadventor-regular.otf} (when loading by filename), the configuration
% file would be \texttt{texgyreadventor-regular.fontspec}.
+% (N.B. the lettercase of the names should match.)
%
% This mechanism can be used to define custom names or aliases for your font collections.
-% If you create a file \texttt{my-charis.fontspec} containing, say,
+% If you create a file \texttt{MyCharis.fontspec} containing, say,
% \begin{Verbatim}
-% \defaultfontfeatures[my-charis]
+% \defaultfontfeatures[My Charis]
% {
% Extension = .ttf ,
% UprightFont = CharisSILR,
@@ -855,9 +856,8 @@ This work consists of this file fontspec.dtx
% % <any other desired options>
% }
% \end{Verbatim}
-% you can load that family with \verb|\fontspec{my-charis}| and similar.
-% The optional argument to \cs{defaultfontfeatures} must match the filename
-% else the options won't take effect.
+% you can load that custom family with \verb|\fontspec{My Charis}| and similar.
+% The optional argument to \cs{defaultfontfeatures} must match that requested by the font loading command (\verb|\fontspec|, etc.), else the options won't take effect.
%
% Finally, note that options for font faces can also be defined in this way.
% To continue the example above, here we colour the different faces:
@@ -865,7 +865,7 @@ This work consists of this file fontspec.dtx
% \defaultfontfeatures[CharisSILR]{Color=blue}
% \defaultfontfeatures[CharisSILB]{Color=red}
% \end{Verbatim}
-% And such configuration lines can be stored within their own \texttt{.fontspec} files; in this way, \pkg{fontspec} is designed to handle `nested' configuration options as well.
+% And such configuration lines can be stored either inline inside \texttt{My Charis.fontspec} or within their own \texttt{.fontspec} files; in this way, \pkg{fontspec} is designed to handle `nested' configuration options as well.
%
% \subsection{Changing the currently selected features}
% \label{sec:addfontfeatures}
@@ -943,16 +943,6 @@ This work consists of this file fontspec.dtx
% Attention All Martini Drinkers \\
% \end{Xexample}
%
-% Combined with the options for selecting arbitrary \emph{fonts} for
-% the different shapes, these separate feature options allow the
-% selection of arbitrary weights in the Skia typeface, as shown in \exref{bffeat}.
-%
-% \begin{Xexample}{bffeat}{Multiple Master--like features in AAT fonts.}
-% \fontspec[BoldFont={Skia},
-% BoldFeatures={Weight=2}]{Skia}
-% Skia \\ \bfseries Skia `Bold'
-% \end{Xexample}
-%
% Note that because most fonts include their small caps glyphs
% within the main font, features specified with \feat{SmallCapsFeatures} are applied \emph{in addition} to
% any other shape-specific features as defined above, and hence \feat{SmallCapsFeatures}
@@ -1609,8 +1599,7 @@ This work consists of this file fontspec.dtx
% other, so you can enable them individually per character as shown in
% \exref{cv2}. (Unlike stylistic alternates, say.)
%
-% Note that the indexing starts from zero, which is compatible with \XeTeX\
-% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+% Note that the indexing starts from zero.
%
% \begin{Lexample}[firstline=2]{cv}{The \feat{CharacterVariant} feature showing off Georg Duffner's open source Garamond revival font.}
% \huge
@@ -1645,8 +1634,7 @@ This work consists of this file fontspec.dtx
% \textsc{a} \& h
% \end{Xexample}
%
-% Note that the indexing starts from zero, which is compatible with plain \XeTeX\
-% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+% Note that the indexing starts from zero.
%
% See \vref{sec:newfeatures} for a way to assign names to alternates,
% which must be done on a per-font basis.
@@ -1807,8 +1795,7 @@ This work consists of this file fontspec.dtx
% \x0\x1\x2\x3\x4\x5\x6\x7\x7\x8\x9
% \end{Xexample}
%
-% Note that the indexing starts from zero, which is compatible with \XeTeX\
-% but \emph{incompatible} with \texttt{luaotfload}, which starts from one.
+% Note that the indexing starts from zero.
%
% \subsection{CJK shape}
%
@@ -2441,23 +2428,12 @@ This work consists of this file fontspec.dtx
% \subsection{Annotation}
% Various Asian fonts are equipped with a more extensive range of
% numbers and numerals in different forms. These are accessed through
-% the \feat{Annotation} feature (see \exref{aat-annot}) with the following
+% the \feat{Annotation} feature with the following
% options: \opt{Off},
% \opt{Box}, \opt{RoundedBox}, \opt{Circle}, \opt{BlackCircle},
% \opt{Parenthesis}, \opt{Period}, \opt{RomanNumerals}, \opt{Diamond},
% \opt{BlackSquare}, \opt{BlackRoundSquare}, and \opt{DoubleCircle}.
%
-% \begin{Xexample}{aat-annot}{Various annotation forms.}
-% \fontspec{Hei Regular}
-% 1 2 3 4 5 6 7 8 9 \\
-% \fontspec{Hei Regular}[Annotation=Circle]
-% 1 2 3 4 5 6 7 8 9 \\
-% \fontspec{Hei Regular}[Annotation=Parenthesis]
-% 1 2 3 4 5 6 7 8 9 \\
-% \fontspec{Hei Regular}[Annotation=Period]
-% 1 2 3 4 5 6 7 8 9
-% \end{Xexample}
-%
%
%
% \part{Programming interface}
@@ -3165,6 +3141,18 @@ This work consists of this file fontspec.dtx
% commands are contained herein; they all use or define macros which
% are defined or used later on in \vref{sec:codeinternal}.
%
+% \subsubsection{Helper macros for argument mangling}
+% \begin{macrocode}
+\cs_new:Nn \@@_pass_args:nnn
+ {
+ \IfNoValueTF {#2}
+ { \@@_post_arg:w {#1} {#3} }
+ { #1 {#2} {#3} }
+ }
+\NewDocumentCommand \@@_post_arg:w { m m O{} }
+ { #1 {#3} {#2} }
+% \end{macrocode}
+%
% \subsubsection{Font selection}
% \begin{macro}{\fontspec}
% This is the main command of the package that
@@ -3172,10 +3160,13 @@ 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 O{} }
+\NewDocumentCommand \fontspec { o m }
+ { \@@_pass_args:nnn \@@_fontspec:nn {#1} {#2} }
+
+\cs_new:Nn \@@_fontspec:nn
{
\fontencoding {\g_fontspec_encoding_tl}
- \fontspec_set_family:Nnn \f@family {#1,#3}{#2}
+ \fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
}
@@ -3191,21 +3182,32 @@ 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 O{} }
+\DeclareDocumentCommand \setmainfont { o m }
+ { \@@_pass_args:nnn \@@_setmainfont:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setmainfont:nn
{
- \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \rmdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
+
+\DeclareDocumentCommand \setsansfont { o m }
+ { \@@_pass_args:nnn \@@_setsansfont:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setsansfont:nn
{
- \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \sfdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
+
+\DeclareDocumentCommand \setmonofont { o m }
+ { \@@_pass_args:nnn \@@_setmonofont:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setmonofont:nn
{
- \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \ttdefault {#1}{#2}
\normalfont
\ignorespaces
}
@@ -3236,21 +3238,36 @@ This work consists of this file fontspec.dtx
\tl_new:N \g_@@_bfmathrm_tl
\tl_new:N \g_@@_mathsf_tl
\tl_new:N \g_@@_mathtt_tl
-\DeclareDocumentCommand \setmathrm { O{} m O{} }
+\DeclareDocumentCommand \setmathrm { o m }
+ { \@@_pass_args:nnn \@@_setmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setmathrm:nn
{
- \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g_@@_mathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setboldmathrm { O{} m O{} }
+
+\DeclareDocumentCommand \setboldmathrm { o m }
+ { \@@_pass_args:nnn \@@_setboldmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setboldmathrm:nn
{
- \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g_@@_bfmathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathsf { O{} m O{} }
+
+\DeclareDocumentCommand \setmathsf { o m }
+ { \@@_pass_args:nnn \@@_setmathsf:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setmathsf:nn
{
- \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g_@@_mathsf_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathtt { O{} m O{} }
+
+\DeclareDocumentCommand \setmathtt { o m }
+ { \@@_pass_args:nnn \@@_setmathtt:nn {#1} {#2} }
+
+\cs_new:Nn \@@_setmathtt:nn
{
- \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g_@@_mathtt_tl {#1} {#2}
}
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
@@ -3280,9 +3297,12 @@ 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 O{} }
+\DeclareDocumentCommand \newfontfamily { m o m }
+ { \@@_pass_args:nnn { \@@_newfontfamily:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \@@_newfontfamily:Nnn
{
- \fontspec_set_family:cnn { g_@@_ \cs_to_str:N #1 _family } {#2,#4} {#3}
+ \fontspec_set_family:cnn { g_@@_ \cs_to_str:N #1 _family } {#2} {#3}
\use:x
{
\exp_not:N \DeclareRobustCommand \exp_not:N #1
@@ -3295,9 +3315,12 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% \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 O{} }
+\DeclareDocumentCommand \newfontface { m o m }
+ { \@@_pass_args:nnn { \@@_newfontface:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \@@_newfontface:Nnn
{
- \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+ \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
% \end{macrocode}
% \end{macro} \end{macro}
@@ -3356,17 +3379,23 @@ This work consists of this file fontspec.dtx
}
}
}
-
+% \end{macrocode}
+%
+% \begin{macro}{\@@_sanitise_fontname:Nn}
+% Assigns font name |#2| to token list variable |#1| and strips extension(s) from it in the case of an external font.
+% We strip spaces for luatex for consistency with luaotfload, although I'm not sure this is necessary any more.
+% At one stage this also lowercased the name, but this step has been removed unless someone can remind me why it was necessary.
+% \begin{macrocode}
\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 {~}
+ \tl_set:Nx #1 {#2}
+%<luatex> \tl_remove_all:Nn #1 {~}
\clist_map_inline:Nn \l_@@_extensions_clist
{ \tl_remove_once:Nn #1 {##1} }
}
-
% \end{macrocode}
% \end{macro}
+% \end{macro}
%
%
%
@@ -3481,32 +3510,34 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\DeclareDocumentCommand \aliasfontfeature {mm}
{
- \keys_if_exist:nnTF {fontspec} {#1}
- {
- \keys_define:nn {fontspec}
- { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } }
- }
- {
- \keys_if_exist:nnTF {fontspec-preparse} {#1}
- {
- \keys_define:nn {fontspec-preparse}
- { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } }
- }
+ \clist_map_inline:nn
+ { fontspec, fontspec-preparse, fontspec-preparse-external,
+ fontspec-preparse-nested, fontspec-renderer }
+ {
+ \keys_if_exist:nnT {##1} {#1}
{
- \keys_if_exist:nnTF {fontspec-preparse-external} {#1}
- {
- \keys_define:nn {fontspec-preparse-external}
+ \clist_map_break:n
{
- #2 .code:n =
- { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } }
+ \@@_alias_font_feature:nnn {##1} {#1} {#2}
+ \use_none_delimit_by_q_nil:w
}
- }
- {
- \@@_warning:nx {rename-feature-not-exist} {#1}
- }
}
- }
+ }
+
+ % this executes if no match was found:
+ \@@_warning:nx {rename-feature-not-exist} {#1}
+
+ % jump to here if a match:
+ \use_none:n
+ \q_nil
}
+
+\cs_set:Nn \@@_alias_font_feature:nnn
+ {
+ \keys_define:nn {#1}
+ { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } }
+ }
+
\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
{ \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } }
% \end{macrocode}
@@ -3987,8 +4018,7 @@ This work consists of this file fontspec.dtx
% 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_@@_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.
@@ -3999,13 +4029,12 @@ This work consists of this file fontspec.dtx
\group_begin:
\font_suppress_not_found_error:
\@@_init:
-
- \tl_set:Nx \l_fontspec_fontname_tl {#2}
-%<luatex> \tl_remove_all:Nn \l_fontspec_fontname_tl {~}
- \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl
- \tl_set_eq:NN \l_@@_basename_tl \l_fontspec_fontname_tl
- \@@_load_external_fontoptions:N \l_fontspec_fontname_tl
+ \tl_set:Nx \l_fontspec_fontname_tl {#2}
+ \tl_set:Nx \l_fontspec_fontname_up_tl {#2}
+ \tl_set:Nx \l_@@_basename_tl {#2}
+
+ \@@_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2}
\@@_extract_all_features:n {#1}
\@@_preparse_features:
@@ -4036,17 +4065,19 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\@@_load_external_fontoptions:N}
+% \begin{macro}{\@@_load_external_fontoptions:Nn}
% 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
+\cs_new:Nn \@@_load_external_fontoptions:Nn
{
- \@@_sanitise_fontname:Nn \l_@@_tmp_tl {#1}
- \prop_if_in:NVF \g_@@_fontopts_prop {\l_@@_tmp_tl}
+ \@@_sanitise_fontname:Nn #1 {#2}
+ \tl_set:Nx \l_@@_ext_filename_tl {#1.fontspec}
+ \tl_remove_all:Nn \l_@@_ext_filename_tl {~}
+ \prop_if_in:NVF \g_@@_fontopts_prop #1
{
- \exp_args:No \file_if_exist:nT {\l_@@_tmp_tl.fontspec}
- { \file_input:n {\l_@@_tmp_tl.fontspec} }
+ \exp_args:No \file_if_exist:nT { \l_@@_ext_filename_tl }
+ { \file_input:n { \l_@@_ext_filename_tl } }
}
}
% \end{macrocode}
@@ -4055,16 +4086,13 @@ This work consists of this file fontspec.dtx
% \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}
+ \clist_set:Nx \l_@@_all_features_clist {#1}
}
{
- \prop_get:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist
+ \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_tl \l_@@_fontopts_clist
{ \clist_clear:N \l_@@_fontopts_clist }
\prop_get:NVNF \g_@@_fontopts_prop \l_@@_family_label_tl \l_@@_family_fontopts_clist
@@ -4103,7 +4131,7 @@ This work consists of this file fontspec.dtx
% 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 \@@_if_detect_external:nT \l_fontspec_fontname_tl
+ \@@_if_detect_external:VT \l_@@_basename_tl
{ \keys_set:nn {fontspec-preparse-external} {ExternalLocation} }
\keys_set_known:nxN {fontspec-preparse-external}
@@ -4151,6 +4179,7 @@ This work consists of this file fontspec.dtx
}
\bool_if:NTF \l_@@_tmpa_bool \prg_return_true: \prg_return_false:
}
+\cs_generate_variant:Nn \@@_if_detect_external:nT {V}
% \end{macrocode}
% \end{macro}
%
@@ -4462,10 +4491,8 @@ This work consists of this file fontspec.dtx
\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:NVNF \g_@@_fontopts_prop \l_@@_tmp_tl \l_@@_fontopts_clist
+ \@@_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1}
+ \prop_get:NVNF \g_@@_fontopts_prop \l_fontspec_fontname_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} }
@@ -5204,9 +5231,10 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\keys_define:nn {fontspec-renderer}
{
- Renderer .choice_code:n =
+ Renderer .choices:nn =
+ {AAT,ICU,OpenType,Graphite,Full,Basic}
{
- \int_compare:nTF {\l_keys_choice_int <= 3} {
+ \int_compare:nTF {\l_keys_choice_int <= 4} {
%<*xetexx>
\tl_set:Nv \l_fontspec_renderer_tl
{ g_fontspec_renderer_tag_ \l_keys_choice_tl }
@@ -5225,8 +5253,6 @@ This work consists of this file fontspec.dtx
%</luatex>
}
}
- ,
- 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} {/OT}
@@ -6986,29 +7012,40 @@ end
%
% \begin{macrocode}
%<*patches>
+\ExplSyntaxOn
% \end{macrocode}
%
% \subsection{Unicode footnote symbols}
-% We used to load \pkg{fixltx2e} but this is not recommended; it should ideally be loaded before \cs{begindocument}, especially from TL2014 onwards.
-% \begin{macrocode}
-\ExplSyntaxOn
-\cs_set_protected:Npn \@fnsymbol #1
- {
- \int_case:nnF {#1}
+% This is handled by \pkg{fixltx2e} / \LaTeX2015 now.
+% \begin{macrocode}
+\cs_if_exist:NF \TextOrMath
+ {
+ % copy official definition:
+ \protected\expandafter\def\csname TextOrMath\space\endcsname{%
+ \ifmmode \expandafter\@secondoftwo
+ \else \expandafter\@firstoftwo \fi}
+ \edef\TextOrMath#1#2{%
+ \expandafter\noexpand\csname TextOrMath\space\endcsname
+ {#1}{#2}}
+ % translation of official definition:
+ \cs_set:Npn \@fnsymbol #1
{
- {0} {}
- {1} { \mode_if_math:TF *\textasteriskcentered }
- {2} { \mode_if_math:TF \dagger\textdagger }
- {3} { \mode_if_math:TF \ddagger\textdaggerdbl }
- {4} { \mode_if_math:TF \mathsection\textsection }
- {5} { \mode_if_math:TF \mathparagraph\textparagraph }
- {6} { \mode_if_math:TF \|\textbardbl }
- {7} { \mode_if_math:TF {**}{\textasteriskcentered\textasteriskcentered} }
- {8} { \mode_if_math:TF {\dagger\dagger}{\textdagger\textdagger} }
- {9} { \mode_if_math:TF {\ddagger\ddagger}{\textdaggerdbl\textdaggerdbl} }
+ \int_case:nnF {#1}
+ {
+ {0} {}
+ {1} { \TextOrMath \textasteriskcentered* }
+ {2} { \TextOrMath \textdagger\dagger }
+ {3} { \TextOrMath \textdaggerdbl\ddagger }
+ {4} { \TextOrMath \textsection\mathsection }
+ {5} { \TextOrMath \textparagraph\mathparagraph }
+ {6} { \TextOrMath \textbardbl\| }
+ {7} { \TextOrMath {\textasteriskcentered\textasteriskcentered}{**} }
+ {8} { \TextOrMath {\textdagger\textdagger}{\dagger\dagger} }
+ {9} { \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger} }
+ }
+ { \@ctrerr }
+ }
}
- { \@ctrerr }
- }
% \end{macrocode}
%
% \subsection{Emph}
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
index e0c14fd0357..d36538320c8 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-luatex.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec-luatex}
- [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]
+ [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX]
\ExplSyntaxOn
@@ -35,28 +35,50 @@
\cs_set:Npn \XeTeXpicfile {}
\RequirePackage{xunicode}
\cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
-\DeclareDocumentCommand \fontspec { O{} m O{} }
+\cs_new:Nn \__fontspec_pass_args:nnn
+ {
+ \IfNoValueTF {#2}
+ { \__fontspec_post_arg:w {#1} {#3} }
+ { #1 {#2} {#3} }
+ }
+\NewDocumentCommand \__fontspec_post_arg:w { m m O{} }
+ { #1 {#3} {#2} }
+\NewDocumentCommand \fontspec { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_fontspec:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_fontspec:nn
{
\fontencoding {\g_fontspec_encoding_tl}
- \fontspec_set_family:Nnn \f@family {#1,#3}{#2}
+ \fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
}
-\DeclareDocumentCommand \setmainfont { O{} m O{} }
+\DeclareDocumentCommand \setmainfont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmainfont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmainfont:nn
{
- \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \rmdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
+
+\DeclareDocumentCommand \setsansfont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setsansfont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setsansfont:nn
{
- \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \sfdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
+
+\DeclareDocumentCommand \setmonofont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmonofont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmonofont:nn
{
- \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \ttdefault {#1}{#2}
\normalfont
\ignorespaces
}
@@ -65,21 +87,36 @@
\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{} }
+\DeclareDocumentCommand \setmathrm { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathrm:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setboldmathrm { O{} m O{} }
+
+\DeclareDocumentCommand \setboldmathrm { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setboldmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setboldmathrm:nn
{
- \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathsf { O{} m O{} }
+
+\DeclareDocumentCommand \setmathsf { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathsf:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathsf:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathtt { O{} m O{} }
+
+\DeclareDocumentCommand \setmathtt { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathtt:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathtt:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
}
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
@@ -88,9 +125,12 @@
\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{} }
+\DeclareDocumentCommand \newfontfamily { m o m }
+ { \__fontspec_pass_args:nnn { \__fontspec_newfontfamily:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \__fontspec_newfontfamily:Nnn
{
- \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3}
+ \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3}
\use:x
{
\exp_not:N \DeclareRobustCommand \exp_not:N #1
@@ -100,9 +140,12 @@
}
}
}
-\DeclareDocumentCommand \newfontface { m O{} m O{} }
+\DeclareDocumentCommand \newfontface { m o m }
+ { \__fontspec_pass_args:nnn { \__fontspec_newfontface:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \__fontspec_newfontface:Nnn
{
- \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+ \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
\clist_new:N \g__fontspec_default_fontopts_clist
\prop_new:N \g__fontspec_fontopts_prop
@@ -140,15 +183,13 @@
}
}
}
-
\cs_new:Nn \__fontspec_sanitise_fontname:Nn
{
- \use:x { \tl_to_lowercase:n { \tl_set:Nx \exp_not:N #1 {#2} } }
+ \tl_set:Nx #1 {#2}
\tl_remove_all:Nn #1 {~}
\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}
{
@@ -201,32 +242,34 @@
\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated
\DeclareDocumentCommand \aliasfontfeature {mm}
{
- \keys_if_exist:nnTF {fontspec} {#1}
- {
- \keys_define:nn {fontspec}
- { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } }
- }
- {
- \keys_if_exist:nnTF {fontspec-preparse} {#1}
- {
- \keys_define:nn {fontspec-preparse}
- { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } }
- }
+ \clist_map_inline:nn
+ { fontspec, fontspec-preparse, fontspec-preparse-external,
+ fontspec-preparse-nested, fontspec-renderer }
+ {
+ \keys_if_exist:nnT {##1} {#1}
{
- \keys_if_exist:nnTF {fontspec-preparse-external} {#1}
- {
- \keys_define:nn {fontspec-preparse-external}
+ \clist_map_break:n
{
- #2 .code:n =
- { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } }
+ \__fontspec_alias_font_feature:nnn {##1} {#1} {#2}
+ \use_none_delimit_by_q_nil:w
}
- }
- {
- \__fontspec_warning:nx {rename-feature-not-exist} {#1}
- }
}
- }
+ }
+
+ % this executes if no match was found:
+ \__fontspec_warning:nx {rename-feature-not-exist} {#1}
+
+ % jump to here if a match:
+ \use_none:n
+ \q_nil
}
+
+\cs_set:Nn \__fontspec_alias_font_feature:nnn
+ {
+ \keys_define:nn {#1}
+ { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } }
+ }
+
\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
{ \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } }
\DeclareDocumentCommand \newfontscript {mm}
@@ -506,12 +549,11 @@
\font_suppress_not_found_error:
\__fontspec_init:
- \tl_set:Nx \l_fontspec_fontname_tl {#2}
- \tl_remove_all:Nn \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
+ \tl_set:Nx \l_fontspec_fontname_tl {#2}
+ \tl_set:Nx \l_fontspec_fontname_up_tl {#2}
+ \tl_set:Nx \l__fontspec_basename_tl {#2}
- \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl
+ \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2}
\__fontspec_extract_all_features:n {#1}
\__fontspec_preparse_features:
@@ -532,26 +574,25 @@
}
\group_end:
}
-\cs_new:Nn \__fontspec_load_external_fontoptions:N
+\cs_new:Nn \__fontspec_load_external_fontoptions:Nn
{
- \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1}
- \prop_if_in:NVF \g__fontspec_fontopts_prop {\l__fontspec_tmp_tl}
+ \__fontspec_sanitise_fontname:Nn #1 {#2}
+ \tl_set:Nx \l__fontspec_ext_filename_tl {#1.fontspec}
+ \tl_remove_all:Nn \l__fontspec_ext_filename_tl {~}
+ \prop_if_in:NVF \g__fontspec_fontopts_prop #1
{
- \exp_args:No \file_if_exist:nT {\l__fontspec_tmp_tl.fontspec}
- { \file_input:n {\l__fontspec_tmp_tl.fontspec} }
+ \exp_args:No \file_if_exist:nT { \l__fontspec_ext_filename_tl }
+ { \file_input:n { \l__fontspec_ext_filename_tl } }
}
}
\cs_new:Nn \__fontspec_extract_all_features:n
{
- \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl}
-
\bool_if:NTF \l__fontspec_disable_defaults_bool
{
- \clist_set:Nx \l__fontspec_all_features_clist
- {#1}
+ \clist_set:Nx \l__fontspec_all_features_clist {#1}
}
{
- \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist
+ \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_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
@@ -570,7 +611,7 @@
}
\cs_new:Nn \__fontspec_preparse_features:
{
- \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl
+ \__fontspec_if_detect_external:VT \l__fontspec_basename_tl
{ \keys_set:nn {fontspec-preparse-external} {ExternalLocation} }
\keys_set_known:nxN {fontspec-preparse-external}
@@ -602,6 +643,7 @@
}
\bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false:
}
+\cs_generate_variant:Nn \__fontspec_if_detect_external:nT {V}
\cs_set:Nn \__fontspec_fullname:n
{
\__fontspec_namewrap:n { #1 \l__fontspec_extension_tl }
@@ -757,10 +799,8 @@
\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:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist
+ \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1}
+ \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_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} }
@@ -1153,9 +1193,10 @@
\tl_clear:N \l__fontspec_extension_tl
\keys_define:nn {fontspec-renderer}
{
- Renderer .choice_code:n =
+ Renderer .choices:nn =
+ {AAT,ICU,OpenType,Graphite,Full,Basic}
{
- \int_compare:nTF {\l_keys_choice_int <= 3} {
+ \int_compare:nTF {\l_keys_choice_int <= 4} {
\__fontspec_warning:nx {only-xetex-feature} {Renderer=AAT/OpenType/Graphite}
}
{
@@ -1163,8 +1204,6 @@
{ g_fontspec_mode_tag_ \l_keys_choice_tl }
}
}
- ,
- 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} {/OT}
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
index a690db0eb37..259777fa392 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
@@ -14,27 +14,38 @@
%%
%%
\ProvidesPackage{fontspec-patches}
- [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]
+ [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX]
\ExplSyntaxOn
-\cs_set_protected:Npn \@fnsymbol #1
+\cs_if_exist:NF \TextOrMath
{
- \int_case:nnF {#1}
+ % copy official definition:
+ \protected\expandafter\def\csname TextOrMath\space\endcsname{%
+ \ifmmode \expandafter\@secondoftwo
+ \else \expandafter\@firstoftwo \fi}
+ \edef\TextOrMath#1#2{%
+ \expandafter\noexpand\csname TextOrMath\space\endcsname
+ {#1}{#2}}
+ % translation of official definition:
+ \cs_set:Npn \@fnsymbol #1
{
- {0} {}
- {1} { \mode_if_math:TF *\textasteriskcentered }
- {2} { \mode_if_math:TF \dagger\textdagger }
- {3} { \mode_if_math:TF \ddagger\textdaggerdbl }
- {4} { \mode_if_math:TF \mathsection\textsection }
- {5} { \mode_if_math:TF \mathparagraph\textparagraph }
- {6} { \mode_if_math:TF \|\textbardbl }
- {7} { \mode_if_math:TF {**}{\textasteriskcentered\textasteriskcentered} }
- {8} { \mode_if_math:TF {\dagger\dagger}{\textdagger\textdagger} }
- {9} { \mode_if_math:TF {\ddagger\ddagger}{\textdaggerdbl\textdaggerdbl} }
+ \int_case:nnF {#1}
+ {
+ {0} {}
+ {1} { \TextOrMath \textasteriskcentered* }
+ {2} { \TextOrMath \textdagger\dagger }
+ {3} { \TextOrMath \textdaggerdbl\ddagger }
+ {4} { \TextOrMath \textsection\mathsection }
+ {5} { \TextOrMath \textparagraph\mathparagraph }
+ {6} { \TextOrMath \textbardbl\| }
+ {7} { \TextOrMath {\textasteriskcentered\textasteriskcentered}{**} }
+ {8} { \TextOrMath {\textdagger\textdagger}{\dagger\dagger} }
+ {9} { \TextOrMath {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger} }
+ }
+ { \@ctrerr }
+ }
}
- { \@ctrerr }
- }
\DeclareRobustCommand \em
{
\@nomath\em
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
index 9598731ef62..74500f06cf3 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec-xetex}
- [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]
+ [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX]
\ExplSyntaxOn
@@ -32,28 +32,50 @@
\tl_set_eq:NN \latinencoding \g_fontspec_encoding_tl
}
\RequirePackage{xunicode}
-\DeclareDocumentCommand \fontspec { O{} m O{} }
+\cs_new:Nn \__fontspec_pass_args:nnn
+ {
+ \IfNoValueTF {#2}
+ { \__fontspec_post_arg:w {#1} {#3} }
+ { #1 {#2} {#3} }
+ }
+\NewDocumentCommand \__fontspec_post_arg:w { m m O{} }
+ { #1 {#3} {#2} }
+\NewDocumentCommand \fontspec { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_fontspec:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_fontspec:nn
{
\fontencoding {\g_fontspec_encoding_tl}
- \fontspec_set_family:Nnn \f@family {#1,#3}{#2}
+ \fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
}
-\DeclareDocumentCommand \setmainfont { O{} m O{} }
+\DeclareDocumentCommand \setmainfont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmainfont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmainfont:nn
{
- \fontspec_set_family:Nnn \rmdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \rmdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setsansfont { O{} m O{} }
+
+\DeclareDocumentCommand \setsansfont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setsansfont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setsansfont:nn
{
- \fontspec_set_family:Nnn \sfdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \sfdefault {#1}{#2}
\normalfont
\ignorespaces
}
-\DeclareDocumentCommand \setmonofont { O{} m O{} }
+
+\DeclareDocumentCommand \setmonofont { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmonofont:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmonofont:nn
{
- \fontspec_set_family:Nnn \ttdefault {#1,#3}{#2}
+ \fontspec_set_family:Nnn \ttdefault {#1}{#2}
\normalfont
\ignorespaces
}
@@ -62,21 +84,36 @@
\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{} }
+\DeclareDocumentCommand \setmathrm { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathrm:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setboldmathrm { O{} m O{} }
+
+\DeclareDocumentCommand \setboldmathrm { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setboldmathrm:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setboldmathrm:nn
{
- \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_bfmathrm_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathsf { O{} m O{} }
+
+\DeclareDocumentCommand \setmathsf { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathsf:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathsf:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathsf_tl {#1} {#2}
}
-\DeclareDocumentCommand \setmathtt { O{} m O{} }
+
+\DeclareDocumentCommand \setmathtt { o m }
+ { \__fontspec_pass_args:nnn \__fontspec_setmathtt:nn {#1} {#2} }
+
+\cs_new:Nn \__fontspec_setmathtt:nn
{
- \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1,#3}{#2}
+ \fontspec_set_family:Nnn \g__fontspec_mathtt_tl {#1} {#2}
}
\@onlypreamble\setmathrm
\@onlypreamble\setboldmathrm
@@ -85,9 +122,12 @@
\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{} }
+\DeclareDocumentCommand \newfontfamily { m o m }
+ { \__fontspec_pass_args:nnn { \__fontspec_newfontfamily:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \__fontspec_newfontfamily:Nnn
{
- \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2,#4} {#3}
+ \fontspec_set_family:cnn { g__fontspec_ \cs_to_str:N #1 _family } {#2} {#3}
\use:x
{
\exp_not:N \DeclareRobustCommand \exp_not:N #1
@@ -97,9 +137,12 @@
}
}
}
-\DeclareDocumentCommand \newfontface { m O{} m O{} }
+\DeclareDocumentCommand \newfontface { m o m }
+ { \__fontspec_pass_args:nnn { \__fontspec_newfontface:Nnn #1 } {#2} {#3} }
+
+\cs_new:Nn \__fontspec_newfontface:Nnn
{
- \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2,#4 ] {#3}
+ \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3}
}
\clist_new:N \g__fontspec_default_fontopts_clist
\prop_new:N \g__fontspec_fontopts_prop
@@ -137,15 +180,12 @@
}
}
}
-
\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 {~}
+ \tl_set:Nx #1 {#2}
\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}
{
@@ -198,32 +238,34 @@
\cs_set_eq:NN \newICUfeature \newopentypefeature % deprecated
\DeclareDocumentCommand \aliasfontfeature {mm}
{
- \keys_if_exist:nnTF {fontspec} {#1}
- {
- \keys_define:nn {fontspec}
- { #2 .code:n = { \keys_set:nn {fontspec} { #1 = {##1} } } }
- }
- {
- \keys_if_exist:nnTF {fontspec-preparse} {#1}
- {
- \keys_define:nn {fontspec-preparse}
- { #2 .code:n = { \keys_set:nn {fontspec-preparse} { #1 = {##1} } } }
- }
+ \clist_map_inline:nn
+ { fontspec, fontspec-preparse, fontspec-preparse-external,
+ fontspec-preparse-nested, fontspec-renderer }
+ {
+ \keys_if_exist:nnT {##1} {#1}
{
- \keys_if_exist:nnTF {fontspec-preparse-external} {#1}
- {
- \keys_define:nn {fontspec-preparse-external}
+ \clist_map_break:n
{
- #2 .code:n =
- { \keys_set:nn {fontspec-preparse-external} { #1 = {##1} } }
+ \__fontspec_alias_font_feature:nnn {##1} {#1} {#2}
+ \use_none_delimit_by_q_nil:w
}
- }
- {
- \__fontspec_warning:nx {rename-feature-not-exist} {#1}
- }
}
- }
+ }
+
+ % this executes if no match was found:
+ \__fontspec_warning:nx {rename-feature-not-exist} {#1}
+
+ % jump to here if a match:
+ \use_none:n
+ \q_nil
}
+
+\cs_set:Nn \__fontspec_alias_font_feature:nnn
+ {
+ \keys_define:nn {#1}
+ { #3 .code:n = { \keys_set:nn {#1} { #2 = {##1} } } }
+ }
+
\DeclareDocumentCommand \aliasfontfeatureoption {mmm}
{ \keys_define:nn { fontspec / #1 } { #3 .meta:n = {#2} } }
\DeclareDocumentCommand \newfontscript {mm}
@@ -503,11 +545,11 @@
\font_suppress_not_found_error:
\__fontspec_init:
- \tl_set:Nx \l_fontspec_fontname_tl {#2}
- \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
+ \tl_set:Nx \l_fontspec_fontname_tl {#2}
+ \tl_set:Nx \l_fontspec_fontname_up_tl {#2}
+ \tl_set:Nx \l__fontspec_basename_tl {#2}
- \__fontspec_load_external_fontoptions:N \l_fontspec_fontname_tl
+ \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#2}
\__fontspec_extract_all_features:n {#1}
\__fontspec_preparse_features:
@@ -528,26 +570,25 @@
}
\group_end:
}
-\cs_new:Nn \__fontspec_load_external_fontoptions:N
+\cs_new:Nn \__fontspec_load_external_fontoptions:Nn
{
- \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {#1}
- \prop_if_in:NVF \g__fontspec_fontopts_prop {\l__fontspec_tmp_tl}
+ \__fontspec_sanitise_fontname:Nn #1 {#2}
+ \tl_set:Nx \l__fontspec_ext_filename_tl {#1.fontspec}
+ \tl_remove_all:Nn \l__fontspec_ext_filename_tl {~}
+ \prop_if_in:NVF \g__fontspec_fontopts_prop #1
{
- \exp_args:No \file_if_exist:nT {\l__fontspec_tmp_tl.fontspec}
- { \file_input:n {\l__fontspec_tmp_tl.fontspec} }
+ \exp_args:No \file_if_exist:nT { \l__fontspec_ext_filename_tl }
+ { \file_input:n { \l__fontspec_ext_filename_tl } }
}
}
\cs_new:Nn \__fontspec_extract_all_features:n
{
- \__fontspec_sanitise_fontname:Nn \l__fontspec_tmp_tl {\l_fontspec_fontname_tl}
-
\bool_if:NTF \l__fontspec_disable_defaults_bool
{
- \clist_set:Nx \l__fontspec_all_features_clist
- {#1}
+ \clist_set:Nx \l__fontspec_all_features_clist {#1}
}
{
- \prop_get:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist
+ \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_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
@@ -566,7 +607,7 @@
}
\cs_new:Nn \__fontspec_preparse_features:
{
- \exp_args:NV \__fontspec_if_detect_external:nT \l_fontspec_fontname_tl
+ \__fontspec_if_detect_external:VT \l__fontspec_basename_tl
{ \keys_set:nn {fontspec-preparse-external} {ExternalLocation} }
\keys_set_known:nxN {fontspec-preparse-external}
@@ -598,6 +639,7 @@
}
\bool_if:NTF \l__fontspec_tmpa_bool \prg_return_true: \prg_return_false:
}
+\cs_generate_variant:Nn \__fontspec_if_detect_external:nT {V}
\cs_set:Nn \__fontspec_fullname:n
{
\__fontspec_namewrap:n { #1 \l__fontspec_extension_tl }
@@ -776,10 +818,8 @@
\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:NVNF \g__fontspec_fontopts_prop \l__fontspec_tmp_tl \l__fontspec_fontopts_clist
+ \__fontspec_load_external_fontoptions:Nn \l_fontspec_fontname_tl {#1}
+ \prop_get:NVNF \g__fontspec_fontopts_prop \l_fontspec_fontname_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} }
@@ -1219,9 +1259,10 @@
\tl_clear:N \l__fontspec_extension_tl
\keys_define:nn {fontspec-renderer}
{
- Renderer .choice_code:n =
+ Renderer .choices:nn =
+ {AAT,ICU,OpenType,Graphite,Full,Basic}
{
- \int_compare:nTF {\l_keys_choice_int <= 3} {
+ \int_compare:nTF {\l_keys_choice_int <= 4} {
\tl_set:Nv \l_fontspec_renderer_tl
{ g_fontspec_renderer_tag_ \l_keys_choice_tl }
}
@@ -1229,8 +1270,6 @@
\__fontspec_warning:nx {only-luatex-feature} {Renderer=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} {/OT}
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
index 1eefd221419..920e4ef5f70 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
@@ -14,7 +14,7 @@
%%
%%
\ProvidesPackage{fontspec}
- [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]
+ [2015/03/14 v2.4c Font selection for XeLaTeX and LuaLaTeX]
\RequirePackage{expl3}[2011/09/05]