diff options
author | Karl Berry <karl@freefriends.org> | 2010-11-07 23:46:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-11-07 23:46:37 +0000 |
commit | 9e8226cf8fa5064b6ad05024b81992bab84a2b20 (patch) | |
tree | 434c70827da491ac26b4f13cee656d1659ee9ecd | |
parent | 22a34b48cbe27e4f449105b3efe4815e96b48868 (diff) |
fontspec 2.1d (7nov10)
git-svn-id: svn://tug.org/texlive/trunk@20356 c570f23f-e606-0410-a88d-b1316a301751
12 files changed, 847 insertions, 550 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README index d9d05c09bc7..b5eef754d88 100644 --- a/Master/texmf-dist/doc/latex/fontspec/README +++ b/Master/texmf-dist/doc/latex/fontspec/README @@ -85,65 +85,22 @@ Features can be renamed and feature options can be renamed with -Installation ------------- - -If you are running TeX Live 2010, you can get the latest version -of this package by running - - tlmgr install fontspec - - * * * - -If you wish to download the latest release version from CTAN, get -the pre-built TDS package and extract it into your local texmf tree: - - http://mirror.ctan.org/install/macros/latex/contrib/fontspec.tds.zip - - * * * - -If you wish to use the latest development version from Github, -either use git to obtain the bleeding edge version with - - git clone git://github.com/wspr/fontspec.git - -or if you don't have git you can download it from - - http://github.com/wspr/fontspec/zipball/master - -Having obtained the package from Github, run - - tex fontspec.dtx - -to extract the source then and move the necessary files into your -local texmf tree. The documentation can be compiled by running - - pdflatex fontspec.dtx - -These steps are automated in the Makefile; run - - make install - -to compile the documentation and install all necessary files in your -local texmf tree. Depending how your TeX distribution is configured -you may then need to update the filename database with `texhash`. - - -Test suite ----------- - -Towards the end of the development process of version 2, we started -to add a test suite to ensure stability with any future changes. The -output of each test is included in the distributed documentation file -`fontspec-testsuite.pdf`. +Change history +-------------- -There aren't many tests yet, but we'll slowly add to them in time. -If you would like to help put some tests together, contributions are -gladly accepted! +- v2.1d (2010/11/07) + * Bug fix when \itdefault is "sl" rather than "it". + E.g., when using the "slides" class. + * Minor internal changes, including merging some code from unicode-math. +- v2.1c (2010/10/13) -Change history --------------- + * New documentation for defining custom kerning and ligatures + when using LuaLaTeX. + * Fix bug when defining bold italic fonts by filename. + * Avoid infinite loop when the Latin script is requested for a font + that does not contain it. TODO: a suitable fallback script should be + chosen; right now we just ignore the script selection. - v2.1b (2010/09/29) @@ -208,6 +165,64 @@ Change history `FeatureFile=...` and `Numbers=Arabic`. * Add `Parsi` and `Persian` synonyms for `Language=Farsi` + +Installation +------------ + +If you are running TeX Live 2010, you can get the latest version +of this package by running + + tlmgr install fontspec + + * * * + +If you wish to download the latest release version from CTAN, get +the pre-built TDS package and extract it into your local texmf tree: + + http://mirror.ctan.org/install/macros/latex/contrib/fontspec.tds.zip + + * * * + +If you wish to use the latest development version from Github, +either use git to obtain the bleeding edge version with + + git clone git://github.com/wspr/fontspec.git + +or if you don't have git you can download it from + + http://github.com/wspr/fontspec/zipball/master + +Having obtained the package from Github, run + + tex fontspec.dtx + +to extract the source then and move the necessary files into your +local texmf tree. The documentation can be compiled by running + + pdflatex fontspec.dtx + +These steps are automated in the Makefile; run + + make install + +to compile the documentation and install all necessary files in your +local texmf tree. Depending how your TeX distribution is configured +you may then need to update the filename database with `texhash`. + + +Test suite +---------- + +Towards the end of the development process of version 2, we started +to add a test suite to ensure stability with any future changes. The +output of each test is included in the distributed documentation file +`fontspec-testsuite.pdf`. + +There aren't many tests yet, but we'll slowly add to them in time. +If you would like to help put some tests together, contributions are +gladly accepted! + + Manifest -------- diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf Binary files differindex 5407fda0c1a..333e2e5f452 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec-testsuite.pdf diff --git a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf Binary files differindex f6c5b2d561f..b0963a2faad 100644 --- a/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf +++ b/Master/texmf-dist/doc/latex/fontspec/fontspec.pdf diff --git a/Master/texmf-dist/source/latex/fontspec/Makefile b/Master/texmf-dist/source/latex/fontspec/Makefile index 606da5ca8e2..d45e10b100c 100644 --- a/Master/texmf-dist/source/latex/fontspec/Makefile +++ b/Master/texmf-dist/source/latex/fontspec/Makefile @@ -45,9 +45,10 @@ UNPACKED = fontspec.sty fontspec-patches.sty fontspec.lua fontspec.cfg $(EXAMPLE SOURCE = $(DTX) Makefile README GENERATED = $(COMPILED) $(UNPACKED) -TESTS = $(shell ls testsuite/*.cls testsuite/*.tex testsuite/*.ltx) +TESTS = $(wildcard testsuite/*.cls testsuite/*.tex testsuite/*.ltx) -DOC_EXAMPLES = $(shell ls doc/*.pdf) +DOC_DIR = doc-files +DOC_EXAMPLES = $(shell ls $(DOC_DIR)/*.pdf) CTAN_FILES = $(SOURCE) $(COMPILED) $(EXAMPLES) $(DOC_EXAMPLES) @@ -84,12 +85,16 @@ tds: $(TDS_ZIP) world: all ctan gendoc: $(DTX) + @mkdir -p $(DOC_DIR) $(DO_PDFLATEX_WRITE18) $(DOC): $(DTX) + @echo "Compiling documentation" $(DO_PDFLATEX) $(DO_MAKEINDEX) + @echo "Re-compiling documentation" $(DO_PDFLATEX) + @echo "Re-re-compiling documentation" $(DO_PDFLATEX) $(UNPACKED): $(DTX) @@ -171,9 +176,13 @@ SUITESOURCE = \ $(testdir)/testsuite.cls \ $(testdir)/$(TESTLIST) -TESTOUT = $(shell ls $(testdir)/*.*safe.pdf) +TESTOUT = $(wildcard $(testdir)/*.*safe.pdf) BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.ltx,$(TESTOUT))) -BUILDTESTTARGET = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.diff.pdf,$(TESTOUT))) +BUILDTESTTARGET1 = $(TESTOUT) +BUILDTESTTARGET2 = $(subst $(testdir)/,$(builddir)/,$(BUILDTESTTARGET1)) +BUILDTESTTARGET3 = $(subst .Xsafe.pdf,-X.diff.pdf,$(BUILDTESTTARGET2)) +BUILDTESTTARGET4 = $(subst .Lsafe.pdf,-L.diff.pdf,$(BUILDTESTTARGET3)) +BUILDTESTTARGET = $(BUILDTESTTARGET4) BUILDSOURCE = $(addprefix $(builddir)/,$(LTXSOURCE)) BUILDSUITE = $(subst $(testdir)/,$(builddir)/,$(SUITESOURCE)) @@ -241,7 +250,7 @@ $(builddir)/F%-L.diff.pdf: $(builddir)/F%-L.pdf fi $(builddir)/F%-X.diff.pdf: $(builddir)/F%-X.pdf - @echo 'F$*: Comparing PDF from LuaLaTeX against reference output.' + @echo 'F$*: Comparing PDF from XeLaTeX against reference output.' if test $(shell compare \ $(COMPARE_OPTS) \ $(builddir)/F$*-X.pdf \ @@ -312,4 +321,101 @@ X%: build/X%.ltx F%: build/F%.ltx make build/F$*-L.diff.pdf - make build/F$*-X.diff.pdf
\ No newline at end of file + make build/F$*-X.diff.pdf + + +###### NIGHTLY BUILDS ###### + +UNAME_S := $(shell uname -s) + +# Mac OS X: +ifeq ($(UNAME_S),Darwin) + MD5 = md5 +endif + +# Linux: +ifeq ($(UNAME_S),Linux) + MD5 = md5sum +endif + +BRANCH = tds-build + +TDS = $(TDS_ZIP) +TMP = /tmp +LOG = $(TMP)/gitlog.tmp + + +checkbranch: + @if git branch | grep $(BRANCH) > /dev/null ; \ + then echo "TDS branch exists"; \ + else \ + echo "TDS branch does not exist; doing so will remove all untracked files from your working directory. Create the TDS branch with\n make createbranch"; \ + false; \ + fi; + +createbranch: $(TDS) + cp -f $(TDS) $(TMP)/ + git symbolic-ref HEAD refs/heads/$(BRANCH) + rm .git/index + git clean -fdx + unzip -o $(TMP)/$(TDS) -d . + rm $(TMP)/$(TDS) + git add --all + git commit -m "Initial TDS commit" + git checkout master + git push origin $(BRANCH) master + @echo "\nTDS branch creation was successful.\n" + @echo "Now create a new package at TLContrib: http://tlcontrib.metatex.org/" + @echo "Use the following metadata:" + @echo " Package ID: $(NAME)" + @echo " BRANCH: $(BRANCH)" + @echo "\nAfter this process, use \`make tdsbuild\` to" + @echo " (a) push your recent work on the master branch," + @echo " (b) automatically create a TDS snapshot," + @echo " (c) send the TDS snapshot to TLContrib." + + +ifeq ($(UNAME_S),Darwin) + nightly: USERNAME = $(shell security find-internet-password -s tlcontrib.metatex.org | grep "acct" | cut -f 4 -d \") + nightly: PASSWORD = $(shell security 2>&1 >/dev/null find-internet-password -gs tlcontrib.metatex.org | cut -f 2 -d ' ') +endif + +ifeq ($(UNAME_S),Linux) + nightly: USERNAME = "" + nightly: PASSWORD = "" +endif + +nightly: VERSION = $(shell date "+%Y-%m-%d@%H:%M") + +nightly: CHECKSUM = $(shell echo $(USERNAME)/$(PASSWORD)/$(VERSION) | $(MD5) ) + +nightly: tdsbuild checkbranch checkpw + @echo "Pushing TDS and master branch" + git push origin $(BRANCH) master + @echo "Pinging TLContrib for automatic update" + curl http://tlcontrib.metatex.org/cgi-bin/package.cgi/action=notify/key=$(NAME)/check=$(CHECKSUM)?version=$(VERSION) > /dev/null 2>&1 + +tdsbuild: $(TDS) + cp -f $(TDS) $(TMP)/ + @echo "Constructing commit history for snapshot build" + date "+TDS snapshot %Y-%m-%d %H:%M" > $(LOG) + echo '\n\nApproximate commit history since last snapshot:\n' >> $(LOG) + git log --after="`git log -b $(BRANCH) -n 1 --pretty=format:"%aD"`" --pretty=format:"%+H%+s%+b" >> $(LOG) + @echo "Committing TDS snapshot to separate branch" + git checkout $(BRANCH) + unzip -o $(TMP)/$(TDS) -d . + rm $(TMP)/$(TDS) + git commit --all --file=$(LOG) + git checkout master + @echo "Branches 'master' and '$(BRANCH)' should now be pushed." + +checkpw: + @if test ! -n "$(PASSWORD)" ; then \ + echo "Error: Password cannot be found for TLContrib." ; \ + false ; \ + fi ; + @echo "Username: $(USERNAME)" + @echo "Password: [omitted]" + @echo "Version: $(VERSION)" + @echo "Checksum: $(CHECKSUM)" + diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index 068ceb64f38..ef3b45c4cc3 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -62,7 +62,7 @@ This work consists of this file fontspec.dtx %<fontspec>\ProvidesPackage{fontspec} %<patches>\ProvidesPackage{fontspec-patches} %<*fontspec|patches> - [2010/09/29 v2.1b Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/11/07 v2.1d Advanced font selection for XeLaTeX/LuaLaTeX] %</fontspec|patches> % %<*driver> @@ -138,7 +138,7 @@ This work consists of this file fontspec.dtx % % This document is typeset with pdf\LaTeX\ using pre-compiled examples % that have been generated by either \XeTeX\ or \LuaTeX. You may regenerate -% the examples by removing the \verb|doc/| subdirectory and typesetting the +% the examples by removing the \verb|doc-files/| subdirectory and typesetting the % manual with the following invocation: % \begin{verbatim} % pdflatex -shell-escape fontspec.dtx @@ -561,7 +561,7 @@ This work consists of this file fontspec.dtx % freezes the maths fonts after this stage of the processing. The \pkg{fontspec} % package must also be loaded after any maths font packages (\eg, \pkg{euler}) % to be successful. (Actually, it is \emph{only} \pkg{euler} that is the -% problem.\footnote{Speaking of \pkg{euler}, if you want to use its +% problem.\note{Speaking of \pkg{euler}, if you want to use its % \texttt{[mathbf]} option, it won't work, and you'll need to put this after % \pkg{fontspec} is loaded instead: % \ttfamily\cmd\AtBeginDocument\char`\{\cmd\DeclareMathAlphabet\cmd\mathbf\char`\{U\char`\}\char`\{eur\char`\}\char`\{b\char`\}\char`\{n\char`\}}) @@ -1100,7 +1100,7 @@ This work consists of this file fontspec.dtx % with a specially drawn glyph for functional or \ae sthetic reasons. % The list of options, of which multiple may be selected at one time, % is shown in \ref{feat:Ligatures}. -% A demonstration with the Linux Libertine fonts\footnote{\url{http://www.linuxlibertine.org/}} is shown in \exref{lig}. +% A demonstration with the Linux Libertine fonts\note{\url{http://www.linuxlibertine.org/}} is shown in \exref{lig}. % % Note the additional features accessed with \verb|Ligatures=TeX|. These are % not actually real OpenType features, but additions provided by \pkg{luaotfload} (i.e., \LuaTeX\ only) to emulate \TeX's behaviour for \textsc{ascii} input of curly quotes and punctuation. In \XeTeX\ this is achieved with the \feat{Mapping} feature (see \vref{sec:mapping}) but for consistency \verb|Ligatures=TeX| will perform the same function as \verb|Mapping=tex-text|. @@ -1211,7 +1211,7 @@ This work consists of this file fontspec.dtx % % The \opt{Arabic} option (with tag \verb|anum|) maps regular numerals to their Arabic script or Persian equivalents % based on the current \opt{Language} setting (see \vref{sec:ot}), shown in -% \exref{num-arab} using the Zar fonts\footnote{\url{http://wiki.irmug.org/index.php/X_Series_2}}. +% \exref{num-arab} using the Zar fonts\note{\url{http://wiki.irmug.org/index.php/X_Series_2}}. % This option is based on a \LuaTeX\ feature of the \pkg{luaotfload} package, % not an OpenType feature. (Thus, this feature is unavailable in \XeTeX.) % @@ -1322,7 +1322,7 @@ This work consists of this file fontspec.dtx % features |ss01|, |ss02|, etc. % % Two demonstrations from the Junicode -% font\footnote{\url{http://junicode.sf.net}} +% font\note{\url{http://junicode.sf.net}} % are shown in \exref{ss} and \exref{ss2}; thanks to Adam % Buchbinder for the suggestion. % @@ -1467,7 +1467,7 @@ This work consists of this file fontspec.dtx % \end{features} % % As briefly mentioned previously at the end of \vref{sec:letters}, -% the \opt{Uppercase} option will add a small amount of tracking between uppercase letters, seen in \exref{kernup}, which uses the Romande fonts\footnote{\url{http://arkandis.tuxfamily.org/adffonts.html}} (thanks to Clea F. Rees for the suggestion). +% the \opt{Uppercase} option will add a small amount of tracking between uppercase letters, seen in \exref{kernup}, which uses the Romande fonts\note{\url{http://arkandis.tuxfamily.org/adffonts.html}} (thanks to Clea F. Rees for the suggestion). % % \begin{Xexample}[firstline=2]{kernup}{Adding extra kerning for uppercase letters. (The difference is usually very small.)} % \large @@ -1637,7 +1637,7 @@ This work consists of this file fontspec.dtx % % \subsubsection{\feat{Script} and \feat{Language} examples} % -% In the following examples, the Code2000 font\footnote{\url{http://www.code2000.net/}} +% In the following examples, the Code2000 font\note{\url{http://www.code2000.net/}} % is used to typeset the input with and without the OpenType Script % applied. The text is only rendered correctly in the second case; % many examples of incorrect diacritic spacing as @@ -1734,42 +1734,71 @@ This work consists of this file fontspec.dtx % % An OpenType font feature file is a plain text file describing OpenType layout % feature of a font in a human-readable format. The syntax of OpenType feature -% files is defined by Adobe\footnote{\url{http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html}}. +% files is defined by Adobe\note{\url{http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html}}. % -% Feature files can be used to add or customise OpenType features of a font on +% Feature files can be used to add or customize OpenType features of a font on % the fly without editing the font file itself. % -% 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. +% Adding a new OpenType feature is as creating a plain text file defining +% the new feature and then loading it by passing its name or path to +% \feat{FeatureFile}, then OpenType features defined in the file can be +% activated as usual. +% +% For example, when adding one of the default features like \texttt{kern} +% or \texttt{liga}, no special activation is needed. On the other hand, +% an optional feature like \texttt{onum} or \texttt{smcp} will be +% activated when old style numbers or small capitals are activated, +% respectively. However, OpenType feature in the feature file can have any +% and that can be used to selectively activate the feature; for example +% defining a ligature feature called \texttt{mlig} and then activating it +% using \feat{RawFeature} option without activating other ligatures in the +% font. % -% For example, to add OpenType mapping of f-ligatures in the Times New Roman -% font, one can define a \texttt{times-nr.fea} file with content shown in -% Figure~\ref{fig:featurefile}. -% Then the font with the new ligatures can be loaded with: -% \begin{Verbatim} -% \setmainfont[FeatureFile=times-nr.fea]{Times New Roman} -% \end{Verbatim} +% Figure~\ref{fig:featurefile} shows an example feature file. The first two +% lines set the script and language under which the defined features will be +% available, which the default language in both default and Latin scripts, +% respectively. +% +% Then it defines a \texttt{liga} feature, which is a glyph substitution +% feature. The names starting with backslash are glyph names that is to be +% substituted and while the leading backslash is optional, it is used to +% escape glyph names when they interfere with preserved keywords. It should +% also be noted that glyph names are font specific and the same glyph can be +% named differently in different fonts. +% +% Glyph positioning features like kerning can be defined in a similar way, +% but instead of the keyword \texttt{sub(stitute)} the keyword +% \texttt{pos(ition)} is used instead. Figure~\ref{fig:featurefile} shows +% an example of adding kerning between \texttt{AY} and \texttt{ay}\note{ +% The kerning is expressed in font design units which are fractions of em +% depending on the \emph{units per em} value of the font, usually 1000 for +% PostScript fonts and 2048 for TrueType fonts.}. +% +% Lines starting with \verb|#| are comments and will be ignored. +% +% An OpenType feature file can have any number of features and can have a +% mix of substitution and positioning features, please refer to the full +% feature file specification for further documentation. % % \begin{figure} -% \caption{Addition of ligatures to a font via the \feat{FeatureFile} font feature.} +% \caption{An example font feature file.} % \label{fig:featurefile} % \hrule % \begin{Verbatim} -% lookup fligatures { -% lookupflag 0; -% sub \f \i by \fi; -% sub \f \l by \fl; -% } fligatures; +% languagesystem DFLT dflt; +% languagesystem latn dflt; % +% # Ligatures % feature liga { -% script DFLT; -% language dflt ; -% lookup fligatures; -% -% script latn; -% language dflt ; -% lookup fligatures; +% sub \f \i by \fi; +% sub \f \l by \fl; % } liga; +% +% # Kerning +% feature kern { +% pos \A \Y -200; +% pos \a \y -80; +% } kern; % \end{Verbatim} % \hrule % \end{figure} @@ -2446,7 +2475,7 @@ This work consists of this file fontspec.dtx \RequirePackage{luatextra}[2010/05/10] \luatexRequireModule{fontspec} }{ - \msg_error:nn {fontspec} {not-pdftex} + \msg_fatal:nn {fontspec} {not-pdftex} } } % \end{macrocode} @@ -2477,26 +2506,29 @@ This work consists of this file fontspec.dtx % \subsection{Bits and pieces} % \paragraph{Conditionals} % \begin{macrocode} -\newif\ifzf@firsttime -\newif\ifzf@nobf -\newif\ifzf@noit -\newif\ifzf@nosc -\newif\ifzf@tfm -\newif\ifzf@atsui -\newif\ifzf@icu -\newif\ifzf@mm -\newif\ifzf@graphite +\bool_new:N \l_fontspec_firsttime_bool +\bool_new:N \l_fontspec_nobf_bool +\bool_new:N \l_fontspec_noit_bool +\bool_new:N \l_fontspec_nosc_bool +% \end{macrocode} +% +% \begin{macrocode} +\bool_new:N \l_fontspec_tfm_bool +\bool_new:N \l_fontspec_atsui_bool +\bool_new:N \l_fontspec_icu_bool +\bool_new:N \l_fontspec_mm_bool +\bool_new:N \l_fontspec_graphite_bool % \end{macrocode} % For dealing with legacy maths % \begin{macrocode} -\newif\ifzf@math@euler -\newif\ifzf@math@lucida -\newif\ifzf@package@euler@loaded +\bool_new:N \g_fontspec_math_euler_bool +\bool_new:N \g_fontspec_math_lucida_bool +\bool_new:N \g_fontspec_package_euler_loaded_bool % \end{macrocode} % For package options: % \begin{macrocode} -\newif\if@zf@configfile -\newif\if@zf@math +\bool_new:N \g_fontspec_cfg_bool +\bool_new:N \g_fontspec_math_bool % \end{macrocode} % \paragraph{Counters} % \begin{macrocode} @@ -2623,11 +2655,15 @@ This work consists of this file fontspec.dtx { Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten. } -\msg_new:nnn {fontspec} {script-not-exist} +\msg_new:nnn {fontspec} {script-not-exist-latn} { Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ 'Latin'~ script~ used~ instead. } +\msg_new:nnn {fontspec} {script-not-exist} +{ + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'. +} \msg_new:nnn {fontspec} {aat-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ @@ -2686,7 +2722,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \msg_new:nnn {fontspec} {defining-font} { - Defining~ font~ family~ for~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. + Defining~ font~ family~'\zf@family'~ for~ font~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. } \msg_new:nnn {fontspec} {defining-raw} { @@ -2701,8 +2737,11 @@ This work consists of this file fontspec.dtx {\bfdefault/\itdefault} {bold~ italic} {\bfdefault/\sidefault} {bold~ italic~ small~ caps} } {#1}'~ - with~ NFSS~ specification: \\ + with~ NFSS~ spec.: \\ \l_fontspec_nfss_tl + \tl_if_empty:NF \l_fontspec_postadjust_tl { + \\ and~ font~ adjustment~ code: \\ \l_fontspec_postadjust_tl + } } \msg_new:nnn {fontspec} {no-font-shape} { @@ -2746,10 +2785,10 @@ This work consists of this file fontspec.dtx \DeclareOption{cm-default}{ \fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\@zf@mathtrue} -\DeclareOption{no-math}{\@zf@mathfalse} -\DeclareOption{config}{\@zf@configfiletrue} -\DeclareOption{no-config}{\@zf@configfilefalse} +\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool} +\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool} \DeclareOption{quiet}{ \msg_redirect_module:nnn { fontspec } { warning } { info } \msg_redirect_module:nnn { fontspec } { info } { none } @@ -2914,6 +2953,7 @@ This work consists of this file fontspec.dtx \def\g_fontspec_mathrm_tl{\rmdefault} \def\g_fontspec_mathsf_tl{\sfdefault} \def\g_fontspec_mathtt_tl{\ttdefault} +\tl_clear:N \g_fontspec_bfmathrm_tl % \end{macrocode} % \end{macro} \end{macro} \end{macro} % \end{macro} @@ -3102,8 +3142,12 @@ This work consists of this file fontspec.dtx \tl_set:Nn \l_fontspec_script_tl {#2} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} }{ - \fontspec_warning:nx {script-not-exist} {#1} - \setkeys[zf@feat]{Script}{Latin} + \fontspec_check_script:nTF {latn} { + \fontspec_warning:nx {script-not-exist-latn} {#1} + \setkeys[zf@feat]{Script}{Latin} + }{ + \fontspec_warning:nx {script-not-exist} {#1} + } } } } @@ -3172,11 +3216,11 @@ This work consists of this file fontspec.dtx % Test whether the currently selected font has been loaded by fontspec. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \cs_if_exist:cTF {g_fontspec_ \f@family _prop} { \prg_return_true: - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3189,12 +3233,12 @@ This work consists of this file fontspec.dtx \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \ifzf@atsui + \bool_if:NTF \l_fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3211,11 +3255,7 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu - \prg_return_true: - \else - \prg_return_false: - \fi + \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false: }{ \prg_return_false: } @@ -3233,15 +3273,15 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} - \fontspec_check_ot_feat:nTF {#1} \prg_return_true: \prg_return_false: - \else + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3258,13 +3298,13 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} \fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3282,11 +3322,11 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3304,13 +3344,13 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3328,13 +3368,13 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nn \l_fontspec_script_tl {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3351,12 +3391,12 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3372,12 +3412,12 @@ This work consists of this file fontspec.dtx \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -3496,7 +3536,7 @@ This work consists of this file fontspec.dtx \fontspec_preparse_features:nn {#1}{#2} \fontspec_set_scriptlang: \fontspec_get_features:n {} - \zf@firsttimefalse + \bool_set_false:N \l_fontspec_firsttime_bool % \end{macrocode} % Check if the family is unique and, if so, save its information. % (\cs{addfontfeature} and other macros use this data.) @@ -3614,7 +3654,7 @@ This work consists of this file fontspec.dtx } } \tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl} - \cs_if_exist:cTF {zf@family@fontname\zf@family} + \cs_if_exist:cTF {g_fontspec_ \zf@family _prop} \prg_return_false: \prg_return_true: } % \end{macrocode} @@ -3626,7 +3666,7 @@ This work consists of this file fontspec.dtx % none are explicitly requested. Similarly with the language settings. % \begin{macrocode} \cs_new:Npn \fontspec_set_scriptlang: { - \ifzf@icu + \bool_if:NT \l_fontspec_firsttime_bool { \tl_if_empty:NTF \l_fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { @@ -3648,7 +3688,7 @@ This work consists of this file fontspec.dtx \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl} \fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl} } - \fi + } } % \end{macrocode} % \end{macro} @@ -3657,7 +3697,22 @@ This work consists of this file fontspec.dtx % \begin{macro}{\fontspec_save_fontinfo:nn} % Saves the relevant font information for future processing. % \begin{macrocode} +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} \cs_new:Npn \fontspec_save_fontinfo:nn #1#2 { + + \prop_new:c {g_fontspec_ \zf@family _prop} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontname} {#2} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {options} {\g_fontspec_default_fontopts_tl #1} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontdef} { + \fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + } + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-num} \l_fontspec_script_int + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-tag} \l_fontspec_lang_tl + \tl_gset:cx {zf@family@fontname\zf@family} {#2} \tl_gset:cx {zf@family@options\zf@family} {\g_fontspec_default_fontopts_tl #1} \tl_gset:cx {zf@family@fontdef\zf@family} { @@ -3696,7 +3751,7 @@ This work consists of this file fontspec.dtx % undefined) or with the font specified with the \feat{BoldFont} feature. % \begin{macrocode} \cs_new:Npn \fontspec_set_bold: { - \unless\ifzf@nobf + \bool_if:NF \l_fontspec_nobf_bool { \tl_if_empty:NTF \l_fontspec_fontname_bf_tl { \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} \bfdefault \updefault \l_fontspec_fontfeat_bf_clist @@ -3704,7 +3759,7 @@ This work consists of this file fontspec.dtx \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl \bfdefault \updefault \l_fontspec_fontfeat_bf_clist } - \fi + } } % \end{macrocode} % \end{macro} @@ -3713,12 +3768,12 @@ This work consists of this file fontspec.dtx % And italic in the same way: % \begin{macrocode} \cs_new:Npn \fontspec_set_italic: { - \unless\ifzf@noit + \bool_if:NF \l_fontspec_noit_bool { \tl_if_empty:NTF \l_fontspec_fontname_it_tl { \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } \mddefault \itdefault \l_fontspec_fontfeat_it_clist - \fi + } } % \end{macrocode} % \end{macro} @@ -3743,11 +3798,7 @@ This work consists of this file fontspec.dtx % bold italic font. % \begin{macrocode} \cs_new:Npn \fontspec_set_bold_italic: { - \@tempswatrue - \ifzf@nobf\@tempswafalse\fi - \ifzf@noit\@tempswafalse\fi - \bool_if:NT \l_fontspec_external_bool \@tempswafalse - \if@tempswa + \bool_if:nF {\l_fontspec_nobf_bool || \l_fontspec_nobf_bool} { \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl { \tl_if_empty:NTF \l_fontspec_fontname_bf_tl @@ -3768,7 +3819,7 @@ This work consists of this file fontspec.dtx \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl } \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist - \fi + } } % \end{macrocode} % \end{macro} @@ -3800,23 +3851,27 @@ This work consists of this file fontspec.dtx % Now check if the font is to be rendered with \ATSUI\ or \ICU. This will either % be automatic (based on the font type), or specified by the user via a font feature. % -% This macro sets \cs{zf@atsui} or \cs{zf@icu} or \cs{zf@mm} booleans +% This macro sets booleans % accordingly depending if the font in \cmd\zf@basefont\ is an \AAT\ % font or an OpenType font or a font with feature axes (either \AAT\ or % Multiple Master), respectively. % \begin{macrocode} \xetex_or_luatex:nnn { \cs_new:Npn \fontspec_set_font_type: } { - \zf@tfmfalse \zf@atsuifalse \zf@icufalse \zf@mmfalse \zf@graphitefalse + \bool_set_false:N \l_fontspec_tfm_bool + \bool_set_false:N \l_fontspec_atsui_bool + \bool_set_false:N \l_fontspec_icu_bool + \bool_set_false:N \l_fontspec_mm_bool + \bool_set_false:N \l_fontspec_graphite_bool \ifcase\XeTeXfonttype\zf@basefont - \zf@tfmtrue + \bool_set_true:N \l_fontspec_tfm_bool \or - \zf@atsuitrue + \bool_set_true:N \l_fontspec_atsui_bool \ifnum\XeTeXcountvariations\zf@basefont > \c_zero - \zf@mmtrue + \bool_set_true:N \l_fontspec_mm_bool \fi \or - \zf@icutrue + \bool_set_true:N \l_fontspec_icu_bool \fi % \end{macrocode} % If automatic, the \cmd{\l_fontspec_renderer_tl} token list will still be @@ -3825,15 +3880,17 @@ This work consists of this file fontspec.dtx % other weights of the font are specifically loaded with the same renderer. % \begin{macrocode} \tl_if_empty:NT \l_fontspec_renderer_tl { - \ifzf@atsui + \bool_if:NTF \l_fontspec_atsui_bool { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} - \else\ifzf@icu - \tl_set:Nn \l_fontspec_renderer_tl {/ICU} - \fi\fi + }{ + \bool_if:NT \l_fontspec_icu_bool { + \tl_set:Nn \l_fontspec_renderer_tl {/ICU} + } + } } } { - \zf@icutrue + \bool_set_true:N \l_fontspec_icu_bool } % \end{macrocode} % \end{macro} @@ -3879,13 +3936,13 @@ This work consists of this file fontspec.dtx \font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt} \fontspec_declare_shape:nnnn {}{#2}{#3}{#4} \tl_if_empty:NTF \l_fontspec_fontname_sc_tl { - \unless\ifzf@nosc + \bool_if:NF \l_fontspec_nosc_bool { \fontspec_make_smallcaps:T { \fontspec_declare_shape:nnnn {\l_fontspec_sc_featstr_sclist} {#2} { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } { #4 \l_fontspec_fontfeat_sc_clist } } - \fi + } }{ \tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl} \fontspec_declare_shape:nnnn {}{#2} @@ -3957,10 +4014,12 @@ This work consists of this file fontspec.dtx } % \end{macrocode} % This extra stuff for the slanted shape substitution is a little bit awkward, -% but I'd rather have it here than break out yet another macro. Alternatively, -% one day I might just redefine \cmd\slshape. Why not, eh? +% but I'd rather have it here than break out yet another macro. % \begin{macrocode} - \str_if_eq:xxT {#3} {\itdefault} + \bool_if:nT { + \str_if_eq_p:xx {#3} {\itdefault} && + !(\str_if_eq_p:xx {\itdefault} {\sldefault}) + } { \use:x { \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault} @@ -3977,13 +4036,13 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \xetex_or_luatex:nnn { \tl_set:Nn \l_fontspec_pre_feat_sclist } { - \ifzf@icu + \bool_if:NT \l_fontspec_icu_bool { \tl_if_empty:NF \l_fontspec_script_tl { script = \l_fontspec_script_tl ; language = \l_fontspec_lang_tl ; } - \fi + } } { mode = \l_fontspec_mode_tl ; @@ -4002,14 +4061,14 @@ This work consists of this file fontspec.dtx % This macro is used to build up a complex family name based on its % features. % -% \cmd{\zf@firsttime} is set true in \cmd{\fontspec_select:nn} only the first +% The \meta{firsttime} boolean is set true in \cmd{\fontspec_select:nn} only the first % time \cmd{zf@get@feature@requests} is called, so that the family % name is only created once. % \begin{macrocode} \cs_new:Nn \fontspec_update_fontid:n { - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} - \fi + } } % \end{macrocode} % \end{macro} @@ -4031,8 +4090,10 @@ This work consists of this file fontspec.dtx \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl \tl_clear:N \l_fontspec_postadjust_tl \fontspec_setkeys:xx {options} {\l_fontspec_fontfeat_clist #1} - \tl_if_empty:NF \XKV@rm { - \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm } + \bool_if:NT \l_fontspec_firsttime_bool { + \tl_if_empty:NF \XKV@rm { + \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm } + } } % \end{macrocode} % Finish the colour specification. @@ -4080,8 +4141,8 @@ This work consists of this file fontspec.dtx % Check whether they're assigned to globally or not.) % \begin{macrocode} \newcommand*\fontspec_init:{ - \zf@icufalse - \zf@firsttimetrue + \bool_set_false:N \l_fontspec_icu_bool + \bool_set_true:N \l_fontspec_firsttime_bool \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_namewrap:n ##1 } { ##1 } { name:##1 } @@ -4113,16 +4174,18 @@ This work consists of this file fontspec.dtx \xetex_or_luatex:nn { \cs_set:Nn \fontspec_make_smallcaps:T { - \ifzf@atsui - \tl_clear:N \l_fontspec_sc_featstr_sclist - \fontspec_make_AAT_feature_string:nnT {3}{3} { - \tl_set:Nx \l_fontspec_sc_featstr_sclist {\l_fontspec_feature_string_tl;} - #1 - } - \fi - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_ot_smallcaps:T {#1} - \fi + }{ + \bool_if:NT \l_fontspec_atsui_bool { + \tl_clear:N \l_fontspec_sc_featstr_sclist + \fontspec_make_AAT_feature_string:nnT {3}{3} { + \tl_set:Nx \l_fontspec_sc_featstr_sclist + {\l_fontspec_feature_string_tl;} + #1 + } + } + } } } { @@ -4155,9 +4218,9 @@ This work consists of this file fontspec.dtx % separated by semicolons. % \begin{macrocode} \cs_new:Nn \fontspec_update_featstr:n { - \unless\ifzf@firsttime - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} - \fi + \bool_if:NF \l_fontspec_firsttime_bool { + \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1;} + } } % \end{macrocode} % \end{macro} @@ -4171,12 +4234,13 @@ This work consists of this file fontspec.dtx \cs_new:Npn \fontspec_make_feature:nnn #1#2#3 { \xetex_or_luatex:nn { - \ifzf@atsui - \fontspec_make_AAT_feature:nn {#1}{#2} - \fi - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_ICU_feature:n {#3} - \fi + }{ + \bool_if:NT \l_fontspec_atsui_bool { + \fontspec_make_AAT_feature:nn {#1}{#2} + } + } } { \fontspec_make_ICU_feature:n {#3} @@ -4280,11 +4344,11 @@ This work consists of this file fontspec.dtx \tl_if_empty:NTF \l_tmpa_tl { \prg_return_false: } { - \intexpr_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } + \int_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } { \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} }{ - \intexpr_if_even:nTF {#2} + \int_if_even:nTF {#2} { \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} }{ @@ -4359,7 +4423,7 @@ This work consists of this file fontspec.dtx \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts\zf@basefont } \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum \XeTeXOTscripttag\zf@basefont \l_tmpa_int = \l_fontspec_strnum_int \@tempswatrue @@ -4392,7 +4456,7 @@ This work consists of this file fontspec.dtx } \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTlanguagetag\zf@basefont\l_fontspec_script_int \l_tmpa_int =\l_fontspec_strnum_int \@tempswatrue @@ -4433,7 +4497,7 @@ This work consists of this file fontspec.dtx \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTfeaturetag\zf@basefont\l_fontspec_script_int\l_fontspec_language_int \l_tmpa_int =\l_fontspec_strnum_int @@ -4475,8 +4539,8 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \bool_new:N \l_fontspec_external_bool \define@key[zf]{preparse-external}{ExternalLocation}[]{ - \zf@nobftrue - \zf@noittrue + \bool_set_true:N \l_fontspec_nobf_bool + \bool_set_true:N \l_fontspec_noit_bool \bool_set_true:N \l_fontspec_external_bool \xetex_or_luatex:nnn { \cs_gset:Npn \fontspec_namewrap:n ##1 } { [ #1 ##1 ] } @@ -4511,7 +4575,7 @@ This work consists of this file fontspec.dtx \define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num] {AAT,ICU,Graphite,Full,Basic}{ \fontspec_update_fontid:n {+rend:#1} - \intexpr_compare:nTF {\l_tmpa_num < 3} { + \int_compare:nTF {\l_tmpa_num < 3} { \xetex_or_luatex:nn { \tl_set:Nv \l_fontspec_renderer_tl {g_fontspec_renderer_tag_\l_tmpa_tl} @@ -4569,11 +4633,11 @@ This work consists of this file fontspec.dtx \define@key[zf]{preparse-external}{BoldFont}{ \tl_if_empty:nTF {#1} { - \zf@nobftrue + \bool_set_true:N \l_fontspec_nobf_bool \fontspec_update_fontid:n {nobf} } { - \zf@nobffalse + \bool_set_false:N \l_fontspec_nobf_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} \fontspec_update_fontid:n {bf:#1} } @@ -4584,10 +4648,10 @@ This work consists of this file fontspec.dtx \define@key[zf]{preparse-external}{ItalicFont}{ \tl_if_empty:nTF {#1} { - \zf@noittrue + \bool_set_true:N \l_fontspec_noit_bool \fontspec_update_fontid:n {noit} }{ - \zf@noitfalse + \bool_set_false:N \l_fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} \fontspec_update_fontid:n {it:#1} } @@ -4613,10 +4677,10 @@ This work consists of this file fontspec.dtx \define@key[zf]{options}{SmallCapsFont}{ \tl_if_empty:nTF {#1} { - \zf@nosctrue + \bool_set_true:N \l_fontspec_nosc_bool \fontspec_update_fontid:n {nosc} }{ - \zf@noscfalse + \bool_set_true:N \l_fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} \fontspec_update_fontid:n {sc:\zap@space #1~\@empty} } @@ -4669,7 +4733,9 @@ This work consists of this file fontspec.dtx % Note that small caps features can vary by shape, so these in fact \emph{aren't} pre-parsed. % \begin{macrocode} \define@key[zf]{options}{SmallCapsFeatures}{ - \unless\ifzf@firsttime\def\l_fontspec_fontfeat_sc_clist{, #1}\fi + \bool_if:NF \l_fontspec_firsttime_bool { + \def\l_fontspec_fontfeat_sc_clist{, #1} + } \fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty} } % \end{macrocode} @@ -4766,9 +4832,9 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \define@key[zf]{options}{WordSpace}{ \fontspec_update_fontid:n {+wordspace:#1} - \unless\ifzf@firsttime + \bool_if:NF \l_fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop - \fi + } } % \end{macrocode} % @@ -4788,8 +4854,7 @@ This work consists of this file fontspec.dtx \dim_set:Nn \@tempdimb {#2\fontdimen3\zf@basefont} \dim_set:Nn \@tempdimc {#3\fontdimen4\zf@basefont} } - \tl_set:Nx \l_fontspec_postadjust_tl { - \l_fontspec_postadjust_tl + \tl_put_right:Nx \l_fontspec_postadjust_tl { \fontdimen2\font\the\@tempdima \fontdimen3\font\the\@tempdimb \fontdimen4\font\the\@tempdimc @@ -4804,7 +4869,16 @@ This work consists of this file fontspec.dtx \define@key[zf]{options}{PunctuationSpace}{ \fontspec_update_fontid:n {+punctspace:#1} \setlength\@tempdima{#1\fontdimen7\zf@basefont} - \tl_set:Nx \l_fontspec_postadjust_tl {\l_fontspec_postadjust_tl\fontdimen7\font\the\@tempdima} + \tl_put_right:Nx \l_fontspec_postadjust_tl {\fontdimen7\font\the\@tempdima} +} +% \end{macrocode} +% +% \paragraph{Secret hook into the font-adjustment code} +% +% \begin{macrocode} +\define@key[zf]{options}{FontAdjustment}{ + \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} + \tl_put_right:Nx \l_fontspec_postadjust_tl {#1} } % \end{macrocode} % @@ -4855,15 +4929,15 @@ This work consists of this file fontspec.dtx \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl } { - \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 } + \int_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 } + \int_compare:nTF { \tl_elt_count:n {#1} == 8 } { \fontspec_parse_colour:viii #1 } { - \ifzf@firsttime\else + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {bad-colour} {#1} - \fi + } } } } @@ -4872,9 +4946,9 @@ This work consists of this file fontspec.dtx \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 + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {opa-twice-col} {#7#8} - \fi + } } \tl_set:Nn \l_fontspec_opacity_tl {#7#8} } @@ -4887,9 +4961,9 @@ This work consists of this file fontspec.dtx \setcounter {fontspec_tmp_int} { 255*\real{#1} } \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl { - \ifzf@firsttime\else + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {opa-twice} {#1} - \fi + } } \tl_set:Nx \l_fontspec_opacity_tl { \nhex2 { \value{fontspec_tmp_int} } } @@ -4937,21 +5011,20 @@ This work consists of this file fontspec.dtx } \define@key[zf]{options}{OpticalSize}{ \xetex_or_luatex:nn { - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} \fontspec_update_fontid:n {+size:#1} - \fi - \ifzf@mm - \fontspec_update_fontid:n {+size:#1} - \fontspec_update_featstr:n{optical size=#1} - \fi - \ifzf@icu\else - \ifzf@mm\else - \ifzf@firsttime - \fontspec_warning:n {no-opticals} - \fi - \fi - \fi + }{ + \bool_if:NT \l_fontspec_mm_bool { + \fontspec_update_fontid:n {+size:#1} + \fontspec_update_featstr:n{optical size=#1} + } + } + \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool }{ + \bool_if:NT \l_fontspec_firsttime_bool { + \fontspec_warning:n {no-opticals} + } + } }{ \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} \fontspec_update_fontid:n {+size:#1} @@ -4987,7 +5060,7 @@ This work consists of this file fontspec.dtx % \pkg{fontspec}.) % \begin{macrocode} \define@key[zf]{options}{AutoFakeSlant}[0.2]{ - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_slant_tl {#1} \clist_put_right:Nn \l_fontspec_fontfeat_it_clist {,FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl @@ -4997,13 +5070,13 @@ This work consists of this file fontspec.dtx {,FakeBold=\l_fontspec_fake_embolden_tl,FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } - \fi + } } % \end{macrocode} % Same but reversed: % \begin{macrocode} \define@key[zf]{options}{AutoFakeBold}[1.5]{ - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} \tl_put_right:Nn \l_fontspec_fontfeat_bf_clist {,FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl @@ -5013,7 +5086,7 @@ This work consists of this file fontspec.dtx {,FakeSlant=\l_fontspec_fake_slant_tl,FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } - \fi + } } % \end{macrocode} % @@ -5193,7 +5266,7 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_salt:n #1 } - {+salt=#1} { +salt= \intexpr_eval:n {#1+1} } + {+salt=#1} { +salt= \int_eval:n {#1+1} } % \end{macrocode} % % \begin{macrocode} @@ -5221,6 +5294,31 @@ This work consists of this file fontspec.dtx } % \end{macrocode} % +% +% \subsubsection{OpenType maths font features} +% Used internally by \pkg{unicode-math}; their names might change: +% \begin{macrocode} +\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptStyle}[]} +{ + \fontspec_update_fontid:n {+ssty=0} + \fontspec_update_featstr:n{+ssty=0} +} +{ + \fontspec_update_fontid:n {+ssty=1} + \fontspec_update_featstr:n{+ssty=1} +} +\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptScriptStyle}[]} +{ + \fontspec_update_fontid:n {+ssty=1} + \fontspec_update_featstr:n{+ssty=1} +} +{ + \fontspec_update_fontid:n {+ssty=2} + \fontspec_update_featstr:n{+ssty=2} +} +% \end{macrocode} +% +% % \subsubsection{Style} % \begin{macrocode} \fontspec_define_font_feature:n{Style} @@ -5292,21 +5390,21 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_nalt:n #1 } - {+nalt=#1} { +nalt= \intexpr_eval:n {#1+1} } + {+nalt=#1} { +nalt= \int_eval:n {#1+1} } % \end{macrocode} % % \subsubsection{Vertical} % \begin{macrocode} \fontspec_define_font_feature:n{Vertical} \define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{ - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_feature:nnn{}{}{+vrt2} \fontspec_update_fontid:n {+vert} \fontspec_update_featstr:n{vertical} - \else + }{ \fontspec_update_fontid:n {+vert} \fontspec_update_featstr:n{vertical} - \fi + } } % \end{macrocode} % @@ -5676,19 +5774,22 @@ This work consists of this file fontspec.dtx % maths font package has been loaded. % % \begin{macrocode} -\@ifpackageloaded{euler}{\zf@package@euler@loadedtrue} - {\zf@package@euler@loadedfalse} +\@ifpackageloaded{euler}{ + \bool_set_true:N \g_fontspec_package_euler_loaded_bool +}{ + \bool_set_false:N \g_fontspec_package_euler_loaded_bool +} \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler}{ - \ifzf@package@euler@loaded - \zf@math@eulertrue - \else + \bool_if:NTF \g_fontspec_package_euler_loaded_bool { + \bool_set_true:N \g_fontspec_math_euler_bool + }{ \fontspec_error:n {euler-too-late} - \fi + } }{} - \@ifpackageloaded{lucbmath}{\zf@math@lucidatrue}{} - \@ifpackageloaded{lucidabr}{\zf@math@lucidatrue}{} - \@ifpackageloaded{lucimatx}{\zf@math@lucidatrue}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} % \end{macrocode} % Knuth's CM fonts fonts are all squashed together, combining letters, % accents, text symbols and maths symbols all in the one font, @@ -5751,7 +5852,7 @@ This work consists of this file fontspec.dtx % The following symbols are only defined specifically in \pkg{euler}, so skip them % if that package is loaded. % \begin{macrocode} - \ifzf@math@euler\else + \bool_if:NF \g_fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} @@ -5761,7 +5862,7 @@ This work consists of this file fontspec.dtx % so we only need to run this code if no extra maths package has been % loaded. % \begin{macrocode} - \ifzf@math@lucida\else + \bool_if:NF \g_fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} \DeclareMathSymbol{2}{\mathalpha}{legacymaths}{`2} @@ -5791,8 +5892,8 @@ This work consists of this file fontspec.dtx \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} - \fi - \fi + } + } % \end{macrocode} % Finally, we change the font definitions for \cmd\mathrm\ and so % on. These are defined using the \cmd\g_fontspec_mathrm_tl\ (\dots) macros, @@ -5812,14 +5913,14 @@ This work consists of this file fontspec.dtx \SetMathAlphabet\mathsf{normal}\zf@enc\g_fontspec_mathsf_tl\mddefault\updefault \SetMathAlphabet\mathtt{normal}\zf@enc\g_fontspec_mathtt_tl\mddefault\updefault \SetSymbolFont{operators}{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault - \ifdefined\g_fontspec_bfmathrm_tl + \tl_if_empty:NTF \g_fontspec_bfmathrm_tl { + \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault + }{ \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\updefault \SetMathAlphabet\mathbf{bold}\zf@enc\g_fontspec_bfmathrm_tl\bfdefault\updefault \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\itdefault - \else - \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault - \fi + } \SetMathAlphabet\mathsf{bold}\zf@enc\g_fontspec_mathsf_tl\bfdefault\updefault \SetMathAlphabet\mathtt{bold}\zf@enc\g_fontspec_mathtt_tl\bfdefault\updefault } @@ -5829,37 +5930,37 @@ This work consists of this file fontspec.dtx % \begin{macro}{\fontspec_maybe_setup_maths:} % We're a little less sophisticated about not executing the maths setup if various other maths font packages are loaded. This list is based on the wonderful `\LaTeX Font Catalogue': \url{http://www.tug.dk/FontCatalogue/mathfonts.html}. I'm sure there are more I've missed. Do the \TeX\ Gyre fonts have maths support yet? % -% Untested: would |\unless\ifnum\Gamma=28672\relax\@zf@mathfalse\fi| be a better test? +% Untested: would |\unless\ifnum\Gamma=28672\relax\bool_set_false:N \g_fontspec_math_bool\fi| be a better test? % This needs more cooperation with euler and lucida, I think. % \begin{macrocode} \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor}{ - \ifx\define@antt@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{arev}{\@zf@mathfalse}{} - \@ifpackageloaded{eulervm}{\@zf@mathfalse}{} - \@ifpackageloaded{mathdesign}{\@zf@mathfalse}{} - \@ifpackageloaded{concmath}{\@zf@mathfalse}{} - \@ifpackageloaded{cmbright}{\@zf@mathfalse}{} - \@ifpackageloaded{mathesf}{\@zf@mathfalse}{} - \@ifpackageloaded{gfsartemisia}{\@zf@mathfalse}{} - \@ifpackageloaded{gfsneohellenic}{\@zf@mathfalse}{} + \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} \@ifpackageloaded{iwona}{ - \ifx\define@iwona@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{kpfonts}{\@zf@mathfalse}{} - \@ifpackageloaded{kmath}{\@zf@mathfalse}{} + \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} \@ifpackageloaded{kurier}{ - \ifx\define@kurier@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{fouriernc}{\@zf@mathfalse}{} - \@ifpackageloaded{fourier}{\@zf@mathfalse}{} - \@ifpackageloaded{mathpazo}{\@zf@mathfalse}{} - \@ifpackageloaded{mathptmx}{\@zf@mathfalse}{} - \@ifpackageloaded{MinionPro}{\@zf@mathfalse}{} - \@ifpackageloaded{unicode-math}{\@zf@mathfalse}{} - \@ifpackageloaded{breqn}{\@zf@mathfalse}{} - \if@zf@math + \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{fourier}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} + \bool_if:NT \g_fontspec_math_bool { \fontspec_info:n {setup-math} \fontspec_setup_maths: - \fi + } } \AtBeginDocument{\fontspec_maybe_setup_maths:} % \end{macrocode} @@ -5869,11 +5970,11 @@ This work consists of this file fontspec.dtx % \subsection{Finishing up} % Now we just want to set up loading the \texttt{.cfg} file, if it exists. % \begin{macrocode} -\if@zf@configfile +\bool_if:NT \g_fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} -\fi +} % \end{macrocode} % % The end! Thanks for coming. @@ -5889,7 +5990,6 @@ This work consists of this file fontspec.dtx % First we define some metadata. % \begin{macrocode} fontspec = { } - fontspec.module = { name = "fontspec", version = 2.0, @@ -5899,26 +5999,18 @@ fontspec.module = { copyright = "Khaled Hosny", license = "LPPL" } - luatexbase.provides_module(fontspec.module) - % \end{macrocode} % Some utility functions % \begin{macrocode} - -utf = unicode.utf8 - function fontspec.log (...) luatexbase.module_log (fontspec.module.name, string.format(...)) end function fontspec.warning(...) luatexbase.module_warning(fontspec.module.name, string.format(...)) end function fontspec.error (...) luatexbase.module_error (fontspec.module.name, string.format(...)) end - function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-package'], ...) end - % \end{macrocode} % The following functions check for exsitence of certain script, language or % feature in a given font. % \begin{macrocode} - local function check_script(id, script) local s = string.lower(script) if id and id > 0 then @@ -5937,7 +6029,9 @@ local function check_script(id, script) end end end - +% \end{macrocode} +% +% \begin{macrocode} local function check_language(id, language, script) local s = string.lower(script) local l = string.lower(language) @@ -5957,7 +6051,9 @@ local function check_language(id, language, script) end end end - +% \end{macrocode} +% +% \begin{macrocode} local function check_feature(id, feature, language, script) local s = string.lower(script) local l = string.lower(language) @@ -5978,14 +6074,14 @@ local function check_feature(id, feature, language, script) end end end - % \end{macrocode} % The following are the function that get called from \TeX\ end. % \begin{macrocode} - local function tempswatrue() fontspec.sprint([[\@tempswatrue]]) end local function tempswafalse() fontspec.sprint([[\@tempswafalse]]) end - +% \end{macrocode} +% +% \begin{macrocode} function fontspec.check_ot_script(fnt, script) if check_script(font.id(fnt), script) then tempswatrue() @@ -5993,7 +6089,9 @@ function fontspec.check_ot_script(fnt, script) tempswafalse() end end - +% \end{macrocode} +% +% \begin{macrocode} function fontspec.check_ot_lang(fnt, lang, script) if check_language(font.id(fnt), lang, script) then tempswatrue() @@ -6001,7 +6099,9 @@ function fontspec.check_ot_lang(fnt, lang, script) tempswafalse() end end - +% \end{macrocode} +% +% \begin{macrocode} function fontspec.check_ot_feat(fnt, feat, lang, script) for _, f in ipairs { "+trep", "+tlig", "+anum" } do if feat == f then @@ -6015,7 +6115,23 @@ function fontspec.check_ot_feat(fnt, feat, lang, script) tempswafalse() end end - +% \end{macrocode} +% +% \begin{macrocode} +function fontspec.mathfontdimen(fnt, str) + local mathdimens = fonts.ids[font.id(fnt)].MathConstants + if mathdimens then + local m = mathdimens[str] + if m then + fontspec.sprint(mathdimens[str]) + fontspec.sprint("sp") + else + fontspec.sprint("0pt") + end + else + fontspec.sprint("0pt") + end +end % \end{macrocode} % % \iffalse @@ -6445,11 +6561,11 @@ If you want to run just a single test, use \def\prefix{#4} \refstepcounter{example}% \label{ex:\filename}% - \IfFileExists{doc/\theexample-\prefix-\filename.tex}{}{% - \immediate\write18{cd doc && rm -f \theexample-* ;}% + \IfFileExists{doc-files/\theexample-\prefix-\filename.tex}{}{% + \immediate\write18{cd doc-files && rm -f \theexample-* ;}% }% \VerbatimEnvironment - \begin{VerbatimOut}{doc/\theexample-\prefix-\filename.tex}} + \begin{VerbatimOut}{doc-files/\theexample-\prefix-\filename.tex}} % text in the environment {\end{VerbatimOut} \begin{figure} @@ -6457,12 +6573,12 @@ If you want to run just a single test, use \edef\@tempa{[gobble=0,fontsize=\noexpand\small,\options]}% \savebox\X{% \expandafter\BVerbatimInput - \@tempa{doc/\theexample-\prefix-\filename.tex}% + \@tempa{doc-files/\theexample-\prefix-\filename.tex}% }% - \IfFileExists{doc/\theexample-\prefix-\filename.pdf}{} + \IfFileExists{doc-files/\theexample-\prefix-\filename.pdf}{} {% \edef\1{% - cd doc; \csname prog@\prefix\endcsname + cd doc-files; \csname prog@\prefix\endcsname "% \unexpanded{% \documentclass{article}% @@ -6474,16 +6590,16 @@ If you want to run just a single test, use " }% \immediate\write18{ - mkdir -p doc; - cp -a fontspec.dtx doc/; - cd doc; + mkdir -p doc-files/; + cp -a fontspec.dtx doc-files/; + cd doc-files; tex fontspec.dtx > /dev/null ; } \immediate\write18{\unexpanded\expandafter{\1}}% }% \savebox\Y{% - \IfFileExists{doc/\theexample-\prefix-\filename.pdf} - {\includegraphics{doc/\theexample-\prefix-\filename.pdf}} + \IfFileExists{doc-files/\theexample-\prefix-\filename.pdf} + {\includegraphics{doc-files/\theexample-\prefix-\filename.pdf}} {Graphic not generated.}% } % TYPESETTING @@ -6540,7 +6656,6 @@ If you want to run just a single test, use \def\AAT{\textsc{aat}} \def\ATSUI{\textsc{atsui}} \def\ICU{\textsc{icu}} -\def\LuaTeX{L\kern-0.08emu\kern-0.03ema\kern-0.12em\TeX} %% (La)TeX font-related declarations: \linespread{1.05} % Pagella needs more space between lines diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F001a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F001a-basic-loading.ltx index 7787e9ab41d..4aa54463b7a 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F001a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F001a-basic-loading.ltx @@ -6,4 +6,8 @@ Hello, moon!\par \textsc{small caps}\par `--Punctuation---' + +\def\itdefault{sl} +\setmainfont{Verdana} +Testing \textsl{slanted} edge case. \end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-emph-01.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F001b-emph.ltx index e24dea90cec..e24dea90cec 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-emph-01.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F001b-emph.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-test-prog-01.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F200a-test-prog.ltx index c9ec65bc928..c9ec65bc928 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/F-test-prog-01.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F200a-test-prog.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex index 396b888526b..4f7cee4b899 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex @@ -1,4 +1,5 @@ -\TEST{F001a} +\TEST{F001a-basic-loading} +\TEST{F001b-emph} \TEST{F002a} \TEST{F003a} \TEST{F003b} @@ -11,3 +12,4 @@ \TEST{F100c} \TEST{F100d} \TEST{F100e} +\TEST{F200a-test-prog} diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index 3a3e4751e28..25f905efd09 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -14,7 +14,7 @@ %% %% \ProvidesPackage{fontspec-patches} - [2010/09/29 v2.1b Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/11/07 v2.1d Advanced font selection for XeLaTeX/LuaLaTeX] \ExplSyntaxOn diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua index 34904eb5030..040e5dcb8a4 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec.lua +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec.lua @@ -16,7 +16,6 @@ fontspec = { } - fontspec.module = { name = "fontspec", version = 2.0, @@ -26,19 +25,11 @@ fontspec.module = { copyright = "Khaled Hosny", license = "LPPL" } - luatexbase.provides_module(fontspec.module) - - -utf = unicode.utf8 - function fontspec.log (...) luatexbase.module_log (fontspec.module.name, string.format(...)) end function fontspec.warning(...) luatexbase.module_warning(fontspec.module.name, string.format(...)) end function fontspec.error (...) luatexbase.module_error (fontspec.module.name, string.format(...)) end - function fontspec.sprint (...) tex.sprint(luatexbase.catcodetables['latex-package'], ...) end - - local function check_script(id, script) local s = string.lower(script) if id and id > 0 then @@ -57,7 +48,6 @@ local function check_script(id, script) end end end - local function check_language(id, language, script) local s = string.lower(script) local l = string.lower(language) @@ -77,7 +67,6 @@ local function check_language(id, language, script) end end end - local function check_feature(id, feature, language, script) local s = string.lower(script) local l = string.lower(language) @@ -98,11 +87,8 @@ local function check_feature(id, feature, language, script) end end end - - local function tempswatrue() fontspec.sprint([[\@tempswatrue]]) end local function tempswafalse() fontspec.sprint([[\@tempswafalse]]) end - function fontspec.check_ot_script(fnt, script) if check_script(font.id(fnt), script) then tempswatrue() @@ -110,7 +96,6 @@ function fontspec.check_ot_script(fnt, script) tempswafalse() end end - function fontspec.check_ot_lang(fnt, lang, script) if check_language(font.id(fnt), lang, script) then tempswatrue() @@ -118,7 +103,6 @@ function fontspec.check_ot_lang(fnt, lang, script) tempswafalse() end end - function fontspec.check_ot_feat(fnt, feat, lang, script) for _, f in ipairs { "+trep", "+tlig", "+anum" } do if feat == f then @@ -132,7 +116,20 @@ function fontspec.check_ot_feat(fnt, feat, lang, script) tempswafalse() end end - +function fontspec.mathfontdimen(fnt, str) + local mathdimens = fonts.ids[font.id(fnt)].MathConstants + if mathdimens then + local m = mathdimens[str] + if m then + fontspec.sprint(mathdimens[str]) + fontspec.sprint("sp") + else + fontspec.sprint("0pt") + end + else + fontspec.sprint("0pt") + end +end -- -- Copyright 2004--2010 Will Robertson <wspr81@gmail.com> -- Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org> diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index 776a3d449da..a1407c8e32e 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} - [2010/09/29 v2.1b Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/11/07 v2.1d Advanced font selection for XeLaTeX/LuaLaTeX] \RequirePackage{expl3,xparse} @@ -29,7 +29,7 @@ \RequirePackage{luatextra}[2010/05/10] \luatexRequireModule{fontspec} }{ - \msg_error:nn {fontspec} {not-pdftex} + \msg_fatal:nn {fontspec} {not-pdftex} } } \xetex_if_engine:TF @@ -43,20 +43,20 @@ \luatex_if_engine:T { \cs_new:Npn \xetex_or_luatex:nnn #1#2#3 {#1{#3}} } } -\newif\ifzf@firsttime -\newif\ifzf@nobf -\newif\ifzf@noit -\newif\ifzf@nosc -\newif\ifzf@tfm -\newif\ifzf@atsui -\newif\ifzf@icu -\newif\ifzf@mm -\newif\ifzf@graphite -\newif\ifzf@math@euler -\newif\ifzf@math@lucida -\newif\ifzf@package@euler@loaded -\newif\if@zf@configfile -\newif\if@zf@math +\bool_new:N \l_fontspec_firsttime_bool +\bool_new:N \l_fontspec_nobf_bool +\bool_new:N \l_fontspec_noit_bool +\bool_new:N \l_fontspec_nosc_bool +\bool_new:N \l_fontspec_tfm_bool +\bool_new:N \l_fontspec_atsui_bool +\bool_new:N \l_fontspec_icu_bool +\bool_new:N \l_fontspec_mm_bool +\bool_new:N \l_fontspec_graphite_bool +\bool_new:N \g_fontspec_math_euler_bool +\bool_new:N \g_fontspec_math_lucida_bool +\bool_new:N \g_fontspec_package_euler_loaded_bool +\bool_new:N \g_fontspec_cfg_bool +\bool_new:N \g_fontspec_math_bool \int_new:N \l_fontspec_script_int \int_new:N \l_fontspec_language_int \int_new:N \l_fontspec_strnum_int @@ -153,11 +153,15 @@ { Option~ '#2'~ of~ font~ feature~ '#1'~ overwritten. } -\msg_new:nnn {fontspec} {script-not-exist} +\msg_new:nnn {fontspec} {script-not-exist-latn} { Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ 'Latin'~ script~ used~ instead. } +\msg_new:nnn {fontspec} {script-not-exist} +{ + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'. +} \msg_new:nnn {fontspec} {aat-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ @@ -213,7 +217,7 @@ } \msg_new:nnn {fontspec} {defining-font} { - Defining~ font~ family~ for~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. + Defining~ font~ family~'\zf@family'~ for~ font~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. } \msg_new:nnn {fontspec} {defining-raw} { @@ -228,8 +232,11 @@ {\bfdefault/\itdefault} {bold~ italic} {\bfdefault/\sidefault} {bold~ italic~ small~ caps} } {#1}'~ - with~ NFSS~ specification: \\ + with~ NFSS~ spec.: \\ \l_fontspec_nfss_tl + \tl_if_empty:NF \l_fontspec_postadjust_tl { + \\ and~ font~ adjustment~ code: \\ \l_fontspec_postadjust_tl + } } \msg_new:nnn {fontspec} {no-font-shape} { @@ -268,10 +275,10 @@ \DeclareOption{cm-default}{ \fontspec_warning:n {cm-default-obsolete} } -\DeclareOption{math}{\@zf@mathtrue} -\DeclareOption{no-math}{\@zf@mathfalse} -\DeclareOption{config}{\@zf@configfiletrue} -\DeclareOption{no-config}{\@zf@configfilefalse} +\DeclareOption{math}{\bool_set_true:N \g_fontspec_math_bool} +\DeclareOption{no-math}{\bool_set_false:N \g_fontspec_math_bool} +\DeclareOption{config}{\bool_set_true:N \g_fontspec_cfg_bool} +\DeclareOption{no-config}{\bool_set_false:N \g_fontspec_cfg_bool} \DeclareOption{quiet}{ \msg_redirect_module:nnn { fontspec } { warning } { info } \msg_redirect_module:nnn { fontspec } { info } { none } @@ -345,6 +352,7 @@ \def\g_fontspec_mathrm_tl{\rmdefault} \def\g_fontspec_mathsf_tl{\sfdefault} \def\g_fontspec_mathtt_tl{\ttdefault} +\tl_clear:N \g_fontspec_bfmathrm_tl \DeclareDocumentCommand \newfontfamily { m O{} m } { \fontspec_select:nn{#2}{#3} \use:x { @@ -420,8 +428,12 @@ \tl_set:Nn \l_fontspec_script_tl {#2} \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} }{ - \fontspec_warning:nx {script-not-exist} {#1} - \setkeys[zf@feat]{Script}{Latin} + \fontspec_check_script:nTF {latn} { + \fontspec_warning:nx {script-not-exist-latn} {#1} + \setkeys[zf@feat]{Script}{Latin} + }{ + \fontspec_warning:nx {script-not-exist} {#1} + } } } } @@ -449,21 +461,21 @@ } \DeclareFontsExtensions{.otf,.ttf,.OTF,.TTF,.ttc,.TTC,.dfont} \prg_new_conditional:Nnn \fontspec_if_fontspec_font: {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \cs_if_exist:cTF {g_fontspec_ \f@family _prop} { \prg_return_true: - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} - \ifzf@atsui + \bool_if:NTF \l_fontspec_atsui_bool { \fontspec_make_AAT_feature_string:nnTF {#1}{#2} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -472,11 +484,7 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu - \prg_return_true: - \else - \prg_return_false: - \fi + \bool_if:NTF \l_fontspec_icu_bool \prg_return_true: \prg_return_false: }{ \prg_return_false: } @@ -485,15 +493,15 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} \int_set:Nv \l_fontspec_language_int {g_fontspec_lang_num_(\f@family)_tl} \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\f@family)_tl} - \fontspec_check_ot_feat:nTF {#1} \prg_return_true: \prg_return_false: - \else + \fontspec_check_ot_feat:nTF {#1} {\prg_return_true:} {\prg_return_false:} + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -502,13 +510,13 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_language_int {#2} \fontspec_check_ot_feat:nTF {#3} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -517,11 +525,11 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_check_script:nTF {#1} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -530,13 +538,13 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\f@family)_tl} \int_set:Nv \l_fontspec_script_int {g_fontspec_script_num_(\f@family)_tl} \fontspec_check_lang:nTF {#1} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -545,13 +553,13 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nn \l_fontspec_script_tl {#1} \fontspec_iv_str_to_num:Nn \l_fontspec_script_int {#1} \fontspec_check_lang:nTF {#2} \prg_return_true: \prg_return_false: - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -560,12 +568,12 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -574,12 +582,12 @@ \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\csname zf@family@fontdef\f@family\endcsname} {\f@size pt} \fontspec_set_font_type: - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} - \else + }{ \prg_return_false: - \fi + } }{ \prg_return_false: } @@ -616,7 +624,7 @@ \fontspec_preparse_features:nn {#1}{#2} \fontspec_set_scriptlang: \fontspec_get_features:n {} - \zf@firsttimefalse + \bool_set_false:N \l_fontspec_firsttime_bool \fontspec_save_family:nT {#2} { \fontspec_info:nxx {defining-font} {#1} {#2} \fontspec_save_fontinfo:nn {#1} {#2} @@ -674,11 +682,11 @@ } } \tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl} - \cs_if_exist:cTF {zf@family@fontname\zf@family} + \cs_if_exist:cTF {g_fontspec_ \zf@family _prop} \prg_return_false: \prg_return_true: } \cs_new:Npn \fontspec_set_scriptlang: { - \ifzf@icu + \bool_if:NT \l_fontspec_firsttime_bool { \tl_if_empty:NTF \l_fontspec_script_name_tl { \fontspec_check_script:nTF {latn} { @@ -700,9 +708,24 @@ \fontspec_setkeys:xxx {feat} {Script} {\l_fontspec_script_name_tl} \fontspec_setkeys:xxx {feat} {Lang} {\l_fontspec_lang_name_tl} } - \fi + } } +\cs_generate_variant:Nn \prop_gput:Nnn {cnV} +\cs_generate_variant:Nn \prop_gput:Nnn {cnx} \cs_new:Npn \fontspec_save_fontinfo:nn #1#2 { + + \prop_new:c {g_fontspec_ \zf@family _prop} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontname} {#2} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {options} {\g_fontspec_default_fontopts_tl #1} + \prop_gput:cnx {g_fontspec_ \zf@family _prop} {fontdef} { + \fontspec_fullname:n {\l_fontspec_fontname_tl} : + \l_fontspec_pre_feat_sclist \l_fontspec_rawfeatures_sclist + } + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-num} \l_fontspec_script_int + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-num} \l_fontspec_language_int + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {script-tag} \l_fontspec_script_tl + \prop_gput:cnV {g_fontspec_ \zf@family _prop} {lang-tag} \l_fontspec_lang_tl + \tl_gset:cx {zf@family@fontname\zf@family} {#2} \tl_gset:cx {zf@family@options\zf@family} {\g_fontspec_default_fontopts_tl #1} \tl_gset:cx {zf@family@fontdef\zf@family} { @@ -719,7 +742,7 @@ \mddefault \updefault \l_fontspec_fontfeat_up_clist } \cs_new:Npn \fontspec_set_bold: { - \unless\ifzf@nobf + \bool_if:NF \l_fontspec_nobf_bool { \tl_if_empty:NTF \l_fontspec_fontname_bf_tl { \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/B} \bfdefault \updefault \l_fontspec_fontfeat_bf_clist @@ -727,15 +750,15 @@ \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl \bfdefault \updefault \l_fontspec_fontfeat_bf_clist } - \fi + } } \cs_new:Npn \fontspec_set_italic: { - \unless\ifzf@noit + \bool_if:NF \l_fontspec_noit_bool { \tl_if_empty:NTF \l_fontspec_fontname_it_tl { \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/I} } { \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_it_tl } \mddefault \itdefault \l_fontspec_fontfeat_it_clist - \fi + } } \cs_new:Npn \fontspec_set_slanted: { \tl_if_empty:NF \l_fontspec_fontname_sl_tl { @@ -744,11 +767,7 @@ } } \cs_new:Npn \fontspec_set_bold_italic: { - \@tempswatrue - \ifzf@nobf\@tempswafalse\fi - \ifzf@noit\@tempswafalse\fi - \bool_if:NT \l_fontspec_external_bool \@tempswafalse - \if@tempswa + \bool_if:nF {\l_fontspec_nobf_bool || \l_fontspec_nobf_bool} { \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl { \tl_if_empty:NTF \l_fontspec_fontname_bf_tl @@ -769,7 +788,7 @@ \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl } \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist - \fi + } } \cs_new:Npn \fontspec_set_bold_slanted: { \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl { @@ -784,27 +803,33 @@ } \xetex_or_luatex:nnn { \cs_new:Npn \fontspec_set_font_type: } { - \zf@tfmfalse \zf@atsuifalse \zf@icufalse \zf@mmfalse \zf@graphitefalse + \bool_set_false:N \l_fontspec_tfm_bool + \bool_set_false:N \l_fontspec_atsui_bool + \bool_set_false:N \l_fontspec_icu_bool + \bool_set_false:N \l_fontspec_mm_bool + \bool_set_false:N \l_fontspec_graphite_bool \ifcase\XeTeXfonttype\zf@basefont - \zf@tfmtrue + \bool_set_true:N \l_fontspec_tfm_bool \or - \zf@atsuitrue + \bool_set_true:N \l_fontspec_atsui_bool \ifnum\XeTeXcountvariations\zf@basefont > \c_zero - \zf@mmtrue + \bool_set_true:N \l_fontspec_mm_bool \fi \or - \zf@icutrue + \bool_set_true:N \l_fontspec_icu_bool \fi \tl_if_empty:NT \l_fontspec_renderer_tl { - \ifzf@atsui + \bool_if:NTF \l_fontspec_atsui_bool { \tl_set:Nn \l_fontspec_renderer_tl {/AAT} - \else\ifzf@icu - \tl_set:Nn \l_fontspec_renderer_tl {/ICU} - \fi\fi + }{ + \bool_if:NT \l_fontspec_icu_bool { + \tl_set:Nn \l_fontspec_renderer_tl {/ICU} + } + } } } { - \zf@icutrue + \bool_set_true:N \l_fontspec_icu_bool } \cs_new:Nn \fontspec_make_font_shapes:nnnnn { \font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt} @@ -821,13 +846,13 @@ \font_set:Nnn \zf@basefont {\fontspec_fullname:n {#1}} {\f@size pt} \fontspec_declare_shape:nnnn {}{#2}{#3}{#4} \tl_if_empty:NTF \l_fontspec_fontname_sc_tl { - \unless\ifzf@nosc + \bool_if:NF \l_fontspec_nosc_bool { \fontspec_make_smallcaps:T { \fontspec_declare_shape:nnnn {\l_fontspec_sc_featstr_sclist} {#2} { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } { #4 \l_fontspec_fontfeat_sc_clist } } - \fi + } }{ \tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl} \fontspec_declare_shape:nnnn {}{#2} @@ -874,7 +899,10 @@ \exp_not:N\DeclareFontShape{\zf@enc}{\zf@family}{#2}{#3} {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} } - \str_if_eq:xxT {#3} {\itdefault} + \bool_if:nT { + \str_if_eq_p:xx {#3} {\itdefault} && + !(\str_if_eq_p:xx {\itdefault} {\sldefault}) + } { \use:x { \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault} @@ -884,13 +912,13 @@ } \xetex_or_luatex:nnn { \tl_set:Nn \l_fontspec_pre_feat_sclist } { - \ifzf@icu + \bool_if:NT \l_fontspec_icu_bool { \tl_if_empty:NF \l_fontspec_script_tl { script = \l_fontspec_script_tl ; language = \l_fontspec_lang_tl ; } - \fi + } } { mode = \l_fontspec_mode_tl ; @@ -901,9 +929,9 @@ } } \cs_new:Nn \fontspec_update_fontid:n { - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} - \fi + } } \cs_set:Npn \fontspec_get_features:n #1 { \sclist_clear:N \l_fontspec_rawfeatures_sclist @@ -912,8 +940,10 @@ \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl \tl_clear:N \l_fontspec_postadjust_tl \fontspec_setkeys:xx {options} {\l_fontspec_fontfeat_clist #1} - \tl_if_empty:NF \XKV@rm { - \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm } + \bool_if:NT \l_fontspec_firsttime_bool { + \tl_if_empty:NF \XKV@rm { + \fontspec_error:nx {unknown-options} { \exp_not:V \XKV@rm } + } } \str_if_eq:xxF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } @@ -944,8 +974,8 @@ \tl_new:Nn \g_fontspec_hexcol_tl {000000} \tl_new:Nn \g_fontspec_opacity_tl {FF~} \newcommand*\fontspec_init:{ - \zf@icufalse - \zf@firsttimetrue + \bool_set_false:N \l_fontspec_icu_bool + \bool_set_true:N \l_fontspec_firsttime_bool \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_namewrap:n ##1 } { ##1 } { name:##1 } @@ -969,16 +999,18 @@ \xetex_or_luatex:nn { \cs_set:Nn \fontspec_make_smallcaps:T { - \ifzf@atsui - \tl_clear:N \l_fontspec_sc_featstr_sclist - \fontspec_make_AAT_feature_string:nnT {3}{3} { - \tl_set:Nx \l_fontspec_sc_featstr_sclist {\l_fontspec_feature_string_tl;} - #1 - } - \fi - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_ot_smallcaps:T {#1} - \fi + }{ + \bool_if:NT \l_fontspec_atsui_bool { + \tl_clear:N \l_fontspec_sc_featstr_sclist + \fontspec_make_AAT_feature_string:nnT {3}{3} { + \tl_set:Nx \l_fontspec_sc_featstr_sclist + {\l_fontspec_feature_string_tl;} + #1 + } + } + } } } { @@ -991,19 +1023,20 @@ } \cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} \cs_new:Nn \fontspec_update_featstr:n { - \unless\ifzf@firsttime - \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} - \fi + \bool_if:NF \l_fontspec_firsttime_bool { + \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1;} + } } \cs_new:Npn \fontspec_make_feature:nnn #1#2#3 { \xetex_or_luatex:nn { - \ifzf@atsui - \fontspec_make_AAT_feature:nn {#1}{#2} - \fi - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_ICU_feature:n {#3} - \fi + }{ + \bool_if:NT \l_fontspec_atsui_bool { + \fontspec_make_AAT_feature:nn {#1}{#2} + } + } } { \fontspec_make_ICU_feature:n {#3} @@ -1062,11 +1095,11 @@ \tl_if_empty:NTF \l_tmpa_tl { \prg_return_false: } { - \intexpr_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } + \int_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } { \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} }{ - \intexpr_if_even:nTF {#2} + \int_if_even:nTF {#2} { \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} }{ @@ -1111,7 +1144,7 @@ \int_set:Nn \l_tmpb_int { \XeTeXOTcountscripts\zf@basefont } \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum \XeTeXOTscripttag\zf@basefont \l_tmpa_int = \l_fontspec_strnum_int \@tempswatrue @@ -1134,7 +1167,7 @@ } \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTlanguagetag\zf@basefont\l_fontspec_script_int \l_tmpa_int =\l_fontspec_strnum_int \@tempswatrue @@ -1162,7 +1195,7 @@ \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} \int_zero:N \l_tmpa_int \@tempswafalse - \bool_until_do:nn { \intexpr_compare_p:nNn \l_tmpa_int = \l_tmpb_int } + \bool_until_do:nn { \int_compare_p:nNn \l_tmpa_int = \l_tmpb_int } { \ifnum\XeTeXOTfeaturetag\zf@basefont\l_fontspec_script_int\l_fontspec_language_int \l_tmpa_int =\l_fontspec_strnum_int @@ -1185,8 +1218,8 @@ } \bool_new:N \l_fontspec_external_bool \define@key[zf]{preparse-external}{ExternalLocation}[]{ - \zf@nobftrue - \zf@noittrue + \bool_set_true:N \l_fontspec_nobf_bool + \bool_set_true:N \l_fontspec_noit_bool \bool_set_true:N \l_fontspec_external_bool \xetex_or_luatex:nnn { \cs_gset:Npn \fontspec_namewrap:n ##1 } { [ #1 ##1 ] } @@ -1204,7 +1237,7 @@ \define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num] {AAT,ICU,Graphite,Full,Basic}{ \fontspec_update_fontid:n {+rend:#1} - \intexpr_compare:nTF {\l_tmpa_num < 3} { + \int_compare:nTF {\l_tmpa_num < 3} { \xetex_or_luatex:nn { \tl_set:Nv \l_fontspec_renderer_tl {g_fontspec_renderer_tag_\l_tmpa_tl} @@ -1240,11 +1273,11 @@ \define@key[zf]{preparse-external}{BoldFont}{ \tl_if_empty:nTF {#1} { - \zf@nobftrue + \bool_set_true:N \l_fontspec_nobf_bool \fontspec_update_fontid:n {nobf} } { - \zf@nobffalse + \bool_set_false:N \l_fontspec_nobf_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} \fontspec_update_fontid:n {bf:#1} } @@ -1252,10 +1285,10 @@ \define@key[zf]{preparse-external}{ItalicFont}{ \tl_if_empty:nTF {#1} { - \zf@noittrue + \bool_set_true:N \l_fontspec_noit_bool \fontspec_update_fontid:n {noit} }{ - \zf@noitfalse + \bool_set_false:N \l_fontspec_noit_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} \fontspec_update_fontid:n {it:#1} } @@ -1275,10 +1308,10 @@ \define@key[zf]{options}{SmallCapsFont}{ \tl_if_empty:nTF {#1} { - \zf@nosctrue + \bool_set_true:N \l_fontspec_nosc_bool \fontspec_update_fontid:n {nosc} }{ - \zf@noscfalse + \bool_set_true:N \l_fontspec_nosc_bool \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} \fontspec_update_fontid:n {sc:\zap@space #1~\@empty} } @@ -1316,7 +1349,9 @@ \fontspec_update_fontid:n {bfslfeat:#1} } \define@key[zf]{options}{SmallCapsFeatures}{ - \unless\ifzf@firsttime\def\l_fontspec_fontfeat_sc_clist{, #1}\fi + \bool_if:NF \l_fontspec_firsttime_bool { + \def\l_fontspec_fontfeat_sc_clist{, #1} + } \fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty} } \define@key[zf]{preparse}{SizeFeatures}{ @@ -1362,9 +1397,9 @@ } \define@key[zf]{options}{WordSpace}{ \fontspec_update_fontid:n {+wordspace:#1} - \unless\ifzf@firsttime + \bool_if:NF \l_fontspec_firsttime_bool { \_fontspec_parse_wordspace:w #1,,,\q_stop - \fi + } } \cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { \tl_if_empty:nTF {#4} @@ -1377,8 +1412,7 @@ \dim_set:Nn \@tempdimb {#2\fontdimen3\zf@basefont} \dim_set:Nn \@tempdimc {#3\fontdimen4\zf@basefont} } - \tl_set:Nx \l_fontspec_postadjust_tl { - \l_fontspec_postadjust_tl + \tl_put_right:Nx \l_fontspec_postadjust_tl { \fontdimen2\font\the\@tempdima \fontdimen3\font\the\@tempdimb \fontdimen4\font\the\@tempdimc @@ -1387,7 +1421,11 @@ \define@key[zf]{options}{PunctuationSpace}{ \fontspec_update_fontid:n {+punctspace:#1} \setlength\@tempdima{#1\fontdimen7\zf@basefont} - \tl_set:Nx \l_fontspec_postadjust_tl {\l_fontspec_postadjust_tl\fontdimen7\font\the\@tempdima} + \tl_put_right:Nx \l_fontspec_postadjust_tl {\fontdimen7\font\the\@tempdima} +} +\define@key[zf]{options}{FontAdjustment}{ + \fontspec_update_fontid:n {+fontadjust:\detokenize{#1}} + \tl_put_right:Nx \l_fontspec_postadjust_tl {#1} } \define@key[zf]{options}{LetterSpace}{ \fontspec_update_fontid:n {+tracking:#1} @@ -1422,15 +1460,15 @@ \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl } { - \intexpr_compare:nTF { \tl_elt_count:n {#1} == 6 } + \int_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 } + \int_compare:nTF { \tl_elt_count:n {#1} == 8 } { \fontspec_parse_colour:viii #1 } { - \ifzf@firsttime\else + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {bad-colour} {#1} - \fi + } } } } @@ -1439,9 +1477,9 @@ \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 + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {opa-twice-col} {#7#8} - \fi + } } \tl_set:Nn \l_fontspec_opacity_tl {#7#8} } @@ -1452,9 +1490,9 @@ \setcounter {fontspec_tmp_int} { 255*\real{#1} } \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl { - \ifzf@firsttime\else + \bool_if:NF \l_fontspec_firsttime_bool { \fontspec_warning:nx {opa-twice} {#1} - \fi + } } \tl_set:Nx \l_fontspec_opacity_tl { \nhex2 { \value{fontspec_tmp_int} } } @@ -1487,21 +1525,20 @@ } \define@key[zf]{options}{OpticalSize}{ \xetex_or_luatex:nn { - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} \fontspec_update_fontid:n {+size:#1} - \fi - \ifzf@mm - \fontspec_update_fontid:n {+size:#1} - \fontspec_update_featstr:n{optical size=#1} - \fi - \ifzf@icu\else - \ifzf@mm\else - \ifzf@firsttime - \fontspec_warning:n {no-opticals} - \fi - \fi - \fi + }{ + \bool_if:NT \l_fontspec_mm_bool { + \fontspec_update_fontid:n {+size:#1} + \fontspec_update_featstr:n{optical size=#1} + } + } + \bool_if:nT { !\l_fontspec_icu_bool && !\l_fontspec_mm_bool }{ + \bool_if:NT \l_fontspec_firsttime_bool { + \fontspec_warning:n {no-opticals} + } + } }{ \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} \fontspec_update_fontid:n {+size:#1} @@ -1520,7 +1557,7 @@ \fontspec_update_featstr:n{embolden=#1} } \define@key[zf]{options}{AutoFakeSlant}[0.2]{ - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_slant_tl {#1} \clist_put_right:Nn \l_fontspec_fontfeat_it_clist {,FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_it_tl \l_fontspec_fontname_tl @@ -1530,10 +1567,10 @@ {,FakeBold=\l_fontspec_fake_embolden_tl,FakeSlant=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } - \fi + } } \define@key[zf]{options}{AutoFakeBold}[1.5]{ - \ifzf@firsttime + \bool_if:NT \l_fontspec_firsttime_bool { \tl_set:Nn \l_fontspec_fake_embolden_tl {#1} \tl_put_right:Nn \l_fontspec_fontfeat_bf_clist {,FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bf_tl \l_fontspec_fontname_tl @@ -1543,7 +1580,7 @@ {,FakeSlant=\l_fontspec_fake_slant_tl,FakeBold=#1} \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } - \fi + } } \fontspec_define_font_feature:n{Ligatures} \fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} @@ -1655,7 +1692,7 @@ \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_salt:n #1 } - {+salt=#1} { +salt= \intexpr_eval:n {#1+1} } + {+salt=#1} { +salt= \int_eval:n {#1+1} } \define@key[zf]{options}{Variant}{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Variant}{#1} @@ -1675,6 +1712,24 @@ } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } +\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptStyle}[]} +{ + \fontspec_update_fontid:n {+ssty=0} + \fontspec_update_featstr:n{+ssty=0} +} +{ + \fontspec_update_fontid:n {+ssty=1} + \fontspec_update_featstr:n{+ssty=1} +} +\xetex_or_luatex:nnn {\define@key[zf]{options}{ScriptScriptStyle}[]} +{ + \fontspec_update_fontid:n {+ssty=1} + \fontspec_update_featstr:n{+ssty=1} +} +{ + \fontspec_update_fontid:n {+ssty=2} + \fontspec_update_featstr:n{+ssty=2} +} \fontspec_define_font_feature:n{Style} \fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} \fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} @@ -1726,17 +1781,17 @@ \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_nalt:n #1 } - {+nalt=#1} { +nalt= \intexpr_eval:n {#1+1} } + {+nalt=#1} { +nalt= \int_eval:n {#1+1} } \fontspec_define_font_feature:n{Vertical} \define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{ - \ifzf@icu + \bool_if:NTF \l_fontspec_icu_bool { \fontspec_make_feature:nnn{}{}{+vrt2} \fontspec_update_fontid:n {+vert} \fontspec_update_featstr:n{vertical} - \else + }{ \fontspec_update_fontid:n {+vert} \fontspec_update_featstr:n{vertical} - \fi + } } \newfontscript{Arabic}{arab} \newfontscript{Armenian}{armn} \newfontscript{Balinese}{bali} \newfontscript{Bengali}{beng} @@ -2029,19 +2084,22 @@ \not@math@alphabet\upshape\relax \fontspec_blend_shape:nnn\updefault\sidefault\scdefault } -\@ifpackageloaded{euler}{\zf@package@euler@loadedtrue} - {\zf@package@euler@loadedfalse} +\@ifpackageloaded{euler}{ + \bool_set_true:N \g_fontspec_package_euler_loaded_bool +}{ + \bool_set_false:N \g_fontspec_package_euler_loaded_bool +} \cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler}{ - \ifzf@package@euler@loaded - \zf@math@eulertrue - \else + \bool_if:NTF \g_fontspec_package_euler_loaded_bool { + \bool_set_true:N \g_fontspec_math_euler_bool + }{ \fontspec_error:n {euler-too-late} - \fi + } }{} - \@ifpackageloaded{lucbmath}{\zf@math@lucidatrue}{} - \@ifpackageloaded{lucidabr}{\zf@math@lucidatrue}{} - \@ifpackageloaded{lucimatx}{\zf@math@lucidatrue}{} + \@ifpackageloaded{lucbmath}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucidabr}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} + \@ifpackageloaded{lucimatx}{\bool_set_true:N \g_fontspec_math_lucida_bool}{} \DeclareSymbolFont{legacymaths}{OT1}{cmr}{m}{n} \SetSymbolFont{legacymaths}{bold}{OT1}{cmr}{bx}{n} \DeclareMathAccent{\acute} {\mathalpha}{legacymaths}{19} @@ -2060,12 +2118,12 @@ \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi \group_end: - \ifzf@math@euler\else + \bool_if:NF \g_fontspec_math_euler_bool { \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} \DeclareMathSymbol{;}{\mathpunct}{legacymaths}{59} \DeclareMathSymbol{?}{\mathclose}{legacymaths}{63} - \ifzf@math@lucida\else + \bool_if:NF \g_fontspec_math_lucida_bool { \DeclareMathSymbol{0}{\mathalpha}{legacymaths}{`0} \DeclareMathSymbol{1}{\mathalpha}{legacymaths}{`1} \DeclareMathSymbol{2}{\mathalpha}{legacymaths}{`2} @@ -2095,8 +2153,8 @@ \DeclareMathDelimiter{]}{\mathclose}{legacymaths}{93}{largesymbols}{3} \DeclareMathDelimiter{/}{\mathord}{legacymaths}{47}{largesymbols}{14} \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} - \fi - \fi + } + } \DeclareSymbolFont{operators}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault \SetSymbolFont{operators}{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault \SetMathAlphabet\mathrm{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\updefault @@ -2105,52 +2163,52 @@ \SetMathAlphabet\mathsf{normal}\zf@enc\g_fontspec_mathsf_tl\mddefault\updefault \SetMathAlphabet\mathtt{normal}\zf@enc\g_fontspec_mathtt_tl\mddefault\updefault \SetSymbolFont{operators}{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault - \ifdefined\g_fontspec_bfmathrm_tl + \tl_if_empty:NTF \g_fontspec_bfmathrm_tl { + \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault + \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault + }{ \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\updefault \SetMathAlphabet\mathbf{bold}\zf@enc\g_fontspec_bfmathrm_tl\bfdefault\updefault \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_bfmathrm_tl\mddefault\itdefault - \else - \SetMathAlphabet\mathrm{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\g_fontspec_mathrm_tl\bfdefault\itdefault - \fi + } \SetMathAlphabet\mathsf{bold}\zf@enc\g_fontspec_mathsf_tl\bfdefault\updefault \SetMathAlphabet\mathtt{bold}\zf@enc\g_fontspec_mathtt_tl\bfdefault\updefault } \cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor}{ - \ifx\define@antt@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{arev}{\@zf@mathfalse}{} - \@ifpackageloaded{eulervm}{\@zf@mathfalse}{} - \@ifpackageloaded{mathdesign}{\@zf@mathfalse}{} - \@ifpackageloaded{concmath}{\@zf@mathfalse}{} - \@ifpackageloaded{cmbright}{\@zf@mathfalse}{} - \@ifpackageloaded{mathesf}{\@zf@mathfalse}{} - \@ifpackageloaded{gfsartemisia}{\@zf@mathfalse}{} - \@ifpackageloaded{gfsneohellenic}{\@zf@mathfalse}{} + \ifx\define@antt@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{arev}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{eulervm}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathdesign}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{concmath}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{cmbright}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathesf}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{gfsartemisia}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{gfsneohellenic}{\bool_set_false:N \g_fontspec_math_bool}{} \@ifpackageloaded{iwona}{ - \ifx\define@iwona@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{kpfonts}{\@zf@mathfalse}{} - \@ifpackageloaded{kmath}{\@zf@mathfalse}{} + \ifx\define@iwona@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{kpfonts}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{kmath}{\bool_set_false:N \g_fontspec_math_bool}{} \@ifpackageloaded{kurier}{ - \ifx\define@kurier@mathversions a\@zf@mathfalse\fi}{} - \@ifpackageloaded{fouriernc}{\@zf@mathfalse}{} - \@ifpackageloaded{fourier}{\@zf@mathfalse}{} - \@ifpackageloaded{mathpazo}{\@zf@mathfalse}{} - \@ifpackageloaded{mathptmx}{\@zf@mathfalse}{} - \@ifpackageloaded{MinionPro}{\@zf@mathfalse}{} - \@ifpackageloaded{unicode-math}{\@zf@mathfalse}{} - \@ifpackageloaded{breqn}{\@zf@mathfalse}{} - \if@zf@math + \ifx\define@kurier@mathversions a\bool_set_false:N \g_fontspec_math_bool\fi}{} + \@ifpackageloaded{fouriernc}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{fourier}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathpazo}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{mathptmx}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{MinionPro}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{unicode-math}{\bool_set_false:N \g_fontspec_math_bool}{} + \@ifpackageloaded{breqn}{\bool_set_false:N \g_fontspec_math_bool}{} + \bool_if:NT \g_fontspec_math_bool { \fontspec_info:n {setup-math} \fontspec_setup_maths: - \fi + } } \AtBeginDocument{\fontspec_maybe_setup_maths:} -\if@zf@configfile +\bool_if:NT \g_fontspec_cfg_bool { \InputIfFileExists{fontspec.cfg} {} {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} -\fi +} %% %% Copyright 2004--2010 Will Robertson <wspr81@gmail.com> %% Copyright 2009--2010 Khaled Hosny <khaledhosny@eglug.org> |