summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-09-18 22:36:31 +0000
committerKarl Berry <karl@freefriends.org>2010-09-18 22:36:31 +0000
commit732f3ec949d484fffd271e5341aad609013aeeca (patch)
treea9b5ecaaeff1cd19f3c35114e2ffa56e97e447b6 /Master
parentb450abde949b2a7193ba4062666fb892253d26dd (diff)
fontspec (18sep10)
git-svn-id: svn://tug.org/texlive/trunk@19796 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/README16
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex (renamed from Master/texmf-dist/doc/latex/fontspec/fontspec-luatex.tex)5
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdfbin155092 -> 160199 bytes
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec-xetex.tex53
-rw-r--r--Master/texmf-dist/doc/latex/fontspec/fontspec.pdfbin2702526 -> 2734656 bytes
-rw-r--r--Master/texmf-dist/source/latex/fontspec/Makefile9
-rw-r--r--Master/texmf-dist/source/latex/fontspec/fontspec.dtx273
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty8
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.cfg4
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.lua1
-rw-r--r--Master/texmf-dist/tex/latex/fontspec/fontspec.sty146
11 files changed, 326 insertions, 189 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README
index edd0536d1b6..be6318a5718 100644
--- a/Master/texmf-dist/doc/latex/fontspec/README
+++ b/Master/texmf-dist/doc/latex/fontspec/README
@@ -1,6 +1,6 @@
-THE FONTSPEC PACKAGE v2.0c
-==========================
+THE FONTSPEC PACKAGE v2.1
+=========================
This is the initial release of the fontspec package with support for LuaTeX.
(Previously, fontspec was XeTeX-only.)
@@ -143,6 +143,18 @@ gladly accepted!
Change history
--------------
+- v2.1 (2010/09/19)
+
+ * Now load xunicode internally for consistent behaviour in
+ XeLaTeX and LuaLaTeX.
+ * Font commands now include \fontencoding internally, easing their
+ use together with legacy TeX fonts.
+ * Colour & Opacity now behave a little better.
+ * Nested emphasis with \emph now also occurs inside a "slanted" shape.
+ * Some compatibility commands/options added that were removed.
+ in the transition to v2.
+ * Bug fix for a problem triggered after counters got too high.
+
- v2.0c (2010/08/01)
Bug fix and documentation tune-up.
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-luatex.tex b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex
index 552233392de..8f1eb4da52e 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec-luatex.tex
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-example.tex
@@ -1,8 +1,5 @@
-
-% !TEX TS-program = LuaLaTeX
-
\documentclass{article}
\usepackage{fontspec}
@@ -11,8 +8,6 @@
\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
-\frenchspacing % TeX's default is a little old-fashioned...
-
\begin{document}
\pagestyle{empty}
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
index 8701ecafe0d..67d0d9dd081 100644
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
+++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-xetex.tex b/Master/texmf-dist/doc/latex/fontspec/fontspec-xetex.tex
deleted file mode 100644
index e5220bd11f7..00000000000
--- a/Master/texmf-dist/doc/latex/fontspec/fontspec-xetex.tex
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
-% !TEX TS-program = XeLaTeX
-
-\documentclass{article}
-
-\usepackage{xltxtra}
-
-\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
-\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros}
-\setmonofont[Scale=MatchLowercase]{Inconsolata}
-
-\frenchspacing % TeX's default is a little old-fashioned...
-
-\begin{document}
-\pagestyle{empty}
-
-\section*{The basics of the \textsf{fontspec} package}
-
-The \textsf{fontspec} package enables automatic font selection
-for \LaTeX{} documents typeset with Xe\TeX{} or \LuaTeX.
-The basic command is
-
-{\centering \verb|\fontspec[font features]{font display name}|.\par}
-
-The default, sans serif, and typewriter fonts may be set with the
-\verb|\setmainfont|, \verb|\setsansfont| and \verb|\setmonofont|
-commands, respectively, as shown in the preamble. They take the
-same syntax as the \verb|\fontspec| package. All expected font
-shapes are available:
-
-\begin{center}
- {\itshape Italics and \scshape small caps\dots}\\
- {\sffamily\bfseries Bold sans serif and \itshape bold italic sans serif\dots}
-\end{center}
-
-Text fonts in maths mode are also changed (e.g., notice the cosine function in
-`$\cos(n\pi)=\pm 1$') but only if the roman and sans serif fonts are set in
-the preamble; \verb|\setmainfont| will not affect these maths mode fonts when
-called mid-document.
-Maths symbols themselves are not affected.
-
-Notice the font features used to load the default fonts in the preamble.
-The first, \verb|Ligatures=TeX|, enables regular \TeX{} ligatures like
-\verb|``---''| for ``---''.
-The second, \verb|Scale=MatchLowercase|, automatically scales the fonts to
-the same x-height.
-
-Please see the complete \textsf{fontspec} documentation for further
-information.
-
-\end{document}
diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf
index 75141442804..8b7cca7cf91 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/Makefile b/Master/texmf-dist/source/latex/fontspec/Makefile
index dc1e0deebb2..cd8158afd28 100644
--- a/Master/texmf-dist/source/latex/fontspec/Makefile
+++ b/Master/texmf-dist/source/latex/fontspec/Makefile
@@ -36,7 +36,7 @@ DTX = $(NAME).dtx
# Files grouped by generation mode
COMPILED = $(DOC) fontspec-testsuite.pdf
-EXAMPLES = fontspec-luatex.tex fontspec-xetex.tex
+EXAMPLES = fontspec-example.tex
UNPACKED = fontspec.sty fontspec-patches.sty fontspec.lua fontspec.cfg $(EXAMPLES)
SOURCE = $(DTX) Makefile README
GENERATED = $(COMPILED) $(UNPACKED)
@@ -45,10 +45,10 @@ TESTS = $(shell ls testsuite/*.cls testsuite/*.tex testsuite/*.ltx)
DOC_EXAMPLES = $(shell ls doc/*.pdf)
-CTAN_FILES = $(SOURCE) $(COMPILED) $(EXAMPLES) $(TESTS) $(DOC_EXAMPLES)
+CTAN_FILES = $(SOURCE) $(COMPILED) $(EXAMPLES) $(DOC_EXAMPLES)
# Files grouped by installation location
-UNPACKED_DOC = fontspec-luatex.tex fontspec-xetex.tex
+UNPACKED_DOC = fontspec-example.tex
RUNFILES = $(filter-out $(UNPACKED_DOC), $(UNPACKED))
DOCFILES = $(COMPILED) README $(UNPACKED_DOC)
@@ -76,7 +76,6 @@ all: $(GENERATED)
doc: $(COMPILED)
unpack: $(UNPACKED)
ctan: $(CTAN_ZIP)
- echo $(DOCFILES)
tds: $(TDS_ZIP)
world: all ctan
@@ -117,7 +116,7 @@ README: README.markdown
cp $< $@
# lazy:
-fontspec-testsuite.pdf: $(DTX) check
+fontspec-testsuite.pdf: $(DTX)
@echo 'Compiling test suite.'
$(DO_PDFLATEX)
xelatex --interaction=batchmode fontspec-testsuite.tex
diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
index 38c06fb7902..12c452c0f61 100644
--- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
+++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx
@@ -46,8 +46,7 @@ This work consists of this file fontspec.dtx
\nopreamble\nopostamble
\generate{\file{fontspec.cfg} {\from{fontspec.dtx}{cfg}}}
-\generate{\file{fontspec-xetex.tex} {\from{fontspec.dtx}{example,xetex}}}
-\generate{\file{fontspec-luatex.tex} {\from{fontspec.dtx}{example,luatex}}}
+\generate{\file{fontspec-example.tex} {\from{fontspec.dtx}{example}}}
\generate{\file{fontspec-testsuite.tex}{\from{fontspec.dtx}{testsuite}}}
\def\tmpa{plain}
@@ -63,7 +62,7 @@ This work consists of this file fontspec.dtx
%<fontspec>\ProvidesPackage{fontspec}
%<patches>\ProvidesPackage{fontspec-patches}
%<*fontspec|patches>
- [2010/08/01 v2.0c Advanced font selection for XeLaTeX/LuaLaTeX]
+ [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX]
%</fontspec|patches>
%
%<*driver>
@@ -168,7 +167,7 @@ This work consists of this file fontspec.dtx
% Thanks to David Perry for numerous documentation improvements and
% contributing the text for one of the sections of this manual.
%
-% Special thanks to Khaled Hosny, who had been the driving force behind the support for Lua\LaTeX, ultimately leading to version 2.0 of the package.
+% Special thanks to Khaled Hosny, who had been the driving force behind the support for \LuaLaTeX, ultimately leading to version 2.0 of the package.
%
% \section{Package loading and options}
%
@@ -177,19 +176,31 @@ This work consists of this file fontspec.dtx
% \usepackage{fontspec}
% \end{Verbatim}
%
-% \paragraph{\XeTeX\ users only}
-% Ross Moore's \pkg{xunicode} package is recommended for
-% providing backwards compatibility with \LaTeX's methods for accessing extra
+% \paragraph{\pkg{xunicode}}
+% Ross Moore's \pkg{xunicode} package is now automatically loaded for
+% users of both \XeLaTeX\ and \LuaLaTeX.
+% This package provides backwards compatibility with \LaTeX's methods for accessing extra
% characters and accents (for example, |\%|, |\$|, |\textbullet|, |\"u|, and
% so on), plus many more Unicode characters.
+% \textbf{Warning}: introduced in v2.1, this is a backwards incompatible change to previous
+% versions of \pkg{fontspec}. This change was necessary in order to provide consistent
+% support for users of \XeTeX\ and \LuaTeX. I'm not aware of any issues this
+% may cause but please let me know if you run into problems.
+%
+% \paragraph{\XeTeX\ users only}
% The \pkg{xltxtra} package adds some minor extra features to \XeLaTeX, including, via the \pkg{metalogo} package, the
-% \cmd\XeTeX\ macro to typeset the \XeTeX\ logo.
+% \cmd\XeTeX\ macro to typeset the \XeTeX\ logo. While this package was
+% previously recommended, it serves a much smaller r\^ole nowadays and generally
+% will not be required.
%
% \paragraph{\LuaTeX\ users only}
-% In order to load fonts by their name rather than by their filename (\eg, `Latin Modern Roman' instead of `ec-lmr10'), you may need to run the script \texttt{mkluatexfontdb}, which is distributed with the \pkg{luaotfload} package. Note that if you do not execute this script beforehand, the first time you attempt to typeset the process will pause for (up to) several minutes. (But only the first time.)
+% In order to load fonts by their name rather than by their filename (\eg,
+% `Latin Modern Roman' instead of `ec-lmr10'), you may need to run the script
+% \texttt{mkluatexfontdb}, which is distributed with the \pkg{luaotfload}
+% package. Note that if you do not execute this script beforehand, the first
+% time you attempt to typeset the process will pause for (up to) several
+% minutes. (But only the first time.)
% Please see the \pkg{luaotfload} documentation for more information.
-% Note that the \pkg{xunicode} package is not required as it has been
-% incorporated directly into the Unicode font definitions (see the \pkg{euenc} package for more information).
%
% \paragraph{\pkg{babel}}
% \emph{The \pkg{babel} package is not really supported!} Especially Vietnamese,
@@ -441,7 +452,21 @@ This work consists of this file fontspec.dtx
% \fancy where is all the vegemite
% % \emph, \textbf, etc., all don't work
% \end{Xexample}
-
+%
+% Comment for advanced users:
+% The commands defined by \cs{newfontface} and \cs{newfontfamily} include
+% their encoding information, so even if the document is set to use a
+% legacy \TeX\ encoding, such commands will still work correctly. For example,
+% \begin{verbatim}
+% \documentclass{article}
+% \usepackage{fontspec}
+% \newfontfamily\unicodefont{Lucida Grande}
+% \usepackage{mathpazo}
+% \usepackage[T1]{fontenc}
+% \begin{document}
+% A legacy \TeX\ font. {\unicodefont A unicode font.}
+% \end{document}
+% \end{verbatim}
%
% \subsection{More control over font shape selection}
% \label{sec:bfitfonts}
@@ -512,10 +537,21 @@ This work consists of this file fontspec.dtx
% ]{Minion MM Roman}
% Roman 123 \\ \textsc{Small caps 456}
% \end{Verbatim}
-% For most modern fonts that have small caps as a font feature, this level of control isn't generally necessary, but you may still occasionally find font families in which the small caps are in a separate font.
+% For most modern fonts that have small caps as a font feature, this level of
+% control isn't generally necessary, but you may still occasionally find font
+% families in which the small caps are in a separate font.
%
% All of the bold, italic, and small caps fonts can be loaded with different
% font features from the main font. See \ref{sec:bfit-feat} for details.
+% When an OpenType font is selected for |SmallCapsFont|, the small caps
+% font feature is \emph{not} automatically enabled. In this case, users
+% should write instead
+% \begin{Verbatim}
+% \fontspec[
+% SmallCapsFont={...},
+% SmallCapsFeatures={Letters=SmallCaps},
+% ]{...}
+% \end{Verbatim}
%
% \subsection{Math(s) fonts}
%
@@ -802,11 +838,11 @@ This work consists of this file fontspec.dtx
%
% Features introduced in this section may be used with any font.
%
-% \subsection{Color}
+% \subsection{Colour}
%
% \feat{Color} (or \feat{Colour}), also shown in \vref{sec:defaults}
-% and elsewhere, uses font specifications to set the color of
-% the text. The color is defined as a triplet of two-digit Hex RGB
+% and elsewhere, uses font specifications to set the colour of
+% the text. The colour is defined as a triplet of two-digit Hex RGB
% values, with optionally another value for the transparency (where
% |00| is completely transparent and |FF| is opaque.)
% \begin{Xexample}{color}{Selecting colour with transparency.}
@@ -817,11 +853,11 @@ This work consists of this file fontspec.dtx
% {\addfontfeature{Color=DDBB2299}P}\kern-0.8ex
% {\addfontfeature{Color=00BB3399}R}
% \end{Xexample}
-% Transparency is supported by \XeLaTeX\ with Lua\LaTeX and with the \texttt{xdv2pdf}
+% Transparency is supported by \LuaLaTeX and by \XeLaTeX\ with the \texttt{xdv2pdf}
% driver (\MacOSX\ only); \XeLaTeX\ with the \texttt{xdvipdfmx} driver
-% is not supported.
+% does not support this feature.
%
-% If you load the \pkg{xcolor} package, you may use any named color instead
+% If you load the \pkg{xcolor} package, you may use any named colour instead
% of writing the colours in hexadecimal.
% \begin{Verbatim}
% \usepackage{xcolor}
@@ -832,12 +868,11 @@ This work consists of this file fontspec.dtx
% \end{Verbatim}
% The \pkg{color} package is \emph{not} supported; use \pkg{xcolor} instead.
%
-% You may specify the transparency with a named font using the \feat{Opacity}
+% You may specify the transparency with a named colour using the \feat{Opacity}
% feature:
% \begin{Verbatim}
% \fontspec[Color=red,Opacity=0.7]{Verdana} ...
% \end{Verbatim}
-% The \feat{Opacity} feature may only be used in conjunction with the \feat{Color} feature; it will be silently ignored if it appears by itself.
%
% \subsection{Scale}
%
@@ -1034,7 +1069,7 @@ This work consists of this file fontspec.dtx
% If a user tags some text as being in Icelandic, Junicode will automatically change to the Icelandic shape through an OpenType feature that localizes the shapes of letters.
%
% A very large group of OpenType features is designed to support high quality typography in Latin, Greek, Cyrillic and other standard scripts.
-% Examples of some font features have already been shown in previous sections; the complete set of OpenType font features supported by \pkg{fontspec} is described below in \ref{sec:otf-feat}.
+% Examples of some font features have already been shown in previous sections; the complete set of OpenType font features supported by \pkg{fontspec} is described below in \ref{sec:ot-feat}.
%
% The OpenType specification provides four-letter codes (e.g., \texttt{smcp} for small capitals) for each feature. The four-letter codes are given below along with the \pkg{fontspec} names for various features, for the benefit of people who are already familiar with OpenType. You can ignore the codes if they don't mean anything to you.
%
@@ -1646,7 +1681,7 @@ This work consists of this file fontspec.dtx
% \DescribeMacro{\newfontlanguage}
% While the scripts and languages listed in \ref{tab:ot-scpt} and \ref{tab:ot-lang}
% are intended to be comprehensive, there may be some missing; alternatively,
-% you might wish to different names to access scripts/languages that are
+% you might wish to use different names to access scripts/languages that are
% already listed.
% Adding scripts and languages can be performed with the \cmd\newfontscript\
% and \cmd\newfontlanguage\ commands. For example,
@@ -1705,7 +1740,7 @@ This work consists of this file fontspec.dtx
% Feature files can be used to add or customise OpenType features of a font on
% the fly without editing the font file itself.
%
-% A feature file is loading by passing its name or path to \feat{FeatureFile};
+% A feature file is loaded by passing its name or path to \feat{FeatureFile};
% OpenType features defined in the file can be then be applied as usual to the font.
%
% For example, to add OpenType mapping of f-ligatures in the Times New Roman
@@ -2157,7 +2192,7 @@ This work consists of this file fontspec.dtx
% \DescribeMacro{\newopentypefeature}
% New OpenType features may be created with this command:\par
% {\centering\cmd\newICUfeature\marg{feature}\marg{option}\marg{feature tag}\par}
-% The synonym \cs{newopentypefeature} is provided for Lua\LaTeX\ users.
+% The synonym \cs{newopentypefeature} is provided for \LuaLaTeX\ users.
%
% Here's what it would look like in practise:
% \begin{Verbatim}
@@ -2662,6 +2697,24 @@ This work consists of this file fontspec.dtx
{
Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information.
}
+\msg_new:nnn {fontspec} {opa-twice}
+{
+ Opacity~ set~ twice,~ in~ both~ Colour~ and~ Opacity.\\
+ Using~ specification~ "Opacity=#1".
+}
+\msg_new:nnn {fontspec} {opa-twice-col}
+{
+ Opacity~ set~ twice,~ in~ both~ Opacity~ and~ Colour.\\
+ Using~ an~ opacity~ specification~ in~ hex~ of~ "#1/FF".
+}
+\msg_new:nnn {fontspec} {bad-colour}
+{
+ Bad~ colour~ declaration~ "#1".~
+ Colour~ must~ be~ one~ of:\\
+ *~ a~ named~ xcolor~ colour\\
+ *~ a~ six-digit~ hex~ colour~ RRGGBB\\
+ *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity
+}
% \end{macrocode}
%
% \subsection{Option processing}
@@ -2728,6 +2781,22 @@ This work consists of this file fontspec.dtx
% Something to do with \cmd\select@language\ ending up in the \texttt{.aux}
% file which is read at the beginning of the document.
%
+% \paragraph{xunicode}
+% Now we load \pkg{xunicode}, working around its internal \XeTeX\ check
+% when under \LuaTeX.
+% \begin{macrocode}
+\xetex_or_luatex:nn
+{
+ \RequirePackage{xunicode}
+}
+{
+ \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
+ \cs_set:Npn \XeTeXpicfile {}
+ \RequirePackage{xunicode}
+ \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
+}
+% \end{macrocode}
+%
%
% \subsection{User commands}\label{sec:codeuser}
% This section contains the definitions of the commands detailed in
@@ -2746,6 +2815,7 @@ This work consists of this file fontspec.dtx
% family is selected.
% \begin{macrocode}
\DeclareDocumentCommand \fontspec { O{} m } {
+ \fontencoding {\zf@enc}
\fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
@@ -2843,6 +2913,7 @@ This work consists of this file fontspec.dtx
\fontspec_select:nn{#2}{#3}
\use:x {
\exp_not:N \DeclareRobustCommand \exp_not:N #1 {
+ \exp_not:N \fontencoding {\zf@enc}
\exp_not:N \fontfamily {\zf@family} \exp_not:N \selectfont
}
}
@@ -3075,7 +3146,7 @@ This work consists of this file fontspec.dtx
%
% All functions are defined assuming that the font to be queried is
% currently selected as a fontspec font. (I.e., via \verb|\fontspec| or
-% from a \verb|\newfontfamily| macro or from \verb|\setmainfont| and so on.)
+% from a \verb|\newfontfamily| macro or from \verb|\setmainfont| and so on.)
%
% \begin{macro}{\fontspec_if_fontspec_font:TF}
% Test whether the currently selected font has been loaded by fontspec.
@@ -3097,7 +3168,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\use:c{zf@family@fontdef\f@family}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
\ifzf@atsui
\fontspec_make_AAT_feature_string:nn{#1}{#2}
\ifx\@tempa\@empty
@@ -3122,7 +3193,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\prg_return_true:
@@ -3144,7 +3215,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\int_set:Nn \c@zf@script
@@ -3171,7 +3242,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax
@@ -3195,7 +3266,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
@@ -3217,7 +3288,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl}
@@ -3242,7 +3313,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nn \l_fontspec_script_tl {#1}
@@ -3265,7 +3336,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl}
@@ -3286,7 +3357,7 @@ This work consists of this file fontspec.dtx
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl}
@@ -3330,6 +3401,25 @@ This work consists of this file fontspec.dtx
% \end{macro}
%
%
+% \subsection{expl3 interface for font loading}
+%
+% Using |\font\1={xyz}| notation doesn't work at present with LuaLaTeX,
+% although it should be the correct way to do things. Continue to use
+% |\font\1="xyz"| for now for both engines.
+% \begin{macrocode}
+\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} }
+\cs_set:Npn \fontspec_fontwrap:n #1 { "#1" }
+% \end{macrocode}
+%
+% Beginnings of an `l3font', I guess:
+% \begin{macrocode}
+\cs_new:Npn \font_set:Nnn #1#2#3 {
+ \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
+\cs_new:Npn \font_gset:Nnn #1#2#3 {
+ \global \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
+% \end{macrocode}
%
%
% \subsection{Internal macros}
@@ -3438,9 +3528,9 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% Finally save the `confirmed' font definition.
% \begin{macrocode}
- \font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\fontspec_set_font_type:
- \global\font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\zf@basefont % this is necessary for LuaLaTeX to check the scripts properly
}
% \end{macrocode}
@@ -3485,21 +3575,20 @@ This work consists of this file fontspec.dtx
% The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped.
% \begin{macrocode}
\prg_new_conditional:Nnn \fontspec_save_family:n {T} {
- \unless\ifcsname zf@UID@\zf@family@long\endcsname
- \ifcsname c@zf@famc@#1\endcsname
- \expandafter\global\expandafter\advance
- \csname c@zf@famc@#1\endcsname\@ne
- \else
- \expandafter\global\expandafter\newcount
- \csname c@zf@famc@#1\endcsname
- \fi
+ \cs_if_exist:cF {g_fontspec_UID_\zf@family@long}
+ {
+ \cs_if_exist:cTF {g_fontspec_family_#1_int} {
+ \int_gincr:c {g_fontspec_family_#1_int}
+ }{
+ \int_new:c {g_fontspec_family_#1_int}
+ }
\edef\@tempa{#1~}
- \cs_gset:cpx{zf@UID@\zf@family@long}{
+ \tl_gset:cx {g_fontspec_UID_\zf@family@long} {
\expandafter\zap@space\@tempa\@empty
- (\expandafter\the\csname c@zf@famc@#1\endcsname)
+ ( \int_use:c {g_fontspec_family_#1_int} )
}
- \fi
- \xdef\zf@family{\@nameuse{zf@UID@\zf@family@long}}
+ }
+ \tl_gset:Nv \zf@family {g_fontspec_UID_\zf@family@long}
\cs_if_exist:cTF {zf@family@fontname\zf@family}
\prg_return_false: \prg_return_true:
}
@@ -3747,10 +3836,10 @@ This work consists of this file fontspec.dtx
\begingroup
\edef\@tempa{#1}
\unless\ifx\@tempa\@empty
- \font\@tempfonta="\fontspec_fullname:n {#1}"~at~\f@size pt
+ \font_set:Nnn \@tempfonta {\fontspec_fullname:n {#1}} {\f@size pt}
\edef\@tempa{\fontname\@tempfonta}
\fi
- \font\@tempfontb="\fontspec_fullname:n {#1#2}"~at~\f@size pt
+ \font_set:Nnn \@tempfontb {\fontspec_fullname:n {#1#2}} {\f@size pt}
\edef\@tempb{\fontname\@tempfontb}
\ifx\@tempa\@tempb
\fontspec_info:nx {no-font-shape} {#1#2}
@@ -3800,9 +3889,11 @@ This work consists of this file fontspec.dtx
{
\fontspec_get_features:n{#4}
\tl_set:Nx \l_fontspec_nfss_tl {
- <-> \l_fontspec_scale_tl "
- \fontspec_fullname:n {\zf@fontname} :
- \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ <-> \l_fontspec_scale_tl
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n {\zf@fontname} :
+ \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
% \end{macrocode}
@@ -3821,8 +3912,10 @@ This work consists of this file fontspec.dtx
\fontspec_get_features:n{#4,\XKV@rm}
\tl_put_right:Nx \l_fontspec_nfss_tl {
<\l_fontspec_size_tl> \l_fontspec_scale_tl
- " \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
- : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
+ : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
}
@@ -3910,6 +4003,8 @@ This work consists of this file fontspec.dtx
\cs_set:Npn \fontspec_get_features:n #1 {
\let\l_fontspec_rawfeatures_sclist \@empty
\tl_clear:N \l_fontspec_scale_tl
+ \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl
\let\zf@adjust \@empty
\fontspec_setkeys:xx {options} {#1}
\tl_if_empty:NF \XKV@rm {
@@ -3918,9 +4013,7 @@ This work consists of this file fontspec.dtx
% \end{macrocode}
% Finish the colour specification:
% \begin{macrocode}
- \cs_if_exist:NT \l_fontspec_hexcol_tl {
- \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
- }
+ \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
}
% \end{macrocode}
% \end{macro}
@@ -3949,7 +4042,8 @@ This work consists of this file fontspec.dtx
\tl_clear:N \l_fontspec_lang_name_tl
\tl_clear:N \l_fontspec_lang_tl
\clist_clear:N \l_fontspec_sizefeat_clist
-\tl_set:Nn \l_fontspec_opacity_tl {FF}
+\tl_new:Nn \g_fontspec_hexcol_tl {000000}
+\tl_new:Nn \g_fontspec_opacity_tl {FF~}
% \end{macrocode}
% Or once per fontspec font invocation:
% (Some of these may be redundant.
@@ -4725,9 +4819,29 @@ This work consists of this file fontspec.dtx
\convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
}
{
- \tl_set:Nn \l_fontspec_hexcol_tl {#1}
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 }
+ { \tl_set:Nn \l_fontspec_hexcol_tl {#1} }
+ {
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 8 }
+ { \fontspec_parse_colour:viii #1 }
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {bad-colour} {#1}
+ \fi
+ }
+ }
}
}
+\cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 {
+ \tl_set:Nn \l_fontspec_hexcol_tl {#1#2#3#4#5#6}
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice-col} {#7#8}
+ \fi
+ }
+ \tl_set:Nn \l_fontspec_opacity_tl {#7#8}
+}
\keyval@alias@key[zf]{options}{Color}{Colour}
% \end{macrocode}
% \begin{macrocode}
@@ -4735,9 +4849,14 @@ This work consists of this file fontspec.dtx
\define@key[zf]{options}{Opacity}{
\zf@update@family{+opac:#1}
\setcounter {fontspec_tmp_int} { 255*\real{#1} }
- \tl_set:Nx \l_fontspec_opacity_tl {
- \nhex2 { \value{fontspec_tmp_int} }
- }
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice} {#1}
+ \fi
+ }
+ \tl_set:Nx \l_fontspec_opacity_tl
+ { \nhex2 { \value{fontspec_tmp_int} } }
}
% \end{macrocode}
%
@@ -5895,7 +6014,10 @@ end
% \begin{macrocode}
\DeclareRobustCommand \em {
\@nomath\em
- \tl_if_eq:xxTF \f@shape \itdefault \eminnershape \emshape
+ \tl_if_eq:xxTF \f@shape \itdefault \eminnershape
+ {
+ \tl_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape
+ }
}
\DeclareTextFontCommand{\emph}{\em}
\let\emshape\itshape
@@ -6053,18 +6175,16 @@ end
%<*cfg>
% \fi
%
-% As an example, and to avoid upsetting people as much as possible,
-% I'm populating the default \texttt{fontspec.cfg} file with
-% backwards compatibility feature aliases.
% \begin{macrocode}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%%
-% Nothing here!
-% I have absolutely no idea whether backwards compatibility,
-% of the sort that was previously populated here, is important
-% for version 2.
+% Please note that most of the entries here from fontspec v1.x are
+% no longer present. Please advise of any serious problems this causes.
+
+\aliasfontfeatureoption{Ligatures}{Historic}{Historical}
+\let\newfontinstance\newfontfamily
% \end{macrocode}
%
@@ -6085,20 +6205,14 @@ end
%<*example>
%
% \begin{macrocode}
-%<luatex>% !TEX TS-program = LuaLaTeX
-%<xetex>% !TEX TS-program = XeLaTeX
-
\documentclass{article}
-%<luatex>\usepackage{fontspec}
-%<xetex>\usepackage{xltxtra}
+\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Pagella}
\setsansfont[Ligatures=TeX,Scale=MatchLowercase]{TeX Gyre Heros}
\setmonofont[Scale=MatchLowercase]{Inconsolata}
-\frenchspacing % TeX's default is a little old-fashioned...
-
\begin{document}
\pagestyle{empty}
@@ -6223,6 +6337,7 @@ If you want to run just a single test, use
\newcommand\XeTeX{\hologo{XeTeX}}
\newcommand\XeLaTeX{\hologo{XeLaTeX}}
\newcommand\LuaTeX{\hologo{LuaTeX}}
+\newcommand\LuaLaTeX{\hologo{LuaLaTeX}}
\usepackage{tgpagella,eulervm}
\usepackage{inconsolata}
\usepackage[
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
index 0b3bac075ee..67e9a2675ba 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty
@@ -14,15 +14,17 @@
%%
%%
\ProvidesPackage{fontspec-patches}
- [2010/08/01 v2.0c Advanced font selection for XeLaTeX/LuaLaTeX]
-
+ [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX]
\ExplSyntaxOn
\RequirePackage{fixltx2e}[2006/03/24]
\DeclareRobustCommand \em {
\@nomath\em
- \tl_if_eq:xxTF \f@shape \itdefault \eminnershape \emshape
+ \tl_if_eq:xxTF \f@shape \itdefault \eminnershape
+ {
+ \tl_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape
+ }
}
\DeclareTextFontCommand{\emph}{\em}
\let\emshape\itshape
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
index bae05d1c630..95111cba254 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.cfg
@@ -1,8 +1,10 @@
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% FOR BACKWARDS COMPATIBILITY WITH PREVIOUS VERSIONS %%%
+\aliasfontfeatureoption{Ligatures}{Historic}{Historical}
+\let\newfontinstance\newfontfamily
+
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
index 8303421e1c0..34904eb5030 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua
@@ -15,7 +15,6 @@
--
-
fontspec = { }
fontspec.module = {
diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
index a0c8c5684db..2820cfd99a2 100644
--- a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
+++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty
@@ -14,8 +14,7 @@
%%
%%
\ProvidesPackage{fontspec}
- [2010/08/01 v2.0c Advanced font selection for XeLaTeX/LuaLaTeX]
-
+ [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX]
\RequirePackage{expl3,xparse}
@@ -225,6 +224,24 @@
{
Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information.
}
+\msg_new:nnn {fontspec} {opa-twice}
+{
+ Opacity~ set~ twice,~ in~ both~ Colour~ and~ Opacity.\\
+ Using~ specification~ "Opacity=#1".
+}
+\msg_new:nnn {fontspec} {opa-twice-col}
+{
+ Opacity~ set~ twice,~ in~ both~ Opacity~ and~ Colour.\\
+ Using~ an~ opacity~ specification~ in~ hex~ of~ "#1/FF".
+}
+\msg_new:nnn {fontspec} {bad-colour}
+{
+ Bad~ colour~ declaration~ "#1".~
+ Colour~ must~ be~ one~ of:\\
+ *~ a~ named~ xcolor~ colour\\
+ *~ a~ six-digit~ hex~ colour~ RRGGBB\\
+ *~ an~ eight-digit~ hex~ colour~ RRGGBBTT~ with~ opacity
+}
\DeclareOption{cm-default}{
\fontspec_warning:n {cm-default-obsolete}
}
@@ -257,7 +274,18 @@
\tl_set_eq:NN \cyrillicencoding \zf@enc
\tl_set_eq:NN \latinencoding \zf@enc
}
+\xetex_or_luatex:nn
+{
+ \RequirePackage{xunicode}
+}
+{
+ \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile
+ \cs_set:Npn \XeTeXpicfile {}
+ \RequirePackage{xunicode}
+ \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp:
+}
\DeclareDocumentCommand \fontspec { O{} m } {
+ \fontencoding {\zf@enc}
\fontspec_set_family:Nnn \f@family {#1}{#2}
\selectfont
\ignorespaces
@@ -298,6 +326,7 @@
\fontspec_select:nn{#2}{#3}
\use:x {
\exp_not:N \DeclareRobustCommand \exp_not:N #1 {
+ \exp_not:N \fontencoding {\zf@enc}
\exp_not:N \fontfamily {\zf@family} \exp_not:N \selectfont
}
}
@@ -403,7 +432,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\use:c{zf@family@fontdef\f@family}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt}
\ifzf@atsui
\fontspec_make_AAT_feature_string:nn{#1}{#2}
\ifx\@tempa\@empty
@@ -420,7 +449,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\prg_return_true:
@@ -433,7 +462,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\int_set:Nn \c@zf@script
@@ -452,7 +481,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax
@@ -467,7 +496,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false:
@@ -480,7 +509,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl}
@@ -496,7 +525,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_set:Nn \l_fontspec_script_tl {#1}
@@ -511,7 +540,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl}
@@ -525,7 +554,7 @@
}
\prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} {
\ifcsname zf@family@fontdef\f@family\endcsname
- \font\zf@basefont="\csname zf@family@fontdef\f@family\endcsname"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt}
\fontspec_set_font_type:
\ifzf@icu
\tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl}
@@ -542,6 +571,14 @@
\fontspec_select:nn {#2}{#3}
\tl_set_eq:NN #1 \zf@family
}
+\xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} }
+\cs_set:Npn \fontspec_fontwrap:n #1 { "#1" }
+\cs_new:Npn \font_set:Nnn #1#2#3 {
+ \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
+\cs_new:Npn \font_gset:Nnn #1#2#3 {
+ \global \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop:
+}
\cs_set:Npn \fontspec_select:nn #1#2 {
\begingroup
\fontspec_init:
@@ -573,9 +610,9 @@
\let\zf@fontname\zf@up
\fontspec_setkeys:xx {preparse} {\XKV@rm}
\let\zf@font@feat\XKV@rm
- \font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\fontspec_set_font_type:
- \global\font\zf@basefont="\fontspec_fullname:n {\zf@up}"~at~\f@size pt
+ \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt}
\zf@basefont % this is necessary for LuaLaTeX to check the scripts properly
}
\prg_new_conditional:Nnn \fontspec_if_detect_external:n {T}
@@ -595,21 +632,20 @@
}
%% Now we have a unique (in fact, too unique!) string that contains
\prg_new_conditional:Nnn \fontspec_save_family:n {T} {
- \unless\ifcsname zf@UID@\zf@family@long\endcsname
- \ifcsname c@zf@famc@#1\endcsname
- \expandafter\global\expandafter\advance
- \csname c@zf@famc@#1\endcsname\@ne
- \else
- \expandafter\global\expandafter\newcount
- \csname c@zf@famc@#1\endcsname
- \fi
+ \cs_if_exist:cF {g_fontspec_UID_\zf@family@long}
+ {
+ \cs_if_exist:cTF {g_fontspec_family_#1_int} {
+ \int_gincr:c {g_fontspec_family_#1_int}
+ }{
+ \int_new:c {g_fontspec_family_#1_int}
+ }
\edef\@tempa{#1~}
- \cs_gset:cpx{zf@UID@\zf@family@long}{
+ \tl_gset:cx {g_fontspec_UID_\zf@family@long} {
\expandafter\zap@space\@tempa\@empty
- (\expandafter\the\csname c@zf@famc@#1\endcsname)
+ ( \int_use:c {g_fontspec_family_#1_int} )
}
- \fi
- \xdef\zf@family{\@nameuse{zf@UID@\zf@family@long}}
+ }
+ \tl_gset:Nv \zf@family {g_fontspec_UID_\zf@family@long}
\cs_if_exist:cTF {zf@family@fontname\zf@family}
\prg_return_false: \prg_return_true:
}
@@ -747,10 +783,10 @@
\begingroup
\edef\@tempa{#1}
\unless\ifx\@tempa\@empty
- \font\@tempfonta="\fontspec_fullname:n {#1}"~at~\f@size pt
+ \font_set:Nnn \@tempfonta {\fontspec_fullname:n {#1}} {\f@size pt}
\edef\@tempa{\fontname\@tempfonta}
\fi
- \font\@tempfontb="\fontspec_fullname:n {#1#2}"~at~\f@size pt
+ \font_set:Nnn \@tempfontb {\fontspec_fullname:n {#1#2}} {\f@size pt}
\edef\@tempb{\fontname\@tempfontb}
\ifx\@tempa\@tempb
\fontspec_info:nx {no-font-shape} {#1#2}
@@ -779,9 +815,11 @@
{
\fontspec_get_features:n{#4}
\tl_set:Nx \l_fontspec_nfss_tl {
- <-> \l_fontspec_scale_tl "
- \fontspec_fullname:n {\zf@fontname} :
- \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ <-> \l_fontspec_scale_tl
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n {\zf@fontname} :
+ \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
{
@@ -794,8 +832,10 @@
\fontspec_get_features:n{#4,\XKV@rm}
\tl_put_right:Nx \l_fontspec_nfss_tl {
<\l_fontspec_size_tl> \l_fontspec_scale_tl
- " \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
- : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 "
+ \fontspec_fontwrap:n {
+ \fontspec_fullname:n { \l_fontspec_sizedfont_tl }
+ : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1
+ }
}
}
}
@@ -841,14 +881,14 @@
\cs_set:Npn \fontspec_get_features:n #1 {
\let\l_fontspec_rawfeatures_sclist \@empty
\tl_clear:N \l_fontspec_scale_tl
+ \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl
\let\zf@adjust \@empty
\fontspec_setkeys:xx {options} {#1}
\tl_if_empty:NF \XKV@rm {
\fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm }
}
- \cs_if_exist:NT \l_fontspec_hexcol_tl {
- \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
- }
+ \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl}
}
\tl_clear:N \zf@bf
\tl_clear:N \zf@it
@@ -870,7 +910,8 @@
\tl_clear:N \l_fontspec_lang_name_tl
\tl_clear:N \l_fontspec_lang_tl
\clist_clear:N \l_fontspec_sizefeat_clist
-\tl_set:Nn \l_fontspec_opacity_tl {FF}
+\tl_new:Nn \g_fontspec_hexcol_tl {000000}
+\tl_new:Nn \g_fontspec_opacity_tl {FF~}
\newcommand*\fontspec_init:{
\zf@icufalse
\zf@firsttimetrue
@@ -1334,17 +1375,42 @@
\convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl
}
{
- \tl_set:Nn \l_fontspec_hexcol_tl {#1}
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 }
+ { \tl_set:Nn \l_fontspec_hexcol_tl {#1} }
+ {
+ \intexpr_compare:nTF { \tl_elt_count:n {#1} == 8 }
+ { \fontspec_parse_colour:viii #1 }
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {bad-colour} {#1}
+ \fi
+ }
+ }
}
}
+\cs_set:Npn \fontspec_parse_colour:viii #1#2#3#4#5#6#7#8 {
+ \tl_set:Nn \l_fontspec_hexcol_tl {#1#2#3#4#5#6}
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice-col} {#7#8}
+ \fi
+ }
+ \tl_set:Nn \l_fontspec_opacity_tl {#7#8}
+}
\keyval@alias@key[zf]{options}{Color}{Colour}
\newcounter{fontspec_tmp_int}
\define@key[zf]{options}{Opacity}{
\zf@update@family{+opac:#1}
\setcounter {fontspec_tmp_int} { 255*\real{#1} }
- \tl_set:Nx \l_fontspec_opacity_tl {
- \nhex2 { \value{fontspec_tmp_int} }
- }
+ \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl
+ {
+ \ifzf@firsttime\else
+ \fontspec_warning:nx {opa-twice} {#1}
+ \fi
+ }
+ \tl_set:Nx \l_fontspec_opacity_tl
+ { \nhex2 { \value{fontspec_tmp_int} } }
}
\xetex_or_luatex:nnn {
\define@key[zf]{options}{Mapping}