diff options
author | Karl Berry <karl@freefriends.org> | 2010-09-27 00:42:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2010-09-27 00:42:03 +0000 |
commit | 8c65eb5b73f80e0fcaa70910c1011adfa024d106 (patch) | |
tree | e60d460475e4bd2d9cd7edf1c3ea7d2a2e97d8df /Master/texmf-dist | |
parent | c6e683d9f29904267298eb3d33d8b0e657be3961 (diff) |
fontspec 2.1a (26sep10)
git-svn-id: svn://tug.org/texlive/trunk@19908 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
28 files changed, 1624 insertions, 1517 deletions
diff --git a/Master/texmf-dist/doc/latex/fontspec/README b/Master/texmf-dist/doc/latex/fontspec/README index be6318a5718..d0bc7a2e4c1 100644 --- a/Master/texmf-dist/doc/latex/fontspec/README +++ b/Master/texmf-dist/doc/latex/fontspec/README @@ -1,9 +1,9 @@ -THE FONTSPEC PACKAGE v2.1 -========================= +THE FONTSPEC PACKAGE +==================== -This is the initial release of the fontspec package with support for LuaTeX. -(Previously, fontspec was XeTeX-only.) +This is the initial generation of the fontspec package with support for +LuaLaTeX. (Previously, fontspec was XeLaTeX-only.) The fontspec package provides an automatic and unified interface for loading fonts in LaTeX. XeTeX and LuaTeX (the latter through the luaotfload package) @@ -15,6 +15,8 @@ available with AAT and OpenType fonts, including upper and lower case numbers, proportional and monospaced numbers, swash letters, ligature control, and many others. +See the documentation `fontspec.pdf` for full information. + Release versions of fontspec are available from CTAN: <http://tug.ctan.org/pkg/fontspec> @@ -143,6 +145,25 @@ gladly accepted! Change history -------------- +- v2.1a (2010/09/27) + + * Fix for colours bug introduced in the last update + * Fix for for bad interaction with LuaLaTeX and fallback fonts + (such as using \slshape when no slanted font specified) + * Behaviour/messaging improvement when scripts/languages are requested + that do not exist in the font + * Fix bug with detecting font features/scripts in some cases with: + + - `\fontspec_if_feature:n(TF)` + - `\fontspec_if_language:n(TF)` + - `\fontspec_if_current_script:n(TF)` + - `\fontspec_if_current_language:n(TF)` + + * Some messages in the log file are improved + * Code for "visible space" fixed for LuaLaTeX use + * Lots of internal changes to bring the implementation closer + to being "native expl3". + - v2.1 (2010/09/19) * Now load xunicode internally for consistent behaviour in 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 67d0d9dd081..014448e5c43 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 8b7cca7cf91..6ac22a36eb8 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 cd8158afd28..606da5ca8e2 100644 --- a/Master/texmf-dist/source/latex/fontspec/Makefile +++ b/Master/texmf-dist/source/latex/fontspec/Makefile @@ -4,6 +4,7 @@ SHELL = /bin/sh .SUFFIXES: +.SILENT: #### BEGIN #### @@ -34,6 +35,9 @@ NAME = fontspec DOC = $(NAME).pdf DTX = $(NAME).dtx +# Redefine this to print output if you need: +REDIRECT = > /dev/null + # Files grouped by generation mode COMPILED = $(DOC) fontspec-testsuite.pdf EXAMPLES = fontspec-example.tex @@ -67,10 +71,10 @@ CTAN_ZIP = $(NAME).zip TDS_ZIP = $(NAME).tds.zip ZIPS = $(CTAN_ZIP) $(TDS_ZIP) -DO_PDFLATEX = pdflatex --interaction=batchmode $< >/dev/null -DO_PDFLATEX_WRITE18 = pdflatex --shell-escape --interaction=batchmode $< >/dev/null -DO_TEX = tex --interaction=batchmode $< >/dev/null -DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) >/dev/null 2>&1 +DO_PDFLATEX = pdflatex --interaction=nonstopmode $< $(REDIRECT) +DO_PDFLATEX_WRITE18 = pdflatex --shell-escape --interaction=nonstopmode $< $(REDIRECT) +DO_TEX = tex --interaction=nonstopmode $< $(REDIRECT) +DO_MAKEINDEX = makeindex -s gind.ist $(subst .dtx,,$<) $(REDIRECT) 2>&1 all: $(GENERATED) doc: $(COMPILED) @@ -119,7 +123,7 @@ README: README.markdown fontspec-testsuite.pdf: $(DTX) @echo 'Compiling test suite.' $(DO_PDFLATEX) - xelatex --interaction=batchmode fontspec-testsuite.tex + xelatex --interaction=nonstopmode fontspec-testsuite.tex $(REDIRECT) .PHONY: install manifest clean mrproper @@ -167,7 +171,7 @@ SUITESOURCE = \ $(testdir)/testsuite.cls \ $(testdir)/$(TESTLIST) -TESTOUT = $(shell ls $(testdir)/*.safe.pdf) +TESTOUT = $(shell ls $(testdir)/*.*safe.pdf) BUILDTESTSRC = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.ltx,$(TESTOUT))) BUILDTESTTARGET = $(subst $(testdir)/,$(builddir)/,$(subst .safe.pdf,.diff.pdf,$(TESTOUT))) @@ -194,112 +198,118 @@ $(builddir)/%: % #### Generating new tests #### -lonelystub = $(shell cd $(testdir); ls | egrep '($(xprefix)|$(lprefix))(.*\.ltx)|(.*\.safe.pdf)' | cut -d . -f 1 | uniq -u) +lonelystub = $(shell cd $(testdir); ls | egrep '(X|L)(.*\.ltx)|(X|L)(.*\.safe.pdf)' | cut -d . -f 1 | uniq -u) lonelyfile = $(addsuffix .safe.pdf,$(lonelystub)) lonelypath = $(addprefix $(testdir)/,$(lonelyfile)) lonelytest = $(addprefix $(builddir)/,$(addsuffix .pdf,$(lonelystub))) -bothlonelystub = $(shell cd $(testdir); ls | egrep '($(both).*\.ltx)|($(both).*\.safe.pdf)' | cut -d . -f 1 | uniq -u) -bothlonelyfile = $(addsuffix .safe.pdf,$(bothlonelystub)) -bothlonelypath = $(addprefix $(testdir)/,$(bothlonelyfile)) -bothlonelytest = $(addprefix $(builddir)/,$(addsuffix .pdf,$(bothlonelystub))) +Xlonelystub = $(shell cd $(testdir); ls | egrep '(F.*\.ltx)|(F.*.Xsafe.pdf)' | cut -d . -f 1 | uniq -u) +Xlonelyfile = $(addsuffix .Xsafe.pdf,$(Xlonelystub)) +Xlonelypath = $(addprefix $(testdir)/,$(Xlonelyfile)) +Xlonelytest = $(addprefix $(builddir)/,$(addsuffix -X.pdf,$(Xlonelystub))) -initest: $(lonelypath) $(bothlonelypath) +Llonelystub = $(shell cd $(testdir); ls | egrep '(F.*\.ltx)|(F.*.Lsafe.pdf)' | cut -d . -f 1 | uniq -u) +Llonelyfile = $(addsuffix .Lsafe.pdf,$(Llonelystub)) +Llonelypath = $(addprefix $(testdir)/,$(Llonelyfile)) +Llonelytest = $(addprefix $(builddir)/,$(addsuffix -L.pdf,$(Llonelystub))) -$(lonelypath): $(lonelytest) - @$(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@ +initest: $(lonelypath) $(Xlonelypath) $(Llonelypath) -$(bothlonelypath): $(bothlonelytest) - @$(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@ +$(lonelypath): $(lonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.safe.pdf/.pdf/` $@ -#### REFERENCE OUTPUT GENERATION #### +$(Xlonelypath): $(Xlonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.Xsafe.pdf/-X.pdf/` $@ -$(builddir)/$(both)%.gendiff.pdf: $(builddir)/$(both)%-$(lprefix).pdf $(builddir)/$(both)%-$(xprefix).pdf - @echo '$(both)$*: Comparing PDF from LuaLaTeX with PDF from XeLaTeX.' - @if test $(shell compare \ - $(COMPARE_OPTS) \ - $(builddir)/$(both)$*-$(lprefix).pdf \ - $(builddir)/$(both)$*-$(xprefix).pdf \ - $(builddir)/$(both)$*.gendiff.pdf 2>&1) -lt 1 ; then \ - echo '$(both)$*: Test generation successed.' ; \ - else \ - echo '$(both)$*: Test generation failed; XeLaTeX and LuaLaTeX gave different output.' ; \ - false ; \ - fi +$(Llonelypath): $(Llonelytest) + $(COPY) `echo $@ | sed -e s/$(testdir)/$(builddir)/ -e s/.Lsafe.pdf/-L.pdf/` $@ -$(builddir)/$(both)%.pdf: $(builddir)/$(both)%.gendiff.pdf - $(MOVE) $(builddir)/$(both)$*-$(xprefix).pdf $(builddir)/$(both)$*.pdf #### TESTS FOR BOTH ENGINES #### -$(builddir)/$(both)%.diff.pdf: $(builddir)/$(both)%-$(lprefix).pdf $(builddir)/$(both)%-$(xprefix).pdf - @echo '$(both)$*: Comparing PDF from LuaLaTeX against reference output.' - @if test $(shell compare \ +$(builddir)/F%-L.diff.pdf: $(builddir)/F%-L.pdf + @echo 'F$*: Comparing PDF from LuaLaTeX against reference output.' + if test $(shell compare \ $(COMPARE_OPTS) \ - $(builddir)/$(both)$*-$(lprefix).pdf \ - $(testdir)/$(both)$*.safe.pdf \ - $(builddir)/$(both)$*.diff.pdf 2>&1) -le 1 ; then \ - echo '$(both)$*: Test passed.' ; \ + $(builddir)/F$*-L.pdf \ + $(testdir)/F$*.Lsafe.pdf \ + $(builddir)/F$*-L.diff.pdf 2>&1) -le 1 ; then \ + echo 'F$*: Test passed.' ; \ else \ - echo '$(both)$*: Test failed.' ; \ + echo 'F$*: Test failed.' ; \ false ; \ fi - @echo '$(both)$*: Comparing PDF from XeLaTeX against reference output.' - @if test $(shell compare \ + +$(builddir)/F%-X.diff.pdf: $(builddir)/F%-X.pdf + @echo 'F$*: Comparing PDF from LuaLaTeX against reference output.' + if test $(shell compare \ $(COMPARE_OPTS) \ - $(builddir)/$(both)$*-$(xprefix).pdf \ - $(testdir)/$(both)$*.safe.pdf \ - $(builddir)/$(both)$*.diff.pdf 2>&1) -le 1 ; then \ - echo '$(both)$*: Test passed.' ; \ + $(builddir)/F$*-X.pdf \ + $(testdir)/F$*.Xsafe.pdf \ + $(builddir)/F$*-X.diff.pdf 2>&1) -le 1 ; then \ + echo 'F$*: Test passed.' ; \ else \ - echo '$(both)$*: Test failed.' ; \ + echo 'F$*: Test failed.' ; \ false ; \ fi -$(builddir)/$(both)%-$(lprefix).pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/$(both)%.ltx - @echo '$(both)$*: Generating PDF output with LuaLaTeX.' - @cd $(builddir); lualatex -jobname=$(both)$*-$(lprefix) -interaction=batchmode $(both)$*.ltx > /dev/null +$(builddir)/F%-L.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/F%-L.ltx + @echo 'F$*: Generating PDF output with LuaLaTeX.' + @cd $(builddir); lualatex -interaction=nonstopmode F$*-L.ltx $(REDIRECT) + +$(builddir)/F%-X.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/F%-X.ltx + @echo 'F$*: Generating PDF output with XeLaTeX.' + @cd $(builddir); xelatex -interaction=nonstopmode F$*-X.ltx $(REDIRECT) -$(builddir)/$(both)%-$(xprefix).pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/$(both)%.ltx - @echo '$(both)$*: Generating PDF output with XeLaTeX.' - @cd $(builddir); xelatex -jobname=$(both)$*-$(xprefix) -interaction=batchmode $(both)$*.ltx > /dev/null +$(builddir)/F%-L.ltx: $(builddir)/F%.ltx + $(COPY) $< $@ + +$(builddir)/F%-X.ltx: $(builddir)/F%.ltx + $(COPY) $< $@ #### TEST FOR EACH ENGINE INDIVIDUALLY #### -$(builddir)/$(lprefix)%.diff.pdf: $(builddir)/$(lprefix)%.pdf - @echo '$(lprefix)$*: Comparing PDF against reference output.' - @if test $(shell compare $(COMPARE_OPTS) \ - $(builddir)/$(lprefix)$*.pdf $(testdir)/$(lprefix)$*.safe.pdf \ - $(builddir)/$(lprefix)$*.diff.pdf 2>&1) -le 1 ; then \ - echo '$(lprefix)$*: Test passed.' ; \ +$(builddir)/L%.diff.pdf: $(builddir)/L%.pdf + @echo 'L$*: Comparing PDF against reference output.' + if test $(shell compare $(COMPARE_OPTS) \ + $(builddir)/L$*.pdf $(testdir)/L$*.safe.pdf \ + $(builddir)/L$*.diff.pdf 2>&1) -le 1 ; then \ + echo 'L$*: Test passed.' ; \ else \ - echo '$(lprefix)$*: Test failed.' ; \ + echo 'L$*: Test failed.' ; \ false ; \ fi -$(builddir)/$(xprefix)%.diff.pdf: $(builddir)/$(xprefix)%.pdf - @echo '$(xprefix)$*: Comparing PDF against reference output.' - @if test $(shell compare \ +$(builddir)/X%.diff.pdf: $(builddir)/X%.pdf + @echo 'X$*: Comparing PDF against reference output.' + if test $(shell compare \ $(COMPARE_OPTS) \ - $(builddir)/$(xprefix)$*.pdf \ - $(testdir)/$(xprefix)$*.safe.pdf \ - $(builddir)/$(xprefix)$*.diff.pdf 2>&1) -le 1 ; then \ - echo '$(xprefix)$*: Test passed.' ; \ + $(builddir)/X$*.pdf \ + $(testdir)/X$*.safe.pdf \ + $(builddir)/X$*.diff.pdf 2>&1) -le 1 ; then \ + echo 'X$*: Test passed.' ; \ else \ - echo '$(xprefix)$*: Test failed.' ; \ + echo 'X$*: Test failed.' ; \ false ; \ fi -$(builddir)/$(xprefix)%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/$(xprefix)%.ltx - @echo '$(xprefix)$*: Generating PDF output with XeLaTeX.' - @cd $(builddir); xelatex -interaction=batchmode $(xprefix)$*.ltx > /dev/null +$(builddir)/X%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/X%.ltx + @echo 'X$*: Generating PDF output with XeLaTeX.' + @cd $(builddir); xelatex -interaction=nonstopmode X$*.ltx $(REDIRECT) -$(builddir)/$(lprefix)%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/$(lprefix)%.ltx - @echo '$(lprefix)$*: Generating PDF output with LuaLaTeX.' - @cd $(builddir); lualatex -interaction=batchmode $(lprefix)$*.ltx > /dev/null +$(builddir)/L%.pdf: $(BUILDSOURCE) $(BUILDSUITE) $(builddir)/L%.ltx + @echo 'L$*: Generating PDF output with LuaLaTeX.' + @cd $(builddir); lualatex -interaction=nonstopmode L$*.ltx $(REDIRECT) #### HACK: allow `make <foobar>` run that test. -%: build/%.ltx - make build/$*.diff.pdf
\ No newline at end of file +L%: build/L%.ltx + make build/L$*.diff.pdf + +X%: build/X%.ltx + make build/X$*.diff.pdf + +F%: build/F%.ltx + make build/F$*-L.diff.pdf + make build/F$*-X.diff.pdf
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx index 12c452c0f61..471fd81cdf9 100644 --- a/Master/texmf-dist/source/latex/fontspec/fontspec.dtx +++ b/Master/texmf-dist/source/latex/fontspec/fontspec.dtx @@ -43,11 +43,11 @@ This work consists of this file fontspec.dtx \let\MetaPrefix\DoubleperCent \generate{\file{fontspec.sty} {\from{fontspec.dtx}{fontspec}}} \generate{\file{fontspec-patches.sty} {\from{fontspec.dtx}{patches}}} +\generate{\file{fontspec-testsuite.tex}{\from{fontspec.dtx}{testsuite}}} \nopreamble\nopostamble \generate{\file{fontspec.cfg} {\from{fontspec.dtx}{cfg}}} \generate{\file{fontspec-example.tex} {\from{fontspec.dtx}{example}}} -\generate{\file{fontspec-testsuite.tex}{\from{fontspec.dtx}{testsuite}}} \def\tmpa{plain} \ifx\tmpa\fmtname\endgroup\expandafter\bye\fi @@ -62,7 +62,7 @@ This work consists of this file fontspec.dtx %<fontspec>\ProvidesPackage{fontspec} %<patches>\ProvidesPackage{fontspec-patches} %<*fontspec|patches> - [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/09/27 v2.1a Advanced font selection for XeLaTeX/LuaLaTeX] %</fontspec|patches> % %<*driver> @@ -620,8 +620,6 @@ This work consists of this file fontspec.dtx % Nested emphasis is controlled by the \cs{eminnershape} command. % For example, for |\emph{\emph{...}}| to produce small caps:\par % \indent|\renewcommand\eminnershape{\scshape}|\par\noindent -% \XeTeX\ users will need to load the \pkg{xltxtra} package before the -% advice above works. % % % @@ -1286,10 +1284,11 @@ This work consists of this file fontspec.dtx % `Ordinals': 1st 2nd 3rd 4th 0th % \end{Lexample} % -% The \pkg{realscripts} package (yet to be released) -% (or \pkg{xltxtra} for \XeTeX) +% The \pkg{realscripts} package +% (which is also loaded \pkg{xltxtra} for \XeTeX) % redefines the \cmd\textsubscript\ and -% \cmd\textsuperscript\ commands to use the above font features automatically. +% \cmd\textsuperscript\ commands to use the above font features automatically, +% including for use in footnote labels. % % % \subsection{Fractions} @@ -1960,8 +1959,11 @@ This work consists of this file fontspec.dtx % 1st 2nd 3rd 4th 0th 8abcde % \end{Xexample} % -% The \pkg{xltxtra} package redefines the \cmd\textsubscript\ and -% \cmd\textsuperscript\ commands to use the above font features. +% The \pkg{realscripts} package +% (also loaded by \pkg{xltxtra}) +% redefines the \cmd\textsubscript\ and +% \cmd\textsuperscript\ commands to use the above font features, +% including for use in footnote labels. % % \subsection{Fractions} % Many fonts come with the capability to typeset various forms of @@ -2498,15 +2500,24 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \paragraph{Counters} % \begin{macrocode} -\newcount\c@zf@newff -\newcount\c@zf@index -\newcount\c@zf@script -\newcount\c@zf@language +\int_new:N \l_fontspec_script_int +\int_new:N \l_fontspec_language_int \int_new:N \l_fontspec_strnum_int % \end{macrocode} % Temporary definition until expl3 has been updated to include this: % \begin{macrocode} \cs_set:Npn \use:x #1 { \edef\@tempa{#1}\@tempa } + +\cs_if_exist:NF \str_if_eq:xxTF { + \cs_set_eq:NN \str_if_eq_p:xx \tl_if_eq_p:xx + \cs_set_eq:NN \str_if_eq:xxTF \tl_if_eq:xxTF + \cs_set_eq:NN \str_if_eq:xxT \tl_if_eq:xxT + \cs_set_eq:NN \str_if_eq:xxF \tl_if_eq:xxF + \cs_set_eq:NN \str_if_eq_p:nn \tl_if_eq_p:nn + \cs_set_eq:NN \str_if_eq:nnTF \tl_if_eq:nnTF + \cs_set_eq:NN \str_if_eq:nnT \tl_if_eq:nnT + \cs_set_eq:NN \str_if_eq:nnF \tl_if_eq:nnF +} % \end{macrocode} % % \begin{macrocode} @@ -2514,18 +2525,12 @@ This work consists of this file fontspec.dtx \cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4} % \end{macrocode} % -% -% \begin{macro}{\fontspec_glyph_if_exist:NnTF} +% Need these: % \begin{macrocode} -\prg_new_conditional:Nnn \fontspec_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: - \prg_return_true: - \else: - \prg_return_false: - \fi: -} +\cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \int_set:Nn {Nv} +\cs_generate_variant:Nn \tl_gset:Nn {cV} % \end{macrocode} -% \end{macro} % % % \begin{macrocode} @@ -2539,7 +2544,7 @@ This work consists of this file fontspec.dtx } % \end{macrocode} % -% \subsection{Error/warning messages} +% \subsection{Error/warning/info messages} % % Shorthands for messages: % \begin{macrocode} @@ -2570,7 +2575,7 @@ This work consists of this file fontspec.dtx } \msg_new:nnn {fontspec} {no-glyph} { - '\zf@fontname'~ does~ not~ contain~ glyph~ #1. + '\l_fontspec_fontname_tl'~ does~ not~ contain~ glyph~ #1. } \msg_new:nnnn {fontspec} {unknown-options} { @@ -2620,38 +2625,40 @@ This work consists of this file fontspec.dtx } \msg_new:nnn {fontspec} {script-not-exist} { - Font~ '\zf@fontname'~ does~ not~ contain~ script~ '#1'. + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ + 'Latin'~ script~ used~ instead. } \msg_new:nnn {fontspec} {aat-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ - for~ AAT~ font~ '\zf@fontname'. + for~ AAT~ font~ '\l_fontspec_fontname_tl'. } \msg_new:nnn {fontspec} {aat-feature-not-exist-in-font} { AAT~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\ - in~ font~ '\zf@fontname'. + in~ font~ '\l_fontspec_fontname_tl'. } \msg_new:nnn {fontspec} {icu-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ - for~ ICU~ font~ '\zf@fontname' + for~ ICU~ font~ '\l_fontspec_fontname_tl' } \msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} { OpenType~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\ - for~ font~ '\zf@fontname', \\ + for~ font~ '\l_fontspec_fontname_tl', \\ with~ script~ '\l_fontspec_script_name_tl',~ and~ language~ '\l_fontspec_lang_name_tl'. } \msg_new:nnn {fontspec} {no-opticals} { - '\zf@fontname'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. + '\l_fontspec_fontname_tl'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. } \msg_new:nnn {fontspec} {language-not-exist} { Language~ '#1'~ not~ available\\ - for~ font~ '\zf@fontname'\\ - with~ script~ '\l_fontspec_script_name_tl'. + for~ font~ '\l_fontspec_fontname_tl'~ + with~ script~ '\l_fontspec_script_name_tl'.\\ + 'Default'~ language~ used~ instead. } \msg_new:nnn {fontspec} {only-xetex-feature} { @@ -2679,7 +2686,23 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \msg_new:nnn {fontspec} {defining-font} { - Defining~ font~ family~ for~ '#2'~ with~ options~ [\zf@default@options #1]. + Defining~ font~ family~ for~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. +} +\msg_new:nnn {fontspec} {defining-raw} +{ + Defining~ shape~ + '\prg_case_str:nnn {#1} { + {\mddefault/\updefault} {normal} + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\updefault} {bold} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\itdefault} {italic} + {\mddefault/\sidefault} {italic~ small~ caps} + {\bfdefault/\itdefault} {bold~ italic} + {\bfdefault/\sidefault} {bold~ italic~ small~ caps} + } {#1}'~ + with~ NFSS~ specification: \\ + \l_fontspec_nfss_tl } \msg_new:nnn {fontspec} {no-font-shape} { @@ -2687,7 +2710,7 @@ This work consists of this file fontspec.dtx } \msg_new:nnn {fontspec} {set-scale} { - \zf@fontname\space scale ~=~ \l_fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale ~=~ \l_fontspec_scale_tl. } \msg_new:nnn {fontspec} {setup-math} { @@ -2695,7 +2718,7 @@ This work consists of this file fontspec.dtx } \msg_new:nnn {fontspec} {no-scripts} { - Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information. + Font~ \l_fontspec_fontname_tl\space does~ not~ contain~ any~ OpenType~ `Script'~ information. } \msg_new:nnn {fontspec} {opa-twice} { @@ -2869,16 +2892,16 @@ This work consists of this file fontspec.dtx % fonts should be used in \cmd\boldmath. % \begin{macrocode} \DeclareDocumentCommand \setmathrm { O{} m } { - \fontspec_set_family:Nnn \zf@rmmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} } \DeclareDocumentCommand \setboldmathrm { O{} m } { - \fontspec_set_family:Nnn \zf@rmboldmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} } \DeclareDocumentCommand \setmathsf { O{} m } { - \fontspec_set_family:Nnn \zf@sfmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} } \DeclareDocumentCommand \setmathtt { O{} m } { - \fontspec_set_family:Nnn \zf@ttmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm @@ -2888,9 +2911,9 @@ This work consists of this file fontspec.dtx % If the commands above are not executed, then \cmd\rmdefault\ (\etc) % will be used. % \begin{macrocode} -\def\zf@rmmaths{\rmdefault} -\def\zf@sfmaths{\sfdefault} -\def\zf@ttmaths{\ttdefault} +\def\g_fontspec_mathrm_tl{\rmdefault} +\def\g_fontspec_mathsf_tl{\sfdefault} +\def\g_fontspec_mathtt_tl{\ttdefault} % \end{macrocode} % \end{macro} \end{macro} \end{macro} % \end{macro} @@ -2935,12 +2958,14 @@ This work consists of this file fontspec.dtx % This macro takes one argument that consists of all of feature % options that will be applied by default to all subsequent % \cs{fontspec}, et al., commands. It stores its value in -% \cs{zf@default@options} (initialised empty), which is +% \cs{g_fontspec_default_fontopts_tl} (initialised empty), which is % concatenated with the individual macro choices in the -% \cs{zf@get@feature@requests} macro. +% [...] macro. % \begin{macrocode} -\DeclareDocumentCommand \defaultfontfeatures {m} {\def\zf@default@options{#1,}} -\let\zf@default@options\@empty +\DeclareDocumentCommand \defaultfontfeatures {m} { + \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} +} +\tl_clear:N \g_fontspec_default_fontopts_tl % \end{macrocode} % \end{macro} % @@ -2958,7 +2983,7 @@ This work consists of this file fontspec.dtx % font again with the top level \cs{fontspec} command. % % The default options are \emph{not} applied (which is why -% \cs{zf@default@options} is emptied inside the group; this is allowed +% \cs{g_fontspec_default_fontopts_tl} is emptied inside the group; this is allowed % as \cmd\zf@family\ is globally defined in \cmd\fontspec_select:nn), so this % means that the only added features to the font are strictly those % specified by this command. @@ -2968,21 +2993,21 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \DeclareDocumentCommand \addfontfeatures {m} { \ifcsname zf@family@fontdef\f@family\endcsname - \begingroup - \let\zf@default@options\@empty + \group_begin: + \tl_clear:N \g_fontspec_default_fontopts_tl \use:x { \exp_not:N\fontspec_select:nn {\csname zf@family@options\f@family\endcsname,#1} {\csname zf@family@fontname\f@family\endcsname} } - \endgroup + \group_end: \fontfamily\zf@family\selectfont \else \fontspec_warning:n {addfontfeatures-ignored} \fi \ignorespaces } -\let\addfontfeature\addfontfeatures +\cs_set_eq:NN \addfontfeature \addfontfeatures % \end{macrocode} % \end{macro} % @@ -2992,19 +3017,12 @@ This work consists of this file fontspec.dtx % \begin{macro}{\newfontfeature} % \cs{newfontfeature} takes two arguments: the name of the feature % tag by which to reference it, and the string that is used to -% select the font feature. It uses a counter to keep track of the -% number of new features introduced; every time a new feature is -% defined, a control sequence is defined made up of the -% concatenation of |+zf-| and the new feature tag. This long-winded -% control sequence is then called upon to update the font family -% string when a new instance is requested. +% select the font feature. % \begin{macrocode} \DeclareDocumentCommand \newfontfeature {mm} { - \stepcounter{zf@newff} - \cs_set:cpx{+zf-#1}{+zf-\the\c@zf@newff} \define@key[zf]{options}{#1}[]{ - \zf@update@family{\csname+zf-#1\endcsname} - \zf@update@ff{#2} + \fontspec_update_fontid:n {+zf-#1} + \fontspec_update_featstr:n {#2} } } % \end{macrocode} @@ -3018,12 +3036,12 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \DeclareDocumentCommand \newAATfeature {mmmm} { \unless\ifcsname zf@options@#1\endcsname - \zf@define@font@feature{#1} + \fontspec_define_font_feature:n{#1} \fi \key@ifundefined[zf]{#1}{#2}{}{ \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \zf@define@feature@option{#1}{#2}{#3}{#4}{} + \fontspec_define_feature_option:nnnnn{#1}{#2}{#3}{#4}{} } % \end{macrocode} % \end{macro} @@ -3036,12 +3054,12 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \DeclareDocumentCommand \newICUfeature {mmm} { \unless\ifcsname zf@options@#1\endcsname - \zf@define@font@feature{#1} + \fontspec_define_font_feature:n{#1} \fi \key@ifundefined[zf]{#1}{#2}{}{ \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \zf@define@feature@option{#1}{#2}{}{}{#3} + \fontspec_define_feature_option:nnnnn{#1}{#2}{}{}{#3} } \cs_set_eq:NN \newopentypefeature \newICUfeature % \end{macrocode} @@ -3080,11 +3098,12 @@ This work consists of this file fontspec.dtx { \define@key[zf@feat]{Script}{#1}[]{ \fontspec_check_script:nTF {#2} { - \zf@update@family{+script=#1} + \fontspec_update_fontid:n {+script=#1} \tl_set:Nn \l_fontspec_script_tl {#2} - \c@zf@script=\l_fontspec_strnum_int\relax + \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} }{ \fontspec_warning:nx {script-not-exist} {#1} + \setkeys[zf@feat]{Script}{Latin} } } } @@ -3110,11 +3129,12 @@ This work consists of this file fontspec.dtx { \define@key[zf@feat]{Lang}{#1}[]{ \fontspec_check_lang:nTF {#2} { - \zf@update@family{+lang=#1} + \fontspec_update_fontid:n {+lang=#1} \tl_set:Nn \l_fontspec_lang_tl {#2} - \c@zf@language=\l_fontspec_strnum_int\relax + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} }{ \fontspec_warning:nx {language-not-exist} {#1} + \setkeys[zf@feat]{Lang}{Default} } } } @@ -3167,21 +3187,17 @@ This work consists of this file fontspec.dtx % feature (|#1|,|#2|). % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} \ifzf@atsui - \fontspec_make_AAT_feature_string:nn{#1}{#2} - \ifx\@tempa\@empty - \prg_return_false: - \else - \prg_return_true: - \fi + \fontspec_make_AAT_feature_string:nnTF {#1}{#2} + \prg_return_true: \prg_return_false: \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3192,7 +3208,7 @@ This work consists of this file fontspec.dtx % Always true for LuaTeX fonts. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 @@ -3200,9 +3216,9 @@ This work consists of this file fontspec.dtx \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3214,23 +3230,21 @@ This work consists of this file fontspec.dtx % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \int_set:Nn \c@zf@script - {\use:c {g_fontspec_script_num_(\zf@family)_tl}} - \int_set:Nn \c@zf@language - {\use:c {g_fontspec_lang_num_(\zf@family)_tl}} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\zf@family)_tl} + \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 \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3241,19 +3255,19 @@ This work consists of this file fontspec.dtx % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax - \fontspec_iv_str_to_num:n{#2} \c@zf@language = \l_fontspec_strnum_int \relax + \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 - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3265,7 +3279,7 @@ This work consists of this file fontspec.dtx % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 @@ -3273,9 +3287,9 @@ This work consists of this file fontspec.dtx \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3287,20 +3301,19 @@ This work consists of this file fontspec.dtx % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl} - \int_set:Nn \c@zf@script - {\use:c {g_fontspec_script_num_(\zf@family)_tl}} + \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 - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3312,19 +3325,19 @@ This work consists of this file fontspec.dtx % font. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 \tl_set:Nn \l_fontspec_script_tl {#1} - \fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax + \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 - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3335,18 +3348,18 @@ This work consists of this file fontspec.dtx % OpenType script tag |#1|. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl} + \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} @@ -3356,26 +3369,22 @@ This work consists of this file fontspec.dtx % OpenType language tag |#1|. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl} + \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } % \end{macrocode} % \end{macro} % -% Need this: -% \begin{macrocode} -\cs_generate_variant:Nn \tl_if_eq:nnTF {nv} -% \end{macrocode} % % \begin{macro}{\fontspec_set_family:Nnn} % \darg{family} @@ -3413,6 +3422,7 @@ This work consists of this file fontspec.dtx % % Beginnings of an `l3font', I guess: % \begin{macrocode} +\cs_set_eq:NN \font_set_eq:NN \tex_let:D \cs_new:Npn \font_set:Nnn #1#2#3 { \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop: } @@ -3421,6 +3431,18 @@ This work consists of this file fontspec.dtx } % \end{macrocode} % +% \begin{macro}{\font_glyph_if_exist:NnTF} +% \begin{macrocode} +\prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { + \etex_iffontchar:D #1 #2 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: +} +% \end{macrocode} +% \end{macro} +% % % \subsection{Internal macros} % \label{sec:codeinternal} @@ -3439,20 +3461,23 @@ This work consists of this file fontspec.dtx % family for that font and put the family name (globally) into \cs{zf@family}. % The \TeX\ `\cs{font}' command is (globally) stored in \cs{zf@basefont}. % -% This macro does its processing inside a group to attempt to restrict the scope of its internal processing. This works to some degree to insulate the internal commands from having to be manually. +% This macro does its processing inside a group to attempt to restrict the scope of its internal processing. This works to some degree to insulate the internal commands from having to be manually cleared. % \begin{macrocode} \cs_set:Npn \fontspec_select:nn #1#2 { - \begingroup + \group_begin: \fontspec_init: % \end{macrocode} -% \cmd{\zf@fontname} is used as the generic name of the font being defined. -% \cmd{\zf@family@long} is the unique identifier of the font with all its +% \cmd{\l_fontspec_fontname_tl} is used as the generic name of the font being defined. +% \cmd{\l_fontspec_fontid_tl} is the unique identifier of the font with all its % features. -% \cmd{\zf@up} is the font specifically to be used as the upright font. +% \cmd{\l_fontspec_fontname_up_tl} is the font specifically to be used as the upright font. % \begin{macrocode} - \edef\zf@fontname{#2} - \let\zf@family@long\zf@fontname - \let\zf@up\zf@fontname + \tl_set:Nx \l_fontspec_fontname_tl {#2} + \luatex_if_engine:T { + \tl_replace_all_in:Nnn \l_fontspec_fontname_tl {~} {} + } + \tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl % \end{macrocode} % Now convert the requested features to font definition % strings. First the features are parsed for information about font @@ -3470,7 +3495,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \fontspec_preparse_features:nn {#1}{#2} \fontspec_set_scriptlang: - \fontspec_get_features:n {\zf@font@feat} + \fontspec_get_features:n {} \zf@firsttimefalse % \end{macrocode} % Check if the family is unique and, if so, save its information. @@ -3493,7 +3518,7 @@ This work consists of this file fontspec.dtx \fontspec_set_bold_italic: \fontspec_set_bold_slanted: } - \endgroup + \group_end: } % \end{macrocode} % \end{macro} @@ -3516,21 +3541,21 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \fontspec_if_detect_external:nT {#2} { \setkeys[zf]{preparse-external}{ExternalLocation} } - \fontspec_setkeys:xx {preparse-external} {\zf@default@options #1} + \fontspec_setkeys:xx {preparse-external} {\g_fontspec_default_fontopts_tl #1} % \end{macrocode} -% When \cmd{\zf@fontname} is augmented with a prefix or whatever to create -% the name of the upright font (\cmd{\zf@up}), this latter is the new `general +% When \cmd{\l_fontspec_fontname_tl} is augmented with a prefix or whatever to create +% the name of the upright font (\cmd{\l_fontspec_fontname_up_tl}), this latter is the new `general % font name' to use. % \begin{macrocode} - \let\zf@fontname\zf@up + \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl \fontspec_setkeys:xx {preparse} {\XKV@rm} - \let\zf@font@feat\XKV@rm + \clist_set_eq:NN \l_fontspec_fontfeat_clist \XKV@rm % \end{macrocode} % Finally save the `confirmed' font definition. % \begin{macrocode} - \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt} + \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} \fontspec_set_font_type: - \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt} + \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} \zf@basefont % this is necessary for LuaLaTeX to check the scripts properly } % \end{macrocode} @@ -3575,7 +3600,7 @@ This work consists of this file fontspec.dtx % The font name is fully expanded, in case it's defined in terms of macros, before having its spaces zapped. % \begin{macrocode} \prg_new_conditional:Nnn \fontspec_save_family:n {T} { - \cs_if_exist:cF {g_fontspec_UID_\zf@family@long} + \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} { \cs_if_exist:cTF {g_fontspec_family_#1_int} { \int_gincr:c {g_fontspec_family_#1_int} @@ -3583,12 +3608,12 @@ This work consists of this file fontspec.dtx \int_new:c {g_fontspec_family_#1_int} } \edef\@tempa{#1~} - \tl_gset:cx {g_fontspec_UID_\zf@family@long} { + \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl} { \expandafter\zap@space\@tempa\@empty ( \int_use:c {g_fontspec_family_#1_int} ) } } - \tl_gset:Nv \zf@family {g_fontspec_UID_\zf@family@long} + \tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl} \cs_if_exist:cTF {zf@family@fontname\zf@family} \prg_return_false: \prg_return_true: } @@ -3634,14 +3659,12 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_new:Npn \fontspec_save_fontinfo:nn #1#2 { \tl_gset:cx {zf@family@fontname\zf@family} {#2} - \tl_gset:cx {zf@family@options\zf@family} {\zf@default@options #1} + \tl_gset:cx {zf@family@options\zf@family} {\g_fontspec_default_fontopts_tl #1} \tl_gset:cx {zf@family@fontdef\zf@family} { - \fontspec_fullname:n {\zf@fontname} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist + \fontspec_fullname:n {\l_fontspec_fontname_tl} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist } - \tl_gset:cx {g_fontspec_script_num_(\zf@family)_tl} - { \int_use:N \c@zf@script } - \tl_gset:cx {g_fontspec_lang_num_(\zf@family)_tl} - { \int_use:N \c@zf@language } + \tl_gset:cV {g_fontspec_script_num_(\zf@family)_tl} \l_fontspec_script_int + \tl_gset:cV {g_fontspec_lang_num_(\zf@family)_tl} \l_fontspec_language_int \tl_gset_eq:cN {g_fontspec_script_(\zf@family)_tl} \l_fontspec_script_tl \tl_gset_eq:cN {g_fontspec_lang_(\zf@family)_tl} \l_fontspec_lang_tl } @@ -3653,33 +3676,33 @@ This work consists of this file fontspec.dtx % Sets the upright shape. % \begin{macrocode} \cs_new:Npn \fontspec_set_upright: { - \zf@make@font@shapes{\zf@fontname} - {\mddefault}{\updefault}{\zf@font@feat\zf@up@feat} + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl + \mddefault \updefault \l_fontspec_fontfeat_up_clist } % \end{macrocode} % \end{macro} % % \begin{macro}{\fontspec_set_bold:} -% The macros \cs{zf@bf}, et al., are used to store the name of the +% The macros [...], et al., are used to store the name of the % custom bold, et al., font, if requested as user options. If they are % empty, the default fonts are used. % % The extra bold options defined with % \feat{BoldFeatures} are appended to the generic font features. % Then, the bold font is defined either as the ATS -% default (\cs{zf@make@font@shapes}' optional argument is to check if +% default ([...] optional argument is to check if % there actually is one; if not, the bold NFSS series is left % undefined) or with the font specified with the \feat{BoldFont} feature. % \begin{macrocode} \cs_new:Npn \fontspec_set_bold: { \unless\ifzf@nobf - \ifx\zf@bf\@empty - \zf@make@font@shapes[\zf@fontname]{/B} - {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat} - \else - \zf@make@font@shapes{\zf@bf} - {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat} - \fi + \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 + }{ + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bf_tl + \bfdefault \updefault \l_fontspec_fontfeat_bf_clist + } \fi } % \end{macrocode} @@ -3690,13 +3713,10 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_new:Npn \fontspec_set_italic: { \unless\ifzf@noit - \ifx\zf@it\@empty - \zf@make@font@shapes[\zf@fontname]{/I} - {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat} - \else - \zf@make@font@shapes{\zf@it} - {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat} - \fi + \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} @@ -3706,10 +3726,10 @@ This work consists of this file fontspec.dtx % And slanted but only if requested: % \begin{macrocode} \cs_new:Npn \fontspec_set_slanted: { - \ifx\zf@sl\@empty\else - \zf@make@font@shapes{\zf@sl} - {\mddefault}{\sldefault}{\zf@font@feat\zf@sl@feat} - \fi + \tl_if_empty:NF \l_fontspec_fontname_sl_tl { + \fontspec_make_font_shapes:nnnn + \l_fontspec_fontname_sl_tl \mddefault \sldefault \l_fontspec_fontfeat_sl_clist + } } % \end{macrocode} % \end{macro} @@ -3727,23 +3747,26 @@ This work consists of this file fontspec.dtx \ifzf@noit\@tempswafalse\fi \bool_if:NT \l_fontspec_external_bool \@tempswafalse \if@tempswa - \ifx\zf@bfit\@empty - \ifx\zf@bf\@empty - \ifx\zf@it\@empty - \zf@make@font@shapes[\zf@fontname]{/BI} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \else - \zf@make@font@shapes[\zf@it]{/B} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi - \else - \zf@make@font@shapes[\zf@bf]{/I} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi - \else - \zf@make@font@shapes{\zf@bfit} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi + \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl + { + \tl_if_empty:NTF \l_fontspec_fontname_bf_tl + { + \tl_if_empty:NTF \l_fontspec_fontname_it_tl + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} + } + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} + } + } + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} + } + } + { + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl + } + \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist \fi } % \end{macrocode} @@ -3753,15 +3776,15 @@ This work consists of this file fontspec.dtx % And bold slanted, again, only if requested: % \begin{macrocode} \cs_new:Npn \fontspec_set_bold_slanted: { - \ifx\zf@bfsl\@empty - \ifx\zf@sl\@empty\else - \zf@make@font@shapes[\zf@sl]{/B} - {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat} - \fi - \else - \zf@make@font@shapes{\zf@bfsl} - {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat} - \fi + \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl { + \tl_if_empty:NF \l_fontspec_fontname_sl_tl { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} + \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + } + }{ + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl + \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + } } % \end{macrocode} % \end{macro} @@ -3816,8 +3839,8 @@ This work consists of this file fontspec.dtx % % % -% \begin{macro}{\zf@make@font@shapes} -% \doarg{Font name prefix} +% \begin{macro}{\fontspec_make_font_shapes:nnnn,\fontspec_make_font_shapes:nnnnn} +% \darg{Font name prefix (in the 5-arg case)} % \darg{Font name} % \darg{Font series} % \darg{Font shape} @@ -3831,24 +3854,8 @@ This work consists of this file fontspec.dtx % and |/BI| font name suffixes. If no such font is found, it falls % back to the original font name, in which case this macro doesn't % proceed and the font shape is not created for the NFSS. -% \begin{macrocode} -\newcommand*\zf@make@font@shapes[5][]{ - \begingroup - \edef\@tempa{#1} - \unless\ifx\@tempa\@empty - \font_set:Nnn \@tempfonta {\fontspec_fullname:n {#1}} {\f@size pt} - \edef\@tempa{\fontname\@tempfonta} - \fi - \font_set:Nnn \@tempfontb {\fontspec_fullname:n {#1#2}} {\f@size pt} - \edef\@tempb{\fontname\@tempfontb} - \ifx\@tempa\@tempb - \fontspec_info:nx {no-font-shape} {#1#2} - \else - \edef\zf@fontname{#1#2} - \let\zf@basefont\@tempfontb - \fontspec_declare_shape:nnnn {}{#3}{#4}{#5} -% \end{macrocode} -% Next, the small caps are defined. \cs{zf@make@smallcaps} is used to +% +% Next, the small caps are defined. [...] is used to % define the appropriate string for activating small caps in the font, % if they exist. If we are defining small caps for the upright shape, % then the small caps shape default is used. For an \emph{italic} @@ -3856,21 +3863,35 @@ This work consists of this file fontspec.dtx % italic small caps by their own identifier. See \vref{sec:sishape} % for the code that enables this usage. % \begin{macrocode} - \ifx\zf@sc\@empty - \unless\ifzf@nosc - \zf@make@smallcaps - \unless\ifx\zf@smallcaps\@empty - \fontspec_declare_shape:nnnn {\zf@smallcaps}{#3} - {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat} - \fi - \fi - \else - \edef\zf@fontname{\zf@sc} - \fontspec_declare_shape:nnnn {}{#3} - {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat} +\cs_new:Nn \fontspec_make_font_shapes:nnnnn { + \font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt} + \font_set:Nnn \l_tmpb_font {\fontspec_fullname:n {#1#2}} {\f@size pt} + \str_if_eq:xxTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \fontspec_info:nx {no-font-shape} {#1#2} } + { + \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5} + } +} +\cs_new:Nn \fontspec_make_font_shapes:nnnn { + \group_begin: + \tl_set:Nx \l_fontspec_fontname_tl {#1} + \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 + \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 - \fi - \endgroup + }{ + \tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl} + \fontspec_declare_shape:nnnn {}{#2} + { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } + { #4 \l_fontspec_fontfeat_sc_clist } + } + \group_end: } % \end{macrocode} % Note that the test for italics to choose the \cmd\sidefault\ shape @@ -3878,7 +3899,7 @@ This work consists of this file fontspec.dtx % \end{macro} % % \begin{macro}{\fontspec_declare_shape:nnnn} -% \darg{Raw appended font feature} +% \darg{Raw appended font features} % \darg{Font series} % \darg{Font shape} % \darg{Font features} @@ -3887,11 +3908,11 @@ This work consists of this file fontspec.dtx \cs_new:Npn \fontspec_declare_shape:nnnn #1#2#3#4 { \clist_if_empty:NTF \l_fontspec_sizefeat_clist { - \fontspec_get_features:n{#4} + \fontspec_get_features:n {#4} \tl_set:Nx \l_fontspec_nfss_tl { <-> \l_fontspec_scale_tl \fontspec_fontwrap:n { - \fontspec_fullname:n {\zf@fontname} : + \fontspec_fullname:n {\l_fontspec_fontname_tl} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 } } @@ -3905,11 +3926,14 @@ This work consists of this file fontspec.dtx { \tl_clear:N \l_fontspec_nfss_tl \clist_map_inline:Nn \l_fontspec_sizefeat_clist { + \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \zf@fontname - \fontspec_setkeys:xx {sizing} { \expandafter \@firstofone ##1 } + \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl + + \fontspec_setkeys:xx {sizing} { \expandafter \use:n ##1 } \tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} } - \fontspec_get_features:n{#4,\XKV@rm} + \fontspec_get_features:n{ #4 , \XKV@rm } + \tl_put_right:Nx \l_fontspec_nfss_tl { <\l_fontspec_size_tl> \l_fontspec_scale_tl \fontspec_fontwrap:n { @@ -3917,31 +3941,29 @@ This work consists of this file fontspec.dtx : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 } } + } } % \end{macrocode} % And finally the actual font shape declaration using \cmd\l_fontspec_nfss_tl\ defined above. -% \cmd\zf@adjust\ is defined in various places to deal with things like the hyphenation +% \cmd\l_fontspec_postadjust_tl\ is defined in various places to deal with things like the hyphenation % character and interword spacing. % \begin{macrocode} - \PackageInfo{fontspec}{ - Defining~ shape~ #2/#3~ with~ raw~ font~ features: - \MessageBreak \l_fontspec_rawfeatures_sclist - \@gobble} + \fontspec_info:nx {defining-raw} {#2/#3} \use:x{ \exp_not:N\DeclareFontShape{\zf@enc}{\zf@family}{#2}{#3} - {\l_fontspec_nfss_tl}{\zf@adjust} + {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} } % \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? % \begin{macrocode} - \tl_if_eq:xxT {#3} {\itdefault} + \str_if_eq:xxT {#3} {\itdefault} { \use:x { \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault} - {<->ssub*\zf@family/#2/\itdefault}{\zf@adjust} + {<->ssub*\zf@family/#2/\itdefault}{\l_fontspec_postadjust_tl} } } } @@ -3975,7 +3997,7 @@ This work consists of this file fontspec.dtx % % % -% \begin{macro}{\zf@update@family} +% \begin{macro}{\fontspec_update_fontid:n} % This macro is used to build up a complex family name based on its % features. % @@ -3983,9 +4005,9 @@ This work consists of this file fontspec.dtx % time \cmd{zf@get@feature@requests} is called, so that the family % name is only created once. % \begin{macrocode} -\newcommand*{\zf@update@family}[1]{ +\cs_new:Nn \fontspec_update_fontid:n { \ifzf@firsttime - \xdef\zf@family@long{\zf@family@long#1} + \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} \fi } % \end{macrocode} @@ -3999,21 +4021,28 @@ This work consists of this file fontspec.dtx % default specification to the original passed options. It begins by % initialising the commands used to hold font-feature specific % strings. +% Its argument is any additional features to prepend to the default. % \begin{macrocode} \cs_set:Npn \fontspec_get_features:n #1 { - \let\l_fontspec_rawfeatures_sclist \@empty + \sclist_clear:N \l_fontspec_rawfeatures_sclist \tl_clear:N \l_fontspec_scale_tl \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl - \let\zf@adjust \@empty - \fontspec_setkeys:xx {options} {#1} + \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 } } % \end{macrocode} -% Finish the colour specification: +% Finish the colour specification. +% Do not set the colour if not explicitly spec'd else \verb|\color| (using +% specials) will not work. % \begin{macrocode} - \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} + \str_if_eq:xxF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } + { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } + { + \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} + } } % \end{macrocode} % \end{macro} @@ -4022,21 +4051,21 @@ This work consists of this file fontspec.dtx % Initialisations that either need to occur globally: % (all setting of these variables is done locally inside a group) % \begin{macrocode} -\tl_clear:N \zf@bf -\tl_clear:N \zf@it -\tl_clear:N \zf@fake@slant -\tl_clear:N \zf@fake@embolden -\tl_clear:N \zf@bfit -\tl_clear:N \zf@sl -\tl_clear:N \zf@bfsl -\tl_clear:N \zf@sc -\tl_clear:N \zf@up@feat -\tl_clear:N \zf@bf@feat -\tl_clear:N \zf@it@feat -\tl_clear:N \zf@bfit@feat -\tl_clear:N \zf@sl@feat -\tl_clear:N \zf@bfsl@feat -\tl_clear:N \zf@sc@feat +\tl_clear:N \l_fontspec_fontname_bf_tl +\tl_clear:N \l_fontspec_fontname_it_tl +\tl_clear:N \l_fontspec_fake_slant_tl +\tl_clear:N \l_fontspec_fake_embolden_tl +\tl_clear:N \l_fontspec_fontname_bfit_tl +\tl_clear:N \l_fontspec_fontname_sl_tl +\tl_clear:N \l_fontspec_fontname_bfsl_tl +\tl_clear:N \l_fontspec_fontname_sc_tl +\tl_clear:N \l_fontspec_fontfeat_up_clist +\tl_clear:N \l_fontspec_fontfeat_bf_clist +\tl_clear:N \l_fontspec_fontfeat_it_clist +\tl_clear:N \l_fontspec_fontfeat_bfit_clist +\tl_clear:N \l_fontspec_fontfeat_sl_clist +\tl_clear:N \l_fontspec_fontfeat_bfsl_clist +\tl_clear:N \l_fontspec_fontfeat_sc_clist \tl_clear:N \l_fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl \tl_clear:N \l_fontspec_lang_name_tl @@ -4068,27 +4097,35 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \end{macro} % -% \begin{macro}{\zf@make@smallcaps}\label{mac:zf@make@smallcaps} +% \begin{macro}{\fontspec_make_smallcaps:T} +% \label{mac:zf@make@smallcaps} % This macro checks if the font contains small caps, and if so -% creates the string for accessing them in \cmd{\zf@smallcaps}. +% creates the string for accessing them in \cmd{\l_fontspec_sc_featstr_sclist}. % \begin{macrocode} -\newcommand*\zf@make@smallcaps{ - \let\zf@smallcaps\@empty - \xetex_or_luatex:nn - { +\cs_set:Nn \fontspec_make_ot_smallcaps:T { + \tl_clear:N \l_fontspec_sc_featstr_sclist + \fontspec_check_ot_feat:nT {+smcp} { + \tl_set:Nx \l_fontspec_sc_featstr_sclist {+smcp;} + #1 + } +} +\xetex_or_luatex:nn +{ + \cs_set:Nn \fontspec_make_smallcaps:T { \ifzf@atsui - \fontspec_make_AAT_feature_string:nn{3}{3} - \unless\ifx\@tempa\@empty - \edef\zf@smallcaps{\@tempa;} - \fi + \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 - \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}} + \fontspec_make_ot_smallcaps:T {#1} \fi } - { - \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}} - } +} +{ + \cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T } % \end{macrocode} % \end{macro} @@ -4099,27 +4136,30 @@ This work consists of this file fontspec.dtx % I'm hardly going to write an `sclist' module but a couple of functions are % necessary. % \begin{macrocode} -\cs_new:Npn \sclist_put_right:Nn #1#2 { +\cs_set_eq:NN \sclist_new:N \tl_new:N +\cs_set_eq:NN \sclist_clear:N \tl_clear:N +\cs_new:Npn \sclist_gput_right:Nn #1#2 { \tl_if_empty:NTF #1 { - \tl_set:Nn #1 {#2} + \tl_gset:Nn #1 {#2} }{ - \tl_put_right:Nn #1 {;#2} + \tl_gput_right:Nn #1 {;#2} } } +\cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} % \end{macrocode} % \end{macro} % % % -% \begin{macro}{\zf@update@ff} +% \begin{macro}{\fontspec_update_featstr:n} % \cmd{\l_fontspec_rawfeatures_sclist} is the string used to define the list of specific % font features. Each time another font feature is requested, this % macro is used to add that feature to the list. Font features are % separated by semicolons. % \begin{macrocode} -\newcommand*\zf@update@ff[1]{ +\cs_new:Nn \fontspec_update_featstr:n { \unless\ifzf@firsttime - \xdef\l_fontspec_rawfeatures_sclist{\l_fontspec_rawfeatures_sclist #1;} + \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} \fi } % \end{macrocode} @@ -4151,44 +4191,39 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_new:Npn \fontspec_make_AAT_feature:nn #1#2 { \tl_if_empty:nTF {#1} + { \fontspec_warning:n {aat-feature-not-exist} } { - \fontspec_warning:n {aat-feature-not-exist} - } - { - \fontspec_make_AAT_feature_string:nn {#1}{#2} - \ifx\@tempa\@empty - \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} - \else - \zf@update@family{+#1,#2} - \zf@update@ff\@tempa - \fi + \fontspec_make_AAT_feature_string:nnTF {#1}{#2} + { + \fontspec_update_fontid:n {+#1,#2} + \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + } + { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } \cs_new:Npn \fontspec_make_ICU_feature:n #1 { \tl_if_empty:nTF {#1} + { \fontspec_warning:n {icu-feature-not-exist} } { - \fontspec_warning:n {icu-feature-not-exist} - } - { - \fontspec_check_ot_feat:nTF {#1} { - \zf@update@family{#1} - \zf@update@ff{#1} - }{ - \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} + \fontspec_check_ot_feat:nTF {#1} + { + \fontspec_update_fontid:n {#1} + \fontspec_update_featstr:n{#1} } + { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\zf@define@font@feature} -% \begin{macro}{\zf@define@feature@option} +% \begin{macro}{\fontspec_define_font_feature:n} +% \begin{macro}{\fontspec_define_feature_option:nnnnn} % These macros are used in order to simplify font feature definition later on. % \begin{macrocode} -\newcommand*\zf@define@font@feature[1]{ +\cs_new:Nn \fontspec_define_font_feature:n { \define@key[zf]{options}{#1}{{\setkeys[zf@feat]{#1}{##1}}} } -\newcommand*\zf@define@feature@option[5]{ +\cs_new:Nn \fontspec_define_feature_option:nnnnn { \define@key[zf@feat]{#1}{#2}[]{\fontspec_make_feature:nnn{#3}{#4}{#5}} } % \end{macrocode} @@ -4225,61 +4260,56 @@ This work consists of this file fontspec.dtx % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_make_AAT_feature_string:nn} +% \begin{macro}{\fontspec_make_AAT_feature_string:nnTF} % This macro takes the numerical codes for a font feature and % creates a specified macro containing the string required in the % font definition to turn that feature on or off. Used primarily in -% \cmd\zf@make@aat@feature, but also used to check if small caps +% [...], but also used to check if small caps % exists in the requested font (see page~\pageref{mac:zf@make@smallcaps}). % -% \begin{macrocode} -\cs_new:Npn \fontspec_make_AAT_feature_string:nn #1#2 { - \edef\@tempa{\XeTeXfeaturename\zf@basefont #1} - \unless\ifx\@tempa\@empty -% \end{macrocode} % For exclusive selectors, it's easy; just grab the string: -% \begin{macrocode} - \ifnum\XeTeXisexclusivefeature\zf@basefont #1>0 - \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2} -% \end{macrocode} % For \emph{non}-exclusive selectors, it's a little more complex. -% If the selector is even, it corresponds to switching the feature on: -% \begin{macrocode} - \else - \unless\ifodd #2 - \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2} -% \end{macrocode} +% If the selector is even, it corresponds to switching the feature on. % If the selector is \emph{odd}, it corresponds to switching the feature off. % But \XeTeX\ doesn't return a selector string for this number, since the % feature is defined for the `switching on' value. So we need to check the % selector of the previous number, and then prefix the feature string with |!| % to denote the switch. +% +% Finally, save out the complete feature string in \cmd\l_fontspec_feature_string_tl. % \begin{macrocode} - \else - \edef\@tempb{ +\prg_new_conditional:Nnn \fontspec_make_AAT_feature_string:nn {TF,T,F} { + \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \zf@basefont #1 } + \tl_if_empty:NTF \l_tmpa_tl + { \prg_return_false: } + { + \intexpr_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} + }{ + \intexpr_if_even:nTF {#2} + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} + }{ + \tl_set:Nx \l_tmpb_tl { \XeTeXselectorname\zf@basefont #1\space \numexpr#2-1\relax } - \unless\ifx\@tempb\@empty - \edef\@tempb{!\@tempb} - \fi - \fi - \fi -% \end{macrocode} -% Finally, save out the complete feature string in \cmd\@tempa. -% If the selector doesn't exist, re-initialise the feature string to empty. -% \begin{macrocode} - \unless\ifx\@tempb\@empty - \edef\@tempa{\@tempa=\@tempb} - \else - \let\@tempa\@empty - \fi - \fi + \tl_if_empty:NF \l_tmpb_tl { \tl_put_left:Nn \l_tmpb_tl {!} } + } + } + \tl_if_empty:NTF \l_tmpb_tl + { \prg_return_false: } + { + \tl_set:Nx \l_fontspec_feature_string_tl { \l_tmpa_tl = \l_tmpb_tl } + \prg_return_true: + } + } } % \end{macrocode} % \end{macro} % -% \begin{macro}{\fontspec_iv_str_to_num:n} -% \begin{macro}{\fontspec_v_str_to_num:n} +% \begin{macro}{\fontspec_iv_str_to_num:Nn} +% \begin{macro}{\fontspec_v_str_to_num:Nn} % This macro takes a four character string and converts it to the % numerical representation required for \XeTeX\ OpenType script/language/feature % purposes. The output is stored in \cmd\l_fontspec_strnum_int. @@ -4294,38 +4324,33 @@ This work consists of this file fontspec.dtx % The variant \cmd\fontspec_v_str_to_num:n\ is used when looking at features, which are passed around % with prepended plus and minus signs (\eg, \texttt{+liga}, \texttt{-dlig}); it % simply strips off the first char of the input before calling the normal \cmd\fontspec_iv_str_to_num:n. -% -% It's probable that all OpenType features \emph{are} in fact four characters long, but -% not impossible that they aren't. So I'll leave the less efficient parsing stage in there -% even though it's not strictly necessary for now. % \begin{macrocode} -\cs_set:Npn \fontspec_iv_str_to_num:n #1 { - \fontspec_iv_str_to_num:w #1 \@empty \@empty \q_nil +\cs_set:Npn \fontspec_iv_str_to_num:Nn #1#2 { + \fontspec_iv_str_to_num:w #1 \q_nil #2 \@empty \@empty \q_nil } -\cs_set:Npn \fontspec_iv_str_to_num:w #1#2#3#4#5 \q_nil { - \int_set:Nn \l_fontspec_strnum_int { - `#1 * "1000000 - + `#2 * "10000 - + \ifx \@empty #3 32 \else `#3 \fi * "100 - + \ifx \@empty #4 32 \else `#4 \fi +\cs_set:Npn \fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil { + \int_set:Nn #1 { + `#2 * "1000000 + + `#3 * "10000 + + \ifx \@empty #4 32 \else `#4 \fi * "100 + + \ifx \@empty #5 32 \else `#5 \fi } } -\cs_set:Npn \fontspec_v_str_to_num:n #1 { +\cs_generate_variant:Nn \fontspec_iv_str_to_num:Nn {No} +\cs_set:Npn \fontspec_v_str_to_num:Nn #1#2 { \bool_if:nTF { - \tl_if_head_eq_charcode_p:nN {#1} {+} || - \tl_if_head_eq_charcode_p:nN {#1} {-} - } - { - \exp_after:wN \fontspec_iv_str_to_num:n - \exp_after:wN { \use_none:n #1 } + \tl_if_head_eq_charcode_p:nN {#2} {+} || + \tl_if_head_eq_charcode_p:nN {#2} {-} } - { \fontspec_iv_str_to_num:n {#1} } + { \fontspec_iv_str_to_num:No #1 { \use_none:n #2 } } + { \fontspec_iv_str_to_num:Nn #1 {#2} } } % \end{macrocode} % \end{macro} % \end{macro} % +% % \begin{macro}{\fontspec_check_script:nTF} % This macro takes an OpenType script tag and checks if it exists in the current % font. The output boolean is \cmd\@tempswatrue. \cmd\l_fontspec_strnum_int\ is used to store @@ -4333,17 +4358,19 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_script:n {TF}} { - \fontspec_iv_str_to_num:n{#1} - \@tempcntb\XeTeXOTcountscripts\zf@basefont - \c@zf@index\z@ \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTscripttag\zf@basefont\c@zf@index=\l_fontspec_strnum_int + \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \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 } + { + \ifnum \XeTeXOTscripttag\zf@basefont \l_tmpa_int = \l_fontspec_strnum_int \@tempswatrue - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -4357,23 +4384,26 @@ This work consists of this file fontspec.dtx % This macro takes an OpenType language tag and checks if it exists in the current % font/script. The output boolean is \cmd\@tempswatrue. \cmd\l_fontspec_strnum_int\ is used to store % the number corresponding to the language tag string. -% The script used is whatever's held in \cmd\c@zf@script. By default, that's the +% The script used is whatever's held in \cmd\l_fontspec_script_int. By default, that's the % number corresponding to `|latn|'. % \begin{macrocode} \xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_lang:n {TF}} { - \fontspec_iv_str_to_num:n{#1} - \@tempcntb\XeTeXOTcountlanguages\zf@basefont\c@zf@script - \c@zf@index\z@ + \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \int_set:Nn \l_tmpb_int { + \XeTeXOTcountlanguages \zf@basefont \l_fontspec_script_int + } + \int_zero:N \l_tmpa_int \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTlanguagetag\zf@basefont\c@zf@script\c@zf@index=\l_fontspec_strnum_int + \bool_until_do:nn { \intexpr_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 - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -4391,26 +4421,31 @@ This work consists of this file fontspec.dtx % font/script/language. % The output boolean is \cmd\@tempswa. \cmd\l_fontspec_strnum_int\ is used to store % the number corresponding to the feature tag string. -% The script used is whatever's held in \cmd\c@zf@script. By default, that's the -% number corresponding to `|latn|'. The language used is \cmd\c@zf@language, +% The script used is whatever's held in \cmd\l_fontspec_script_int. By default, that's the +% number corresponding to `|latn|'. The language used is \cmd\l_fontspec_language_int, % by default |0|, the `default language'. % \begin{macrocode} \xetex_or_luatex:nnn { \prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} } { - \@tempcntb\XeTeXOTcountfeatures\zf@basefont\c@zf@script\c@zf@language - \fontspec_v_str_to_num:n {#1} - \c@zf@index\z@ + \int_set:Nn \l_tmpb_int { + \XeTeXOTcountfeatures \zf@basefont + \l_fontspec_script_int + \l_fontspec_language_int + } + \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} + \int_zero:N \l_tmpa_int \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTfeaturetag\zf@basefont\c@zf@script\c@zf@language - \c@zf@index=\l_fontspec_strnum_int + \bool_until_do:nn { \intexpr_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 \@tempswatrue - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -4478,7 +4513,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num] {AAT,ICU,Graphite,Full,Basic}{ - \zf@update@family{+rend:#1} + \fontspec_update_fontid:n {+rend:#1} \intexpr_compare:nTF {\l_tmpa_num < 3} { \xetex_or_luatex:nn { @@ -4506,7 +4541,7 @@ This work consists of this file fontspec.dtx \define@key[zf]{preparse}{Script}{ \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} } \tl_set:Nn \l_fontspec_script_name_tl {#1} - \zf@update@family{+script:#1} + \fontspec_update_fontid:n {+script:#1} } % \end{macrocode} % Exactly the same: @@ -4514,7 +4549,7 @@ This work consists of this file fontspec.dtx \define@key[zf]{preparse}{Language}{ \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} } \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \zf@update@family{+language:#1} + \fontspec_update_fontid:n {+language:#1} } % \end{macrocode} % @@ -4528,65 +4563,66 @@ This work consists of this file fontspec.dtx % Upright: % \begin{macrocode} \define@key[zf]{preparse-external}{UprightFont}{ - \fontspec_complete_fontname:Nn \zf@up {#1} - \zf@update@family{up:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + \fontspec_update_fontid:n {up:#1} } % \end{macrocode} % Bold: % \begin{macrocode} \define@key[zf]{preparse-external}{BoldFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@nobftrue - \zf@update@family{nobf} - \else + \fontspec_update_fontid:n {nobf} + } + { \zf@nobffalse - \fontspec_complete_fontname:Nn \zf@bf {#1} - \zf@update@family{bf:#1} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} + \fontspec_update_fontid:n {bf:#1} + } } % \end{macrocode} % Same for italic: % \begin{macrocode} \define@key[zf]{preparse-external}{ItalicFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@noittrue - \zf@update@family{noit} - \else + \fontspec_update_fontid:n {noit} + }{ \zf@noitfalse - \fontspec_complete_fontname:Nn \zf@it {#1} - \zf@update@family{it:#1} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} + \fontspec_update_fontid:n {it:#1} + } } % \end{macrocode} % Simpler for bold+italic \& slanted: % \begin{macrocode} \define@key[zf]{preparse-external}{BoldItalicFont}{ - \fontspec_complete_fontname:Nn \zf@bfit {#1} - \zf@update@family{bfit:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} + \fontspec_update_fontid:n {bfit:#1} } \define@key[zf]{preparse-external}{SlantedFont}{ - \fontspec_complete_fontname:Nn \zf@sl {#1} - \zf@update@family{sl:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} + \fontspec_update_fontid:n {sl:#1} } \define@key[zf]{preparse-external}{BoldSlantedFont}{ - \fontspec_complete_fontname:Nn \zf@bfsl {#1} - \zf@update@family{bfsl:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} + \fontspec_update_fontid:n {bfsl:#1} } % \end{macrocode} % Small caps isn't pre-parsed because it can vary with others above: % \begin{macrocode} \define@key[zf]{options}{SmallCapsFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@nosctrue - \zf@update@family{nosc} - \else + \fontspec_update_fontid:n {nosc} + }{ \zf@noscfalse - \fontspec_complete_fontname:Nn \zf@sc {#1} - \zf@update@family{sc:\zap@space #1~\@empty} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} + \fontspec_update_fontid:n {sc:\zap@space #1~\@empty} + } } % \end{macrocode} % @@ -4597,7 +4633,10 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \cs_set:Npn \fontspec_complete_fontname:Nn #1#2 { \tl_set:Nn #1 {#2} - \tl_replace_all_in:Nnx #1 {*} {\zf@fontname} + \tl_replace_all_in:Nnx #1 {*} {\l_fontspec_fontname_tl} + \luatex_if_engine:T { + \tl_replace_all_in:Nnn #1 {~} {} + } } \cs_generate_variant:Nn \tl_replace_all_in:Nnn {Nnx} % \end{macrocode} @@ -4606,35 +4645,35 @@ This work consists of this file fontspec.dtx % \paragraph{Features} % \begin{macrocode} \define@key[zf]{preparse}{UprightFeatures}{ - \def\zf@up@feat{, #1} - \zf@update@family{rmfeat:#1} + \def\l_fontspec_fontfeat_up_clist{, #1} + \fontspec_update_fontid:n {rmfeat:#1} } \define@key[zf]{preparse}{BoldFeatures}{ - \def\zf@bf@feat{, #1} - \zf@update@family{bffeat:#1} + \def\l_fontspec_fontfeat_bf_clist{, #1} + \fontspec_update_fontid:n {bffeat:#1} } \define@key[zf]{preparse}{ItalicFeatures}{ - \def\zf@it@feat{, #1} - \zf@update@family{itfeat:#1} + \def\l_fontspec_fontfeat_it_clist{, #1} + \fontspec_update_fontid:n {itfeat:#1} } \define@key[zf]{preparse}{BoldItalicFeatures}{ - \def\zf@bfit@feat{, #1} - \zf@update@family{bfitfeat:#1} + \def\l_fontspec_fontfeat_bfit_clist{, #1} + \fontspec_update_fontid:n {bfitfeat:#1} } \define@key[zf]{preparse}{SlantedFeatures}{ - \def\zf@sl@feat{, #1} - \zf@update@family{slfeat:#1} + \def\l_fontspec_fontfeat_sl_clist{, #1} + \fontspec_update_fontid:n {slfeat:#1} } \define@key[zf]{preparse}{BoldSlantedFeatures}{ - \def\zf@bfsl@feat{, #1} - \zf@update@family{bfslfeat:#1} + \def\l_fontspec_fontfeat_bfsl_clist{, #1} + \fontspec_update_fontid:n {bfslfeat:#1} } % \end{macrocode} % 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\zf@sc@feat{, #1}\fi - \zf@update@family{scfeat:\zap@space #1~\@empty} + \unless\ifzf@firsttime\def\l_fontspec_fontfeat_sc_clist{, #1}\fi + \fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty} } % \end{macrocode} % @@ -4643,7 +4682,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \define@key[zf]{preparse}{SizeFeatures}{ \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \zf@update@family{sizefeat:\zap@space #1~\@empty} + \fontspec_update_fontid:n {sizefeat:\zap@space #1~\@empty} } % \end{macrocode} % @@ -4670,7 +4709,7 @@ This work consists of this file fontspec.dtx {MatchUppercase} { \fontspec_calc_scale:n {8} } } { \tl_set:Nx \l_fontspec_scale_tl {#1} } - \zf@update@family{+scale:\l_fontspec_scale_tl} + \fontspec_update_fontid:n {+scale:\l_fontspec_scale_tl} \tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] } } % \end{macrocode} @@ -4712,7 +4751,7 @@ This work consists of this file fontspec.dtx \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} { \settoheight #1 { - \tl_if_eq:nnTF {#3} {\font} \rmfamily #3 + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 \prg_case_int:nnn #2 { {5} {x} % x-height {8} {X} % cap-height @@ -4729,9 +4768,9 @@ This work consists of this file fontspec.dtx % font being loaded. % \begin{macrocode} \define@key[zf]{options}{WordSpace}{ - \zf@update@family{+wordspace:#1} + \fontspec_update_fontid:n {+wordspace:#1} \unless\ifzf@firsttime - \zf@wordspace@parse#1,\zf@@ii,\zf@@iii,\zf@@ + \_fontspec_parse_wordspace:w #1,,,\q_stop \fi } % \end{macrocode} @@ -4741,19 +4780,19 @@ This work consists of this file fontspec.dtx % of the form |{X}| or |{X,Y,Z}| and executes the font scaling. % If the former input, it executes |{X,X,X}|. % \begin{macrocode} -\def\zf@wordspace@parse#1,#2,#3,#4\zf@@{ - \def\@tempa{#4} - \ifx\@tempa\@empty - \setlength\@tempdima{#1\fontdimen2\zf@basefont} - \@tempdimb\@tempdima - \@tempdimc\@tempdima - \else - \setlength\@tempdima{#1\fontdimen2\zf@basefont} - \setlength\@tempdimb{#2\fontdimen3\zf@basefont} - \setlength\@tempdimc{#3\fontdimen4\zf@basefont} - \fi - \edef\zf@adjust{ - \zf@adjust +\cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { + \tl_if_empty:nTF {#4} + { + \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont} + \dim_set:Nn \@tempdimb {\@tempdima} + \dim_set:Nn \@tempdimc {\@tempdima} + }{ + \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont} + \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 \fontdimen2\font\the\@tempdima \fontdimen3\font\the\@tempdimb \fontdimen4\font\the\@tempdimc @@ -4766,17 +4805,17 @@ This work consists of this file fontspec.dtx % Scaling factor for the nominal \cmd\fontdimen \#7. % \begin{macrocode} \define@key[zf]{options}{PunctuationSpace}{ - \zf@update@family{+punctspace:#1} + \fontspec_update_fontid:n {+punctspace:#1} \setlength\@tempdima{#1\fontdimen7\zf@basefont} - \edef\zf@adjust{\zf@adjust\fontdimen7\font\the\@tempdima} + \tl_set:Nx \l_fontspec_postadjust_tl {\l_fontspec_postadjust_tl\fontdimen7\font\the\@tempdima} } % \end{macrocode} % % \paragraph{Letterspacing} % \begin{macrocode} \define@key[zf]{options}{LetterSpace}{ - \zf@update@family{+tracking:#1} - \zf@update@ff{letterspace=#1} + \fontspec_update_fontid:n {+tracking:#1} + \fontspec_update_featstr:n{letterspace=#1} } % \end{macrocode} % @@ -4787,18 +4826,18 @@ This work consists of this file fontspec.dtx % the third. % \begin{macrocode} \define@key[zf]{options}{HyphenChar}{ - \zf@update@family{+hyphenchar:#1} - \tl_if_eq:nnTF {#1} {None} + \fontspec_update_fontid:n {+hyphenchar:#1} + \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \zf@adjust { \hyphenchar \font = \c_minus_one } + \tl_put_right:Nn \l_fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { \tl_if_single:nTF {#1} { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } - \fontspec_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl} + \font_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl} { - \xetex_or_luatex:nnn { \tl_put_right:Nn \zf@adjust } + \xetex_or_luatex:nnn { \tl_put_right:Nn \l_fontspec_postadjust_tl } { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: } { \hyphenchar \font = \c_zero @@ -4813,7 +4852,7 @@ This work consists of this file fontspec.dtx % \paragraph{Color} % \begin{macrocode} \define@key[zf]{options}{Color}{ - \zf@update@family{+col:#1} + \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF {\token_to_str:N\color@#1} { \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl @@ -4847,7 +4886,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \newcounter{fontspec_tmp_int} \define@key[zf]{options}{Opacity}{ - \zf@update@family{+opac:#1} + \fontspec_update_fontid:n {+opac:#1} \setcounter {fontspec_tmp_int} { 255*\real{#1} } \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl { @@ -4866,10 +4905,10 @@ This work consists of this file fontspec.dtx \xetex_or_luatex:nnn { \define@key[zf]{options}{Mapping} }{ - \zf@update@family{+map:#1} - \zf@update@ff{mapping=#1} + \fontspec_update_fontid:n {+map:#1} + \fontspec_update_featstr:n{mapping=#1} }{ - \tl_if_eq:nnTF {#1} {tex-text} { + \str_if_eq:nnTF {#1} {tex-text} { \fontspec_warning:n {no-mapping-ligtex} \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} \setkeys[zf]{options}{ Ligatures=TeX } @@ -4882,8 +4921,8 @@ This work consists of this file fontspec.dtx % \paragraph{FeatureFile} % \begin{macrocode} \define@key[zf]{options}{FeatureFile}{ - \zf@update@family{+fea:#1} - \zf@update@ff{featurefile=#1} + \fontspec_update_fontid:n {+fea:#1} + \fontspec_update_featstr:n{featurefile=#1} } % \end{macrocode} % @@ -4892,22 +4931,22 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \define@key[zf]{options}{Weight}{ - \zf@update@family{+weight:#1} - \zf@update@ff{weight=#1} + \fontspec_update_fontid:n {+weight:#1} + \fontspec_update_featstr:n{weight=#1} } \define@key[zf]{options}{Width}{ - \zf@update@family{+width:#1} - \zf@update@ff{width=#1} + \fontspec_update_fontid:n {+width:#1} + \fontspec_update_featstr:n{width=#1} } \define@key[zf]{options}{OpticalSize}{ \xetex_or_luatex:nn { \ifzf@icu \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \zf@update@family{+size:#1} + \fontspec_update_fontid:n {+size:#1} \fi \ifzf@mm - \zf@update@family{+size:#1} - \zf@update@ff{optical size=#1} + \fontspec_update_fontid:n {+size:#1} + \fontspec_update_featstr:n{optical size=#1} \fi \ifzf@icu\else \ifzf@mm\else @@ -4918,7 +4957,7 @@ This work consists of this file fontspec.dtx \fi }{ \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \zf@update@family{+size:#1} + \fontspec_update_fontid:n {+size:#1} } } % \end{macrocode} @@ -4927,16 +4966,16 @@ This work consists of this file fontspec.dtx % These are to be specified to apply directly to a font shape: % \begin{macrocode} \define@key[zf]{options}{FakeSlant}[0.2]{ - \zf@update@family{+slant:#1} - \zf@update@ff{slant=#1} + \fontspec_update_fontid:n {+slant:#1} + \fontspec_update_featstr:n{slant=#1} } \define@key[zf]{options}{FakeStretch}[1.2]{ - \zf@update@family{+extend:#1} - \zf@update@ff{extend=#1} + \fontspec_update_fontid:n {+extend:#1} + \fontspec_update_featstr:n{extend=#1} } \define@key[zf]{options}{FakeBold}[1.5]{ - \zf@update@family{+embolden:#1} - \zf@update@ff{embolden=#1} + \fontspec_update_fontid:n {+embolden:#1} + \fontspec_update_featstr:n{embolden=#1} } % \end{macrocode} % These are to be given to a shape that has no real bold/italic @@ -4948,18 +4987,18 @@ This work consists of this file fontspec.dtx % These features presently \emph{override} real shapes found in the font; % in the future I'd like these features to be ignored in this case, instead. % (This is just a bit harder to program in the current design of -% \pkg{fontspec}) +% \pkg{fontspec}.) % \begin{macrocode} \define@key[zf]{options}{AutoFakeSlant}[0.2]{ \ifzf@firsttime - \tl_set:Nn \zf@fake@slant {#1} - \tl_put_right:Nn \zf@it@feat {,FakeSlant=#1} - \tl_set_eq:NN \zf@it \zf@fontname - \zf@update@family{fakeit:#1} - \tl_if_empty:NF \zf@fake@embolden { - \tl_put_right:Nx \zf@bfit@feat - {,FakeBold=\zf@fake@embolden,FakeSlant=#1} - \tl_set_eq:NN \zf@bfit \zf@fontname + \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 + \fontspec_update_fontid:n {fakeit:#1} + \tl_if_empty:NF \l_fontspec_fake_embolden_tl { + \tl_put_right:Nx \l_fontspec_fontfeat_bfit_clist + {,FakeBold=\l_fontspec_fake_embolden_tl,FakeSlant=#1} + \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } \fi } @@ -4968,14 +5007,14 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \define@key[zf]{options}{AutoFakeBold}[1.5]{ \ifzf@firsttime - \tl_set:Nn \zf@fake@embolden {#1} - \tl_put_right:Nn \zf@bf@feat {,FakeBold=#1} - \tl_set_eq:NN \zf@bf \zf@fontname - \zf@update@family{fakebf:#1} - \tl_if_empty:NF \zf@fake@slant { - \tl_put_right:Nx \zf@bfit@feat - {,FakeSlant=\zf@fake@slant,FakeBold=#1} - \tl_set_eq:NN \zf@bfit \zf@fontname + \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 + \fontspec_update_fontid:n {fakebf:#1} + \tl_if_empty:NF \l_fontspec_fake_slant_tl { + \tl_put_right:Nx \l_fontspec_fontfeat_bfit_clist + {,FakeSlant=\l_fontspec_fake_slant_tl,FakeBold=#1} + \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } \fi } @@ -4985,60 +5024,60 @@ This work consists of this file fontspec.dtx % \subsubsection{Ligatures} % The call to the nested keyval family must be wrapped in braces to % hide the parent list (this later requires the use of global -% definitions (|\xdef|) in |\zf@update@...|). Both \AAT\ and OpenType +% definitions (|\xdef|) in [...]). Both \AAT\ and OpenType % names are offered to chose |Rare|/|Discretionary| ligatures. % \begin{macrocode} -\zf@define@font@feature{Ligatures} -\zf@define@feature@option{Ligatures}{Required} {1}{0}{+rlig} -\zf@define@feature@option{Ligatures}{NoRequired} {1}{1}{-rlig} -\zf@define@feature@option{Ligatures}{Common} {1}{2}{+liga} -\zf@define@feature@option{Ligatures}{NoCommon} {1}{3}{-liga} -\zf@define@feature@option{Ligatures}{Rare} {1}{4}{+dlig} -\zf@define@feature@option{Ligatures}{NoRare} {1}{5}{-dlig} -\zf@define@feature@option{Ligatures}{Discretionary} {1}{4}{+dlig} -\zf@define@feature@option{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\zf@define@feature@option{Ligatures}{Contextual} {}{} {+clig} -\zf@define@feature@option{Ligatures}{NoContextual} {}{} {-clig} -\zf@define@feature@option{Ligatures}{Historic} {}{} {+hlig} -\zf@define@feature@option{Ligatures}{NoHistoric} {}{} {-hlig} -\zf@define@feature@option{Ligatures}{Logos} {1}{6} {} -\zf@define@feature@option{Ligatures}{NoLogos} {1}{7} {} -\zf@define@feature@option{Ligatures}{Rebus} {1}{8} {} -\zf@define@feature@option{Ligatures}{NoRebus} {1}{9} {} -\zf@define@feature@option{Ligatures}{Diphthong} {1}{10}{} -\zf@define@feature@option{Ligatures}{NoDiphthong} {1}{11}{} -\zf@define@feature@option{Ligatures}{Squared} {1}{12}{} -\zf@define@feature@option{Ligatures}{NoSquared} {1}{13}{} -\zf@define@feature@option{Ligatures}{AbbrevSquared} {1}{14}{} -\zf@define@feature@option{Ligatures}{NoAbbrevSquared}{1}{15}{} -\zf@define@feature@option{Ligatures}{Icelandic} {1}{32}{} -\zf@define@feature@option{Ligatures}{NoIcelandic} {1}{33}{} +\fontspec_define_font_feature:n{Ligatures} +\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} % \end{macrocode} % Emulate CM extra ligatures. % \begin{macrocode} \define@key[zf@feat]{Ligatures}{TeX}[]{ \xetex_or_luatex:nn { - \zf@update@family{+map:tex-text} - \zf@update@ff{mapping=tex-text} + \fontspec_update_fontid:n {+map:tex-text} + \fontspec_update_featstr:n{mapping=tex-text} }{ - \zf@update@family{+tlig+trep} - \zf@update@ff{+tlig;+trep} + \fontspec_update_fontid:n {+tlig+trep} + \fontspec_update_featstr:n{+tlig;+trep} } } % \end{macrocode} % % \subsubsection{Letters} % \begin{macrocode} -\zf@define@font@feature{Letters} -\zf@define@feature@option{Letters}{Normal} {3}{0}{} -\zf@define@feature@option{Letters}{Uppercase} {3}{1}{+case} -\zf@define@feature@option{Letters}{Lowercase} {3}{2}{} -\zf@define@feature@option{Letters}{SmallCaps} {3}{3}{+smcp} -\zf@define@feature@option{Letters}{PetiteCaps} {} {} {+pcap} -\zf@define@feature@option{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\zf@define@feature@option{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\zf@define@feature@option{Letters}{InitialCaps} {3}{4}{} -\zf@define@feature@option{Letters}{Unicase} {} {} {+unic} +\fontspec_define_font_feature:n{Letters} +\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} % \end{macrocode} % % \subsubsection{Numbers} @@ -5050,15 +5089,15 @@ This work consists of this file fontspec.dtx % Both naming conventions are offered to select the number case. % % \begin{macrocode} -\zf@define@font@feature{Numbers} -\zf@define@feature@option{Numbers}{Monospaced} {6} {0}{+tnum} -\zf@define@feature@option{Numbers}{Proportional} {6} {1}{+pnum} -\zf@define@feature@option{Numbers}{Lowercase} {21}{0}{+onum} -\zf@define@feature@option{Numbers}{OldStyle} {21}{0}{+onum} -\zf@define@feature@option{Numbers}{Uppercase} {21}{1}{+lnum} -\zf@define@feature@option{Numbers}{Lining} {21}{1}{+lnum} -\zf@define@feature@option{Numbers}{SlashedZero} {14}{5}{+zero} -\zf@define@feature@option{Numbers}{NoSlashedZero}{14}{4}{-zero} +\fontspec_define_font_feature:n{Numbers} +\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} % \end{macrocode} % % |luaotload| provides a custom |anum| feature for replacing Latin @@ -5067,76 +5106,76 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \luatex_if_engine:T { - \zf@define@feature@option{Numbers}{Arabic}{}{}{+anum} + \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} } % \end{macrocode} % % \subsubsection{Contextuals} % \begin{macrocode} -\zf@define@font@feature {Contextuals} -\zf@define@feature@option{Contextuals}{Swash} {} {} {+cswh} -\zf@define@feature@option{Contextuals}{NoSwash} {} {} {-cswh} -\zf@define@feature@option{Contextuals}{Alternate} {} {} {+calt} -\zf@define@feature@option{Contextuals}{NoAlternate} {} {} {-calt} -\zf@define@feature@option{Contextuals}{WordInitial} {8}{0}{+init} -\zf@define@feature@option{Contextuals}{NoWordInitial}{8}{1}{-init} -\zf@define@feature@option{Contextuals}{WordFinal} {8}{2}{+fina} -\zf@define@feature@option{Contextuals}{NoWordFinal} {8}{3}{-fina} -\zf@define@feature@option{Contextuals}{LineInitial} {8}{4}{} -\zf@define@feature@option{Contextuals}{NoLineInitial}{8}{5}{} -\zf@define@feature@option{Contextuals}{LineFinal} {8}{6}{+falt} -\zf@define@feature@option{Contextuals}{NoLineFinal} {8}{7}{-falt} -\zf@define@feature@option{Contextuals}{Inner} {8}{8}{+medi} -\zf@define@feature@option{Contextuals}{NoInner} {8}{9}{-medi} +\fontspec_define_font_feature:n {Contextuals} +\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} % \end{macrocode} % % \subsubsection{Diacritics} % \begin{macrocode} -\zf@define@font@feature{Diacritics} -\zf@define@feature@option{Diacritics}{Show} {9}{0}{} -\zf@define@feature@option{Diacritics}{Hide} {9}{1}{} -\zf@define@feature@option{Diacritics}{Decompose} {9}{2}{} -\zf@define@feature@option{Diacritics}{MarkToBase} {}{}{+mark} -\zf@define@feature@option{Diacritics}{NoMarkToBase}{}{}{-mark} -\zf@define@feature@option{Diacritics}{MarkToMark} {}{}{+mkmk} -\zf@define@feature@option{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\zf@define@feature@option{Diacritics}{AboveBase} {}{}{+abvm} -\zf@define@feature@option{Diacritics}{NoAboveBase} {}{}{-abvm} -\zf@define@feature@option{Diacritics}{BelowBase} {}{}{+blwm} -\zf@define@feature@option{Diacritics}{NoBelowBase} {}{}{-blwm} +\fontspec_define_font_feature:n{Diacritics} +\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} % \end{macrocode} % % \subsubsection{Kerning} % \begin{macrocode} -\zf@define@font@feature{Kerning} -\zf@define@feature@option{Kerning}{Uppercase}{}{}{+cpsp} -\zf@define@feature@option{Kerning}{On} {}{}{+kern} -\zf@define@feature@option{Kerning}{Off} {}{}{-kern} -%\zf@define@feature@option{Kerning}{Vertical}{}{}{+vkrn} -%\zf@define@feature@option{Kerning} +\fontspec_define_font_feature:n{Kerning} +\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +%\fontspec_define_feature_option:nnnnn{Kerning}{Vertical}{}{}{+vkrn} +%\fontspec_define_feature_option:nnnnn{Kerning} % {VerticalAlternateProportional}{}{}{+vpal} -%\zf@define@feature@option{Kerning}{VerticalAlternateHalfWidth}{}{}{+vhal} +%\fontspec_define_feature_option:nnnnn{Kerning}{VerticalAlternateHalfWidth}{}{}{+vhal} % \end{macrocode} % % \subsubsection{Vertical position} % \begin{macrocode} -\zf@define@font@feature{VerticalPosition} -\zf@define@feature@option{VerticalPosition}{Normal} {10}{0}{} -\zf@define@feature@option{VerticalPosition}{Superior} {10}{1}{+sups} -\zf@define@feature@option{VerticalPosition}{Inferior} {10}{2}{+subs} -\zf@define@feature@option{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\zf@define@feature@option{VerticalPosition}{Numerator} {} {} {+numr} -\zf@define@feature@option{VerticalPosition}{Denominator}{} {} {+dnom} -\zf@define@feature@option{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\fontspec_define_font_feature:n{VerticalPosition} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} % \end{macrocode} % % \subsubsection{Fractions} % \begin{macrocode} -\zf@define@font@feature{Fractions} -\zf@define@feature@option{Fractions}{On} {11}{1}{+frac} -\zf@define@feature@option{Fractions}{Off} {11}{0}{-frac} -\zf@define@feature@option{Fractions}{Diagonal} {11}{2}{} -\zf@define@feature@option{Fractions}{Alternate}{} {} {+afrc} +\fontspec_define_font_feature:n{Fractions} +\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} % \end{macrocode} % % \subsubsection{Alternates and variants} @@ -5147,10 +5186,10 @@ This work consists of this file fontspec.dtx \define@key[zf]{options}{Alternate}[0]{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Alternate}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Alternate} \fontspec_make_feature:nnx {17}{#1} { \fontspec_salt:n {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } % \end{macrocode} @@ -5164,10 +5203,10 @@ This work consists of this file fontspec.dtx \define@key[zf]{options}{Variant}{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Variant}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Variant} \fontspec_make_feature:nnx {18}{#1} { +ss \two@digits {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } \aliasfontfeature{Variant}{StylisticSet} @@ -5177,79 +5216,79 @@ This work consists of this file fontspec.dtx \define@key[zf]{options}{CharacterVariant}{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{CharacterVariant}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{CharacterVariant} \fontspec_make_feature:nnx {}{} { +cv \two@digits {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } % \end{macrocode} % % \subsubsection{Style} % \begin{macrocode} -\zf@define@font@feature{Style} -\zf@define@feature@option{Style}{Alternate} {} {} {+salt} -\zf@define@feature@option{Style}{Italic} {32}{2}{+ital} -\zf@define@feature@option{Style}{Ruby} {28}{2}{+ruby} -\zf@define@feature@option{Style}{Swash} {} {} {+swsh} -\zf@define@feature@option{Style}{Historic} {} {} {+hist} -\zf@define@feature@option{Style}{Display} {19}{1}{} -\zf@define@feature@option{Style}{Engraved} {19}{2}{} -\zf@define@feature@option{Style}{TitlingCaps} {19}{4}{+titl} -\zf@define@feature@option{Style}{TallCaps} {19}{5}{} -\zf@define@feature@option{Style}{HorizontalKana}{} {} {+hkna} -\zf@define@feature@option{Style}{VerticalKana} {} {} {+vkna} +\fontspec_define_font_feature:n{Style} +\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} +\fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} +\fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} % \end{macrocode} % % \subsubsection{CJK shape} % \begin{macrocode} -\zf@define@font@feature{CJKShape} -\zf@define@feature@option{CJKShape}{Traditional}{20}{0} {+trad} -\zf@define@feature@option{CJKShape}{Simplified} {20}{1} {+smpl} -\zf@define@feature@option{CJKShape}{JIS1978} {20}{2} {+jp78} -\zf@define@feature@option{CJKShape}{JIS1983} {20}{3} {+jp83} -\zf@define@feature@option{CJKShape}{JIS1990} {20}{4} {+jp90} -\zf@define@feature@option{CJKShape}{Expert} {20}{10}{+expt} -\zf@define@feature@option{CJKShape}{NLC} {20}{13}{+nlck} +\fontspec_define_font_feature:n{CJKShape} +\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} % \end{macrocode} % % \subsubsection{Character width} % \begin{macrocode} -\zf@define@font@feature{CharacterWidth} -\zf@define@feature@option{CharacterWidth}{Proportional}{22}{0}{+pwid} -\zf@define@feature@option{CharacterWidth}{Full}{22}{1}{+fwid} -\zf@define@feature@option{CharacterWidth}{Half}{22}{2}{+hwid} -\zf@define@feature@option{CharacterWidth}{Third}{22}{3}{+twid} -\zf@define@feature@option{CharacterWidth}{Quarter}{22}{4}{+qwid} -\zf@define@feature@option{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\zf@define@feature@option{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\zf@define@feature@option{CharacterWidth}{Default}{22}{7}{} +\fontspec_define_font_feature:n{CharacterWidth} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} % \end{macrocode} % % \subsubsection{Annotation} % \begin{macrocode} -\zf@define@feature@option{Annotation}{Off}{24}{0}{} -\zf@define@feature@option{Annotation}{Box}{24}{1}{} -\zf@define@feature@option{Annotation}{RoundedBox}{24}{2}{} -\zf@define@feature@option{Annotation}{Circle}{24}{3}{} -\zf@define@feature@option{Annotation}{BlackCircle}{24}{4}{} -\zf@define@feature@option{Annotation}{Parenthesis}{24}{5}{} -\zf@define@feature@option{Annotation}{Period}{24}{6}{} -\zf@define@feature@option{Annotation}{RomanNumerals}{24}{7}{} -\zf@define@feature@option{Annotation}{Diamond}{24}{8}{} -\zf@define@feature@option{Annotation}{BlackSquare}{24}{9}{} -\zf@define@feature@option{Annotation}{BlackRoundSquare}{24}{10}{} -\zf@define@feature@option{Annotation}{DoubleCircle}{24}{11}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} % \end{macrocode} % % \begin{macrocode} \define@key[zf]{options}{Annotation}[0]{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Annotation}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Alternate} \fontspec_make_feature:nnx {}{} { \fontspec_nalt:n {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } % \end{macrocode} @@ -5261,15 +5300,15 @@ This work consists of this file fontspec.dtx % % \subsubsection{Vertical} % \begin{macrocode} -\zf@define@font@feature{Vertical} +\fontspec_define_font_feature:n{Vertical} \define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{ \ifzf@icu \fontspec_make_feature:nnn{}{}{+vrt2} - \zf@update@family{+vert} - \zf@update@ff{vertical} + \fontspec_update_fontid:n {+vert} + \fontspec_update_featstr:n{vertical} \else - \zf@update@family{+vert} - \zf@update@ff{vertical} + \fontspec_update_fontid:n {+vert} + \fontspec_update_featstr:n{vertical} \fi } % \end{macrocode} @@ -5524,16 +5563,17 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \define@key[zf@feat]{Lang}{Turkish}[]{ \fontspec_check_lang:nTF {TRK} { - \c@zf@language\l_fontspec_strnum_int\relax - \zf@update@family{+lang=Turkish} + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} + \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TRK} }{ \fontspec_check_lang:nTF {TUR} { - \c@zf@language\l_fontspec_strnum_int\relax - \zf@update@family{+lang=Turkish} + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} + \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TUR} }{ \fontspec_warning:nx {language-not-exist} {#1} + \setkeys[zf@feat]{Lang}{Default} } } } @@ -5543,9 +5583,9 @@ This work consists of this file fontspec.dtx % % \begin{macrocode} \define@key[zf@feat]{Lang}{Default}[]{ - \zf@update@family{+lang=dflt} + \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \c@zf@language=0\relax + \int_zero:N \l_fontspec_language_int } % \end{macrocode} % @@ -5554,8 +5594,8 @@ This work consists of this file fontspec.dtx % already memorised the OpenType abbreviations and don't mind not having error checking. % \begin{macrocode} \define@key[zf]{options}{RawFeature}{ - \zf@update@family{+Raw:#1} - \zf@update@ff{#1} + \fontspec_update_fontid:n {+Raw:#1} + \fontspec_update_featstr:n{#1} } % \end{macrocode} % @@ -5582,21 +5622,20 @@ This work consists of this file fontspec.dtx \DeclareTextFontCommand{\textsi}{\sishape} % \end{macrocode} % \end{macro} \end{macro} -% \begin{macro}{\zf@merge@shape} +% \begin{macro}{\fontspec_blend_shape:nnn} % This is the macro which enables the overload on the |\..shape| % commands. It takes three such arguments. In essence, the macro % selects the first argument, unless the second argument is already % selected, in which case it selects the third. % \begin{macrocode} -\newcommand*{\zf@merge@shape}[3]{ - \edef\@tempa{#1} - \edef\@tempb{#2} - \ifx\f@shape\@tempb - \ifcsname\f@encoding/\f@family/\f@series/#3\endcsname - \edef\@tempa{#3} - \fi - \fi - \fontshape{\@tempa}\selectfont +\cs_new:Nn \fontspec_blend_shape:nnn { + \bool_if:nTF + { + \str_if_eq_p:xx {\f@shape} {#2} && + \cs_if_exist_p:c {\f@encoding/\f@family/\f@series/#3} + } + { \fontshape{#3}\selectfont } + { \fontshape{#1}\selectfont } } % \end{macrocode} % \end{macro} @@ -5606,19 +5645,19 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \DeclareRobustCommand \itshape { \not@math@alphabet\itshape\mathit - \zf@merge@shape\itdefault\scdefault\sidefault + \fontspec_blend_shape:nnn\itdefault\scdefault\sidefault } \DeclareRobustCommand \slshape { \not@math@alphabet\slshape\relax - \zf@merge@shape\sldefault\scdefault\sidefault + \fontspec_blend_shape:nnn\sldefault\scdefault\sidefault } \DeclareRobustCommand \scshape { \not@math@alphabet\scshape\relax - \zf@merge@shape\scdefault\itdefault\sidefault + \fontspec_blend_shape:nnn\scdefault\itdefault\sidefault } \DeclareRobustCommand \upshape { \not@math@alphabet\upshape\relax - \zf@merge@shape\updefault\sidefault\scdefault + \fontspec_blend_shape:nnn\updefault\sidefault\scdefault } % \end{macrocode} % \end{macro} \end{macro} \end{macro} @@ -5629,7 +5668,7 @@ This work consists of this file fontspec.dtx % can only define maths fonts in the preamble, otherwise I'd run this % code whenever \cs{setmainfont} and friends was run. % -% \begin{macro}{\zf@math} +% \begin{macro}{\fontspec_setup_maths:} % Everything here is performed \cs{AtBeginDocument} in order to % overwrite \pkg{euler}'s attempt. This means \pkg{fontspec} must be % loaded \emph{after} \pkg{euler}. We set up a conditional to return @@ -5642,9 +5681,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \@ifpackageloaded{euler}{\zf@package@euler@loadedtrue} {\zf@package@euler@loadedfalse} -\def\zf@math{ - \let\zf@font@warning\@font@warning - \let\@font@warning\@font@info +\cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler}{ \ifzf@package@euler@loaded \zf@math@eulertrue @@ -5707,13 +5744,12 @@ This work consists of this file fontspec.dtx % % % \begin{macrocode} - \begingroup + \group_begin: \mathchardef\@tempa="603A \relax - \let\next\egroup \ifx\colon\@tempa \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi - \endgroup + \group_end: % \end{macrocode} % The following symbols are only defined specifically in \pkg{euler}, so skip them % if that package is loaded. @@ -5762,44 +5798,44 @@ This work consists of this file fontspec.dtx \fi % \end{macrocode} % Finally, we change the font definitions for \cmd\mathrm\ and so -% on. These are defined using the \cmd\zf@rmmaths\ (\dots) macros, +% on. These are defined using the \cmd\g_fontspec_mathrm_tl\ (\dots) macros, % which default to \cmd\rmdefault\ but may be specified with the % \cmd\setmathrm\ (\dots) commands in the preamble. % % Since \LaTeX\ only generally defines one level of boldness, we omit % \cmd\mathbf\ in the \textsf{bold} maths series. It can be specified % as per usual with \cmd\setboldmathrm, which stores the appropriate -% family name in \cmd\zf@rmboldmaths. -% \begin{macrocode} - \DeclareSymbolFont{operators}\zf@enc\zf@rmmaths\mddefault\updefault - \SetSymbolFont{operators}{normal}\zf@enc\zf@rmmaths\mddefault\updefault - \SetMathAlphabet\mathrm{normal}\zf@enc\zf@rmmaths\mddefault\updefault - \SetMathAlphabet\mathit{normal}\zf@enc\zf@rmmaths\mddefault\itdefault - \SetMathAlphabet\mathbf{normal}\zf@enc\zf@rmmaths\bfdefault\updefault - \SetMathAlphabet\mathsf{normal}\zf@enc\zf@sfmaths\mddefault\updefault - \SetMathAlphabet\mathtt{normal}\zf@enc\zf@ttmaths\mddefault\updefault - \SetSymbolFont{operators}{bold}\zf@enc\zf@rmmaths\bfdefault\updefault - \ifdefined\zf@rmboldmaths - \SetMathAlphabet\mathrm{bold}\zf@enc\zf@rmboldmaths\mddefault\updefault - \SetMathAlphabet\mathbf{bold}\zf@enc\zf@rmboldmaths\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmboldmaths\mddefault\itdefault +% family name in \cmd\g_fontspec_bfmathrm_tl. +% \begin{macrocode} + \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 + \SetMathAlphabet\mathit{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathbf{normal}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault + \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 + \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\zf@rmmaths\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmmaths\bfdefault\itdefault + \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\zf@sfmaths\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\zf@enc\zf@ttmaths\bfdefault\updefault - \let\font@warning\zf@font@warning} + \SetMathAlphabet\mathsf{bold}\zf@enc\g_fontspec_mathsf_tl\bfdefault\updefault + \SetMathAlphabet\mathtt{bold}\zf@enc\g_fontspec_mathtt_tl\bfdefault\updefault +} % \end{macrocode} % \end{macro} % -% \begin{macro}{\zf@math@maybe} -% We're a little less sophisticated about not executing the \cmd\zf@maths\ macro 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? +% \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? % This needs more cooperation with euler and lucida, I think. % \begin{macrocode} -\def\zf@math@maybe{ +\cs_new:Nn \fontspec_maybe_setup_maths: { \@ifpackageloaded{anttor}{ \ifx\define@antt@mathversions a\@zf@mathfalse\fi}{} \@ifpackageloaded{arev}{\@zf@mathfalse}{} @@ -5825,10 +5861,10 @@ This work consists of this file fontspec.dtx \@ifpackageloaded{breqn}{\@zf@mathfalse}{} \if@zf@math \fontspec_info:n {setup-math} - \zf@math + \fontspec_setup_maths: \fi } -\AtBeginDocument{\zf@math@maybe} +\AtBeginDocument{\fontspec_maybe_setup_maths:} % \end{macrocode} % \end{macro} % @@ -5838,7 +5874,7 @@ This work consists of this file fontspec.dtx % \begin{macrocode} \if@zf@configfile \InputIfFileExists{fontspec.cfg} - {\typeout{fontspec.cfg~ loaded.}} + {} {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} \fi % \end{macrocode} @@ -6014,14 +6050,14 @@ end % \begin{macrocode} \DeclareRobustCommand \em { \@nomath\em - \tl_if_eq:xxTF \f@shape \itdefault \eminnershape + \str_if_eq:xxTF \f@shape \itdefault \eminnershape { - \tl_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape + \str_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape } } \DeclareTextFontCommand{\emph}{\em} -\let\emshape\itshape -\let\eminnershape\upshape +\cs_set_eq:NN \emshape \itshape +\cs_set_eq:NN \eminnershape \upshape % \end{macrocode} % \end{macro} \end{macro} % \end{macro} \end{macro} @@ -6051,7 +6087,7 @@ end % Print \unichar{2434}{Open box}, which is used to visibly display a space character. % \begin{macrocode} \cs_new:Npn \fontspec_visible_space: { - \fontspec_glyph_if_exist:NnTF \font {"2423} + \font_glyph_if_exist:NnTF \font {"2423} {\char"2423\relax} {\fontspec_visible_space_fallback:} } @@ -6063,7 +6099,7 @@ end % \begin{macrocode} \cs_new:Npn \fontspec_visible_space_fallback: { { - \usefont{EU1}{lmtt}{\f@series}{\f@shape} + \usefont{\zf@enc}{lmtt}{\f@series}{\f@shape} \textvisiblespace } } @@ -6115,7 +6151,7 @@ end \cs_set:Npn \fontspec_patch_verbatim: { \@ifpackageloaded{verbatim}{ \cs_set:cpn {verbatim*} { - \begingroup \@verbatim \fontspec_print_visible_spaces: \verbatim@start + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start } }{ % \end{macrocode} @@ -6274,10 +6310,18 @@ information. \begin{minipage}{8cm+4pt} \fboxsep=1pt \fboxrule=1pt - \fbox{\includegraphics[width=8cm]{testsuite/#1.safe.pdf}} + \fbox{\insertpdf#1\END} \end{minipage} } +\def\insertpdf#1#2\END{% + \ifnum`#1=70\relax + \includegraphics[width=8cm]{testsuite/#1#2.Lsafe.pdf}% + \else + \includegraphics[width=8cm]{testsuite/#1#2.safe.pdf}% + \fi +} + \newcommand\codeline[1]{\par{\centering#1\par}\par\noindent\ignorespaces} \pagestyle{empty} @@ -6405,7 +6449,7 @@ If you want to run just a single test, use \refstepcounter{example}% \label{ex:\filename}% \IfFileExists{doc/\theexample-\prefix-\filename.tex}{}{% - \immediate\write18{cd doc && rm \theexample-* ;}% + \immediate\write18{cd doc && rm -f \theexample-* ;}% }% \VerbatimEnvironment \begin{VerbatimOut}{doc/\theexample-\prefix-\filename.tex}} diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-emph-01.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-emph-01.ltx new file mode 100644 index 00000000000..e24dea90cec --- /dev/null +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-emph-01.ltx @@ -0,0 +1,11 @@ +\documentclass{testsuite} +\usepackage{fontspec} +\renewcommand\eminnershape{\upshape\scshape} +\begin{document} +\setmainfont[ + ItalicFont=texgyrepagella-italic.otf + ]{texgyrepagella-regular.otf} +hello \emph{emph \emph{2emph} emph} hello + +hello {\em emph {\em 2emph} emph} hello +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F-test-prog-01.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F-test-prog-01.ltx new file mode 100644 index 00000000000..c9ec65bc928 --- /dev/null +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F-test-prog-01.ltx @@ -0,0 +1,25 @@ + +\documentclass{testsuite} +\usepackage{fontspec} +\begin{document} +\ExplSyntaxOn +LM~is +\fontspec_if_fontspec_font:TF {\ERROR}{~not~a~fontspec~font.\par} + +\setmainfont{TeX~ Gyre~ Pagella} +TeX Gyre Pagella +\fontspec_if_fontspec_font:TF {~is~a~fontspec~font}{\ERROR} + +\fontspec_if_opentype:TF {,~is~OpenType}{\ERROR} + +\fontspec_if_feature:nTF {smcp}{,~has~small~caps}{\ERROR} + +\fontspec_if_current_script:nTF {latn}{,~is~using~Latin~script}{\ERROR} + +\fontspec_if_script:nTF {cyrl}{,~also~has~Cyrillic}{\ERROR} + +\fontspec_if_current_language:nTF {DFLT}{,~is~using~`default'~language}{\ERROR} + +\fontspec_if_language:nnTF {latn}{ROM}{,~also~has~Romanian}{\ERROR} + +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L001a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F001a.ltx index 538604c1e0b..538604c1e0b 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L001a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F001a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L002a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F002a.ltx index 79f1c0dc2dd..79f1c0dc2dd 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L002a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F002a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L003a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F003a.ltx index b0d4b43aa6b..b0d4b43aa6b 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L003a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F003a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L003b.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F003b.ltx index 8e9052dd6fb..8e9052dd6fb 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L003b.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F003b.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx new file mode 100644 index 00000000000..7455431e2e3 --- /dev/null +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F003c.ltx @@ -0,0 +1,13 @@ +\documentclass{testsuite} +\usepackage{fontspec} +\usepackage{xcolor} +\begin{document} +\fontspec{Verdana} +Black +\color{red} +Red + +\fontspec[Color=red]{Verdana} +\color{blue} +Red? +\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X004a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F004a.ltx index b6b32e4c0d1..b6b32e4c0d1 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X004a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F004a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X005a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F005a.ltx index 08dc161729c..08dc161729c 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X005a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F005a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L006a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F006a.ltx index 39cd453a155..39cd453a155 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L006a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F006a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X100a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F100a.ltx index 9f49e48bc13..9f49e48bc13 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X100a.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F100a.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X100b.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F100b.ltx index 84e646b616b..84e646b616b 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X100b.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F100b.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X100c.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F100c.ltx index 83371207940..83371207940 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X100c.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F100c.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X100d.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F100d.ltx index 4e818edff8b..4e818edff8b 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X100d.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F100d.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X100e.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/F100e.ltx index f146623f66e..f146623f66e 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X100e.ltx +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/F100e.ltx diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/L005a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/L005a.ltx deleted file mode 100644 index 0a9f5b9e69f..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/L005a.ltx +++ /dev/null @@ -1,9 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\Huge -\fontspec{Junicode} -Before -\addfontfeature{StylisticSet=6} -After -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X001a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/X001a.ltx deleted file mode 100644 index d97035602fd..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X001a.ltx +++ /dev/null @@ -1,7 +0,0 @@ - -\documentclass{testsuite} -\usepackage{fontspec} -\setmainfont{TeX Gyre Pagella} -\begin{document} -Hello, sun! -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X002a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/X002a.ltx deleted file mode 100644 index 79f1c0dc2dd..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X002a.ltx +++ /dev/null @@ -1,16 +0,0 @@ - -\documentclass{testsuite} -\usepackage{fontspec} -\setmainfont[Color=FF0000]{Georgia} -\def\1{abcABC}\def\2{XYZxyz} -\def\test{\1\textsf{\2}\1\\} -\begin{document} -\setsansfont{Verdana} -\test -\setsansfont[Scale=0.5]{Verdana} -\test -\setsansfont[Scale=MatchLowercase]{Verdana} -\test -\setsansfont[Scale=MatchUppercase]{Verdana} -\test -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X003a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/X003a.ltx deleted file mode 100644 index b0d4b43aa6b..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X003a.ltx +++ /dev/null @@ -1,13 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\usepackage{xcolor} -\begin{document} -{\fontspec[Color=5500FF]{Verdana}Test} - -{\fontspec[Color=red]{Verdana}Test} vs -{\color{red}\fontspec{Verdana}Test} - -\definecolor{Foo}{rgb}{0.3,0.4,0.5} -{\fontspec[Color=Foo]{Verdana}Test} vs -{\color{Foo}\fontspec{Verdana}Test} -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/X006a.ltx b/Master/texmf-dist/source/latex/fontspec/testsuite/X006a.ltx deleted file mode 100644 index 39cd453a155..00000000000 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/X006a.ltx +++ /dev/null @@ -1,15 +0,0 @@ -\documentclass{testsuite} -\usepackage{fontspec} -\begin{document} -\def\text{\fbox{\parbox{1.55cm}{% - EXAMPLE HYPHENATION% -}}\hfill} - -\fontspec{TeX Gyre Termes} -\addfontfeature{HyphenChar=None} -\text -\addfontfeature{HyphenChar={+}} -\text -\addfontfeature{HyphenChar={"2A}} -\text -\end{document}
\ No newline at end of file diff --git a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex index 2badf388017..396b888526b 100644 --- a/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex +++ b/Master/texmf-dist/source/latex/fontspec/testsuite/testsuite-listing.tex @@ -1,17 +1,13 @@ -\TEST{L001a} -\TEST{L002a} -\TEST{L003a} -\TEST{L003b} -\TEST{L005a} -\TEST{L006a} -\TEST{X001a} -\TEST{X002a} -\TEST{X003a} -\TEST{X004a} -\TEST{X005a} -\TEST{X006a} -\TEST{X100a} -\TEST{X100b} -\TEST{X100c} -\TEST{X100d} -\TEST{X100e} +\TEST{F001a} +\TEST{F002a} +\TEST{F003a} +\TEST{F003b} +\TEST{F003c} +\TEST{F004a} +\TEST{F005a} +\TEST{F006a} +\TEST{F100a} +\TEST{F100b} +\TEST{F100c} +\TEST{F100d} +\TEST{F100e} diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty index 67e9a2675ba..c62437b3a26 100644 --- a/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty +++ b/Master/texmf-dist/tex/latex/fontspec/fontspec-patches.sty @@ -14,21 +14,21 @@ %% %% \ProvidesPackage{fontspec-patches} - [2010/09/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/09/27 v2.1a Advanced font selection for XeLaTeX/LuaLaTeX] \ExplSyntaxOn \RequirePackage{fixltx2e}[2006/03/24] \DeclareRobustCommand \em { \@nomath\em - \tl_if_eq:xxTF \f@shape \itdefault \eminnershape + \str_if_eq:xxTF \f@shape \itdefault \eminnershape { - \tl_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape + \str_if_eq:xxTF \f@shape \sldefault \eminnershape \emshape } } \DeclareTextFontCommand{\emph}{\em} -\let\emshape\itshape -\let\eminnershape\upshape +\cs_set_eq:NN \emshape \itshape +\cs_set_eq:NN \eminnershape \upshape \DeclareRobustCommand{\-}{% \discretionary{% \char\ifnum\hyphenchar\font<\z@ @@ -38,13 +38,13 @@ \fi}{}{}} \def\xlx@defaulthyphenchar{`\-} \cs_new:Npn \fontspec_visible_space: { - \fontspec_glyph_if_exist:NnTF \font {"2423} + \font_glyph_if_exist:NnTF \font {"2423} {\char"2423\relax} {\fontspec_visible_space_fallback:} } \cs_new:Npn \fontspec_visible_space_fallback: { { - \usefont{EU1}{lmtt}{\f@series}{\f@shape} + \usefont{\zf@enc}{lmtt}{\f@series}{\f@shape} \textvisiblespace } } @@ -72,7 +72,7 @@ \cs_set:Npn \fontspec_patch_verbatim: { \@ifpackageloaded{verbatim}{ \cs_set:cpn {verbatim*} { - \begingroup \@verbatim \fontspec_print_visible_spaces: \verbatim@start + \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start } }{ \cs_set:cpn {verbatim*} { diff --git a/Master/texmf-dist/tex/latex/fontspec/fontspec.sty b/Master/texmf-dist/tex/latex/fontspec/fontspec.sty index 2820cfd99a2..7a1e55d7530 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/19 v2.1 Advanced font selection for XeLaTeX/LuaLaTeX] + [2010/09/27 v2.1a Advanced font selection for XeLaTeX/LuaLaTeX] \RequirePackage{expl3,xparse} @@ -57,21 +57,26 @@ \newif\ifzf@package@euler@loaded \newif\if@zf@configfile \newif\if@zf@math -\newcount\c@zf@newff -\newcount\c@zf@index -\newcount\c@zf@script -\newcount\c@zf@language +\int_new:N \l_fontspec_script_int +\int_new:N \l_fontspec_language_int \int_new:N \l_fontspec_strnum_int \cs_set:Npn \use:x #1 { \edef\@tempa{#1}\@tempa } + +\cs_if_exist:NF \str_if_eq:xxTF { + \cs_set_eq:NN \str_if_eq_p:xx \tl_if_eq_p:xx + \cs_set_eq:NN \str_if_eq:xxTF \tl_if_eq:xxTF + \cs_set_eq:NN \str_if_eq:xxT \tl_if_eq:xxT + \cs_set_eq:NN \str_if_eq:xxF \tl_if_eq:xxF + \cs_set_eq:NN \str_if_eq_p:nn \tl_if_eq_p:nn + \cs_set_eq:NN \str_if_eq:nnTF \tl_if_eq:nnTF + \cs_set_eq:NN \str_if_eq:nnT \tl_if_eq:nnT + \cs_set_eq:NN \str_if_eq:nnF \tl_if_eq:nnF +} \cs_set:Npn \use_v:nnnnn #1#2#3#4#5 {#5} \cs_set:Npn \use_iv:nnnnn #1#2#3#4#5 {#4} -\prg_new_conditional:Nnn \fontspec_glyph_if_exist:Nn {p,TF,T,F} { - \etex_iffontchar:D #1 #2 \scan_stop: - \prg_return_true: - \else: - \prg_return_false: - \fi: -} +\cs_generate_variant:Nn \str_if_eq:nnTF {nv} +\cs_generate_variant:Nn \int_set:Nn {Nv} +\cs_generate_variant:Nn \tl_gset:Nn {cV} \cs_new:Npn \fontspec_setkeys:xx #1#2 { \use:x { \exp_not:N \setkeys*[zf]{#1}{#2} } @@ -103,7 +108,7 @@ } \msg_new:nnn {fontspec} {no-glyph} { - '\zf@fontname'~ does~ not~ contain~ glyph~ #1. + '\l_fontspec_fontname_tl'~ does~ not~ contain~ glyph~ #1. } \msg_new:nnnn {fontspec} {unknown-options} { @@ -150,38 +155,40 @@ } \msg_new:nnn {fontspec} {script-not-exist} { - Font~ '\zf@fontname'~ does~ not~ contain~ script~ '#1'. + Font~ '\l_fontspec_fontname_tl'~ does~ not~ contain~ script~ '#1'.\\ + 'Latin'~ script~ used~ instead. } \msg_new:nnn {fontspec} {aat-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ - for~ AAT~ font~ '\zf@fontname'. + for~ AAT~ font~ '\l_fontspec_fontname_tl'. } \msg_new:nnn {fontspec} {aat-feature-not-exist-in-font} { AAT~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\ - in~ font~ '\zf@fontname'. + in~ font~ '\l_fontspec_fontname_tl'. } \msg_new:nnn {fontspec} {icu-feature-not-exist} { '\XKV@tfam=\XKV@tkey'~ feature~ not~ supported\\ - for~ ICU~ font~ '\zf@fontname' + for~ ICU~ font~ '\l_fontspec_fontname_tl' } \msg_new:nnn {fontspec} {icu-feature-not-exist-in-font} { OpenType~ feature~ '\XKV@tfam=\XKV@tkey'~ (#1)~ not~ available\\ - for~ font~ '\zf@fontname', \\ + for~ font~ '\l_fontspec_fontname_tl', \\ with~ script~ '\l_fontspec_script_name_tl',~ and~ language~ '\l_fontspec_lang_name_tl'. } \msg_new:nnn {fontspec} {no-opticals} { - '\zf@fontname'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. + '\l_fontspec_fontname_tl'~ doesn't~ appear~ to~ have~ an~ Optical~ Size~ axis. } \msg_new:nnn {fontspec} {language-not-exist} { Language~ '#1'~ not~ available\\ - for~ font~ '\zf@fontname'\\ - with~ script~ '\l_fontspec_script_name_tl'. + for~ font~ '\l_fontspec_fontname_tl'~ + with~ script~ '\l_fontspec_script_name_tl'.\\ + 'Default'~ language~ used~ instead. } \msg_new:nnn {fontspec} {only-xetex-feature} { @@ -206,7 +213,23 @@ } \msg_new:nnn {fontspec} {defining-font} { - Defining~ font~ family~ for~ '#2'~ with~ options~ [\zf@default@options #1]. + Defining~ font~ family~ for~ '#2'~ with~ options~ [\g_fontspec_default_fontopts_tl #1]. +} +\msg_new:nnn {fontspec} {defining-raw} +{ + Defining~ shape~ + '\prg_case_str:nnn {#1} { + {\mddefault/\updefault} {normal} + {\mddefault/\scdefault} {small~ caps} + {\bfdefault/\updefault} {bold} + {\bfdefault/\scdefault} {bold~ small~ caps} + {\mddefault/\itdefault} {italic} + {\mddefault/\sidefault} {italic~ small~ caps} + {\bfdefault/\itdefault} {bold~ italic} + {\bfdefault/\sidefault} {bold~ italic~ small~ caps} + } {#1}'~ + with~ NFSS~ specification: \\ + \l_fontspec_nfss_tl } \msg_new:nnn {fontspec} {no-font-shape} { @@ -214,7 +237,7 @@ } \msg_new:nnn {fontspec} {set-scale} { - \zf@fontname\space scale ~=~ \l_fontspec_scale_tl. + \l_fontspec_fontname_tl\space scale ~=~ \l_fontspec_scale_tl. } \msg_new:nnn {fontspec} {setup-math} { @@ -222,7 +245,7 @@ } \msg_new:nnn {fontspec} {no-scripts} { - Font~ \zf@fontname\space does~ not~ contain~ any~ OpenType~ `Script'~ information. + Font~ \l_fontspec_fontname_tl\space does~ not~ contain~ any~ OpenType~ `Script'~ information. } \msg_new:nnn {fontspec} {opa-twice} { @@ -304,24 +327,24 @@ } \cs_set_eq:NN \setromanfont \setmainfont \DeclareDocumentCommand \setmathrm { O{} m } { - \fontspec_set_family:Nnn \zf@rmmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathrm_tl {#1}{#2} } \DeclareDocumentCommand \setboldmathrm { O{} m } { - \fontspec_set_family:Nnn \zf@rmboldmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_bfmathrm_tl {#1}{#2} } \DeclareDocumentCommand \setmathsf { O{} m } { - \fontspec_set_family:Nnn \zf@sfmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathsf_tl {#1}{#2} } \DeclareDocumentCommand \setmathtt { O{} m } { - \fontspec_set_family:Nnn \zf@ttmaths {#1}{#2} + \fontspec_set_family:Nnn \g_fontspec_mathtt_tl {#1}{#2} } \@onlypreamble\setmathrm \@onlypreamble\setboldmathrm \@onlypreamble\setmathsf \@onlypreamble\setmathtt -\def\zf@rmmaths{\rmdefault} -\def\zf@sfmaths{\sfdefault} -\def\zf@ttmaths{\ttdefault} +\def\g_fontspec_mathrm_tl{\rmdefault} +\def\g_fontspec_mathsf_tl{\sfdefault} +\def\g_fontspec_mathtt_tl{\ttdefault} \DeclareDocumentCommand \newfontfamily { m O{} m } { \fontspec_select:nn{#2}{#3} \use:x { @@ -334,50 +357,50 @@ \DeclareDocumentCommand \newfontface { m O{} m } { \newfontfamily #1 [ BoldFont={},ItalicFont={},SmallCapsFont={},#2 ] {#3} } -\DeclareDocumentCommand \defaultfontfeatures {m} {\def\zf@default@options{#1,}} -\let\zf@default@options\@empty +\DeclareDocumentCommand \defaultfontfeatures {m} { + \tl_set:Nn \g_fontspec_default_fontopts_tl {#1,} +} +\tl_clear:N \g_fontspec_default_fontopts_tl \DeclareDocumentCommand \addfontfeatures {m} { \ifcsname zf@family@fontdef\f@family\endcsname - \begingroup - \let\zf@default@options\@empty + \group_begin: + \tl_clear:N \g_fontspec_default_fontopts_tl \use:x { \exp_not:N\fontspec_select:nn {\csname zf@family@options\f@family\endcsname,#1} {\csname zf@family@fontname\f@family\endcsname} } - \endgroup + \group_end: \fontfamily\zf@family\selectfont \else \fontspec_warning:n {addfontfeatures-ignored} \fi \ignorespaces } -\let\addfontfeature\addfontfeatures +\cs_set_eq:NN \addfontfeature \addfontfeatures \DeclareDocumentCommand \newfontfeature {mm} { - \stepcounter{zf@newff} - \cs_set:cpx{+zf-#1}{+zf-\the\c@zf@newff} \define@key[zf]{options}{#1}[]{ - \zf@update@family{\csname+zf-#1\endcsname} - \zf@update@ff{#2} + \fontspec_update_fontid:n {+zf-#1} + \fontspec_update_featstr:n {#2} } } \DeclareDocumentCommand \newAATfeature {mmmm} { \unless\ifcsname zf@options@#1\endcsname - \zf@define@font@feature{#1} + \fontspec_define_font_feature:n{#1} \fi \key@ifundefined[zf]{#1}{#2}{}{ \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \zf@define@feature@option{#1}{#2}{#3}{#4}{} + \fontspec_define_feature_option:nnnnn{#1}{#2}{#3}{#4}{} } \DeclareDocumentCommand \newICUfeature {mmm} { \unless\ifcsname zf@options@#1\endcsname - \zf@define@font@feature{#1} + \fontspec_define_font_feature:n{#1} \fi \key@ifundefined[zf]{#1}{#2}{}{ \fontspec_warning:nxx {feature-option-overwrite}{#1}{#2} } - \zf@define@feature@option{#1}{#2}{}{}{#3} + \fontspec_define_feature_option:nnnnn{#1}{#2}{}{}{#3} } \cs_set_eq:NN \newopentypefeature \newICUfeature \DeclareDocumentCommand \aliasfontfeature {mm} {\multi@alias@key{#1}{#2}} @@ -393,11 +416,12 @@ { \define@key[zf@feat]{Script}{#1}[]{ \fontspec_check_script:nTF {#2} { - \zf@update@family{+script=#1} + \fontspec_update_fontid:n {+script=#1} \tl_set:Nn \l_fontspec_script_tl {#2} - \c@zf@script=\l_fontspec_strnum_int\relax + \int_set:Nn \l_fontspec_script_int {\l_fontspec_strnum_int} }{ \fontspec_warning:nx {script-not-exist} {#1} + \setkeys[zf@feat]{Script}{Latin} } } } @@ -410,11 +434,12 @@ { \define@key[zf@feat]{Lang}{#1}[]{ \fontspec_check_lang:nTF {#2} { - \zf@update@family{+lang=#1} + \fontspec_update_fontid:n {+lang=#1} \tl_set:Nn \l_fontspec_lang_tl {#2} - \c@zf@language=\l_fontspec_strnum_int\relax + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} }{ \fontspec_warning:nx {language-not-exist} {#1} + \setkeys[zf@feat]{Lang}{Default} } } } @@ -431,24 +456,20 @@ \fi } \prg_new_conditional:Nnn \fontspec_if_aat_feature:nn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \fontspec_if_fontspec_font:TF { \font_set:Nnn \zf@basefont {\use:c{zf@family@fontdef\f@family}} {\f@size pt} \ifzf@atsui - \fontspec_make_AAT_feature_string:nn{#1}{#2} - \ifx\@tempa\@empty - \prg_return_false: - \else - \prg_return_true: - \fi + \fontspec_make_AAT_feature_string:nnTF {#1}{#2} + \prg_return_true: \prg_return_false: \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_opentype: {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 @@ -456,46 +477,44 @@ \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_feature:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \int_set:Nn \c@zf@script - {\use:c {g_fontspec_script_num_(\zf@family)_tl}} - \int_set:Nn \c@zf@language - {\use:c {g_fontspec_lang_num_(\zf@family)_tl}} - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl} - \tl_set:Nv \l_fontspec_lang_tl {g_fontspec_lang_(\zf@family)_tl} + \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 \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_feature:nnn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax - \fontspec_iv_str_to_num:n{#2} \c@zf@language = \l_fontspec_strnum_int \relax + \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 - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_script:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 @@ -503,91 +522,100 @@ \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_language:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_set:Nv \l_fontspec_script_tl {g_fontspec_script_(\zf@family)_tl} - \int_set:Nn \c@zf@script - {\use:c {g_fontspec_script_num_(\zf@family)_tl}} + \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 - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_language:nn {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 \tl_set:Nn \l_fontspec_script_tl {#1} - \fontspec_iv_str_to_num:n{#1} \c@zf@script = \l_fontspec_strnum_int \relax + \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 - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_current_script:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_if_eq:nvTF {#1} {g_fontspec_script_(\zf@family)_tl} + \str_if_eq:nvTF {#1} {g_fontspec_script_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } \prg_new_conditional:Nnn \fontspec_if_current_language:n {TF,T,F} { - \ifcsname zf@family@fontdef\f@family\endcsname + \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 - \tl_if_eq:nvTF {#1} {g_fontspec_lang_(\zf@family)_tl} + \str_if_eq:nvTF {#1} {g_fontspec_lang_(\f@family)_tl} {\prg_return_true:} {\prg_return_false:} \else \prg_return_false: \fi - \else + }{ \prg_return_false: - \fi + } } -\cs_generate_variant:Nn \tl_if_eq:nnTF {nv} \cs_new:Npn \fontspec_set_family:Nnn #1#2#3 { \fontspec_select:nn {#2}{#3} \tl_set_eq:NN #1 \zf@family } \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_fontwrap:n #1 } { "#1" } { {#1} } \cs_set:Npn \fontspec_fontwrap:n #1 { "#1" } +\cs_set_eq:NN \font_set_eq:NN \tex_let:D \cs_new:Npn \font_set:Nnn #1#2#3 { \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop: } \cs_new:Npn \font_gset:Nnn #1#2#3 { \global \font #1 = \fontspec_fontwrap:n {#2} ~at~#3\scan_stop: } +\prg_new_conditional:Nnn \font_glyph_if_exist:Nn {p,TF,T,F} { + \etex_iffontchar:D #1 #2 \scan_stop: + \prg_return_true: + \else: + \prg_return_false: + \fi: +} \cs_set:Npn \fontspec_select:nn #1#2 { - \begingroup + \group_begin: \fontspec_init: - \edef\zf@fontname{#2} - \let\zf@family@long\zf@fontname - \let\zf@up\zf@fontname + \tl_set:Nx \l_fontspec_fontname_tl {#2} + \luatex_if_engine:T { + \tl_replace_all_in:Nnn \l_fontspec_fontname_tl {~} {} + } + \tl_set_eq:NN \l_fontspec_fontid_tl \l_fontspec_fontname_tl + \tl_set_eq:NN \l_fontspec_fontname_up_tl \l_fontspec_fontname_tl \fontspec_preparse_features:nn {#1}{#2} \fontspec_set_scriptlang: - \fontspec_get_features:n {\zf@font@feat} + \fontspec_get_features:n {} \zf@firsttimefalse \fontspec_save_family:nT {#2} { \fontspec_info:nxx {defining-font} {#1} {#2} @@ -600,19 +628,19 @@ \fontspec_set_bold_italic: \fontspec_set_bold_slanted: } - \endgroup + \group_end: } \cs_set_eq:NN \zf@fontspec \fontspec_select:nn \cs_new:Npn \fontspec_preparse_features:nn #1#2 { \fontspec_if_detect_external:nT {#2} { \setkeys[zf]{preparse-external}{ExternalLocation} } - \fontspec_setkeys:xx {preparse-external} {\zf@default@options #1} - \let\zf@fontname\zf@up + \fontspec_setkeys:xx {preparse-external} {\g_fontspec_default_fontopts_tl #1} + \tl_set_eq:NN \l_fontspec_fontname_tl \l_fontspec_fontname_up_tl \fontspec_setkeys:xx {preparse} {\XKV@rm} - \let\zf@font@feat\XKV@rm - \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt} + \clist_set_eq:NN \l_fontspec_fontfeat_clist \XKV@rm + \font_set:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} \fontspec_set_font_type: - \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\zf@up}} {\f@size pt} + \font_gset:Nnn \zf@basefont {\fontspec_fullname:n {\l_fontspec_fontname_up_tl}} {\f@size pt} \zf@basefont % this is necessary for LuaLaTeX to check the scripts properly } \prg_new_conditional:Nnn \fontspec_if_detect_external:n {T} @@ -632,7 +660,7 @@ } %% Now we have a unique (in fact, too unique!) string that contains \prg_new_conditional:Nnn \fontspec_save_family:n {T} { - \cs_if_exist:cF {g_fontspec_UID_\zf@family@long} + \cs_if_exist:cF {g_fontspec_UID_\l_fontspec_fontid_tl} { \cs_if_exist:cTF {g_fontspec_family_#1_int} { \int_gincr:c {g_fontspec_family_#1_int} @@ -640,12 +668,12 @@ \int_new:c {g_fontspec_family_#1_int} } \edef\@tempa{#1~} - \tl_gset:cx {g_fontspec_UID_\zf@family@long} { + \tl_gset:cx {g_fontspec_UID_\l_fontspec_fontid_tl} { \expandafter\zap@space\@tempa\@empty ( \int_use:c {g_fontspec_family_#1_int} ) } } - \tl_gset:Nv \zf@family {g_fontspec_UID_\zf@family@long} + \tl_gset:Nv \zf@family {g_fontspec_UID_\l_fontspec_fontid_tl} \cs_if_exist:cTF {zf@family@fontname\zf@family} \prg_return_false: \prg_return_true: } @@ -676,48 +704,43 @@ } \cs_new:Npn \fontspec_save_fontinfo:nn #1#2 { \tl_gset:cx {zf@family@fontname\zf@family} {#2} - \tl_gset:cx {zf@family@options\zf@family} {\zf@default@options #1} + \tl_gset:cx {zf@family@options\zf@family} {\g_fontspec_default_fontopts_tl #1} \tl_gset:cx {zf@family@fontdef\zf@family} { - \fontspec_fullname:n {\zf@fontname} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist + \fontspec_fullname:n {\l_fontspec_fontname_tl} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist } - \tl_gset:cx {g_fontspec_script_num_(\zf@family)_tl} - { \int_use:N \c@zf@script } - \tl_gset:cx {g_fontspec_lang_num_(\zf@family)_tl} - { \int_use:N \c@zf@language } + \tl_gset:cV {g_fontspec_script_num_(\zf@family)_tl} \l_fontspec_script_int + \tl_gset:cV {g_fontspec_lang_num_(\zf@family)_tl} \l_fontspec_language_int \tl_gset_eq:cN {g_fontspec_script_(\zf@family)_tl} \l_fontspec_script_tl \tl_gset_eq:cN {g_fontspec_lang_(\zf@family)_tl} \l_fontspec_lang_tl } \cs_new:Npn \fontspec_set_upright: { - \zf@make@font@shapes{\zf@fontname} - {\mddefault}{\updefault}{\zf@font@feat\zf@up@feat} + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_tl + \mddefault \updefault \l_fontspec_fontfeat_up_clist } \cs_new:Npn \fontspec_set_bold: { \unless\ifzf@nobf - \ifx\zf@bf\@empty - \zf@make@font@shapes[\zf@fontname]{/B} - {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat} - \else - \zf@make@font@shapes{\zf@bf} - {\bfdefault}{\updefault}{\zf@font@feat\zf@bf@feat} - \fi + \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 + }{ + \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 - \ifx\zf@it\@empty - \zf@make@font@shapes[\zf@fontname]{/I} - {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat} - \else - \zf@make@font@shapes{\zf@it} - {\mddefault}{\itdefault}{\zf@font@feat\zf@it@feat} - \fi + \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: { - \ifx\zf@sl\@empty\else - \zf@make@font@shapes{\zf@sl} - {\mddefault}{\sldefault}{\zf@font@feat\zf@sl@feat} - \fi + \tl_if_empty:NF \l_fontspec_fontname_sl_tl { + \fontspec_make_font_shapes:nnnn + \l_fontspec_fontname_sl_tl \mddefault \sldefault \l_fontspec_fontfeat_sl_clist + } } \cs_new:Npn \fontspec_set_bold_italic: { \@tempswatrue @@ -725,35 +748,38 @@ \ifzf@noit\@tempswafalse\fi \bool_if:NT \l_fontspec_external_bool \@tempswafalse \if@tempswa - \ifx\zf@bfit\@empty - \ifx\zf@bf\@empty - \ifx\zf@it\@empty - \zf@make@font@shapes[\zf@fontname]{/BI} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \else - \zf@make@font@shapes[\zf@it]{/B} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi - \else - \zf@make@font@shapes[\zf@bf]{/I} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi - \else - \zf@make@font@shapes{\zf@bfit} - {\bfdefault}{\itdefault}{\zf@font@feat\zf@bfit@feat} - \fi + \tl_if_empty:NTF \l_fontspec_fontname_bfit_tl + { + \tl_if_empty:NTF \l_fontspec_fontname_bf_tl + { + \tl_if_empty:NTF \l_fontspec_fontname_it_tl + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_tl {/BI} + } + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_it_tl {/B} + } + } + { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_bf_tl {/I} + } + } + { + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfit_tl + } + \bfdefault \itdefault \l_fontspec_fontfeat_bfit_clist \fi } \cs_new:Npn \fontspec_set_bold_slanted: { - \ifx\zf@bfsl\@empty - \ifx\zf@sl\@empty\else - \zf@make@font@shapes[\zf@sl]{/B} - {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat} - \fi - \else - \zf@make@font@shapes{\zf@bfsl} - {\bfdefault}{\sldefault}{\zf@font@feat\zf@bfsl@feat} - \fi + \tl_if_empty:NTF \l_fontspec_fontname_bfsl_tl { + \tl_if_empty:NF \l_fontspec_fontname_sl_tl { + \fontspec_make_font_shapes:nnnnn \l_fontspec_fontname_sl_tl {/B} + \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + } + }{ + \fontspec_make_font_shapes:nnnn \l_fontspec_fontname_bfsl_tl + \bfdefault \sldefault \l_fontspec_fontfeat_bfsl_clist + } } \xetex_or_luatex:nnn { \cs_new:Npn \fontspec_set_font_type: } { @@ -779,45 +805,44 @@ { \zf@icutrue } -\newcommand*\zf@make@font@shapes[5][]{ - \begingroup - \edef\@tempa{#1} - \unless\ifx\@tempa\@empty - \font_set:Nnn \@tempfonta {\fontspec_fullname:n {#1}} {\f@size pt} - \edef\@tempa{\fontname\@tempfonta} - \fi - \font_set:Nnn \@tempfontb {\fontspec_fullname:n {#1#2}} {\f@size pt} - \edef\@tempb{\fontname\@tempfontb} - \ifx\@tempa\@tempb - \fontspec_info:nx {no-font-shape} {#1#2} - \else - \edef\zf@fontname{#1#2} - \let\zf@basefont\@tempfontb - \fontspec_declare_shape:nnnn {}{#3}{#4}{#5} - \ifx\zf@sc\@empty - \unless\ifzf@nosc - \zf@make@smallcaps - \unless\ifx\zf@smallcaps\@empty - \fontspec_declare_shape:nnnn {\zf@smallcaps}{#3} - {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat} - \fi - \fi - \else - \edef\zf@fontname{\zf@sc} - \fontspec_declare_shape:nnnn {}{#3} - {\ifx#4\itdefault\sidefault\else\scdefault\fi}{#5\zf@sc@feat} +\cs_new:Nn \fontspec_make_font_shapes:nnnnn { + \font_set:Nnn \l_tmpa_font {\fontspec_fullname:n {#1}} {\f@size pt} + \font_set:Nnn \l_tmpb_font {\fontspec_fullname:n {#1#2}} {\f@size pt} + \str_if_eq:xxTF { \fontname \l_tmpa_font } { \fontname \l_tmpb_font } + { \fontspec_info:nx {no-font-shape} {#1#2} } + { + \fontspec_make_font_shapes:nnnn {#1#2}{#3}{#4}{#5} + } +} +\cs_new:Nn \fontspec_make_font_shapes:nnnn { + \group_begin: + \tl_set:Nx \l_fontspec_fontname_tl {#1} + \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 + \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 - \fi - \endgroup + }{ + \tl_set:Nx \l_fontspec_fontname_tl {\l_fontspec_fontname_sc_tl} + \fontspec_declare_shape:nnnn {}{#2} + { \tl_if_eq:NNTF #3 \itdefault \sidefault \scdefault } + { #4 \l_fontspec_fontfeat_sc_clist } + } + \group_end: } \cs_new:Npn \fontspec_declare_shape:nnnn #1#2#3#4 { \clist_if_empty:NTF \l_fontspec_sizefeat_clist { - \fontspec_get_features:n{#4} + \fontspec_get_features:n {#4} \tl_set:Nx \l_fontspec_nfss_tl { <-> \l_fontspec_scale_tl \fontspec_fontwrap:n { - \fontspec_fullname:n {\zf@fontname} : + \fontspec_fullname:n {\l_fontspec_fontname_tl} : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 } } @@ -825,11 +850,14 @@ { \tl_clear:N \l_fontspec_nfss_tl \clist_map_inline:Nn \l_fontspec_sizefeat_clist { + \tl_clear:N \l_fontspec_size_tl - \tl_set_eq:NN \l_fontspec_sizedfont_tl \zf@fontname - \fontspec_setkeys:xx {sizing} { \expandafter \@firstofone ##1 } + \tl_set_eq:NN \l_fontspec_sizedfont_tl \l_fontspec_fontname_tl + + \fontspec_setkeys:xx {sizing} { \expandafter \use:n ##1 } \tl_if_empty:NT \l_fontspec_size_tl { \fontspec_error:n {no-size-info} } - \fontspec_get_features:n{#4,\XKV@rm} + \fontspec_get_features:n{ #4 , \XKV@rm } + \tl_put_right:Nx \l_fontspec_nfss_tl { <\l_fontspec_size_tl> \l_fontspec_scale_tl \fontspec_fontwrap:n { @@ -837,21 +865,19 @@ : \l_fontspec_pre_feat_tl \l_fontspec_rawfeatures_sclist #1 } } + } } - \PackageInfo{fontspec}{ - Defining~ shape~ #2/#3~ with~ raw~ font~ features: - \MessageBreak \l_fontspec_rawfeatures_sclist - \@gobble} + \fontspec_info:nx {defining-raw} {#2/#3} \use:x{ \exp_not:N\DeclareFontShape{\zf@enc}{\zf@family}{#2}{#3} - {\l_fontspec_nfss_tl}{\zf@adjust} + {\l_fontspec_nfss_tl}{\l_fontspec_postadjust_tl} } - \tl_if_eq:xxT {#3} {\itdefault} + \str_if_eq:xxT {#3} {\itdefault} { \use:x { \exp_not:N \DeclareFontShape {\zf@enc}{\zf@family}{#2}{\sldefault} - {<->ssub*\zf@family/#2/\itdefault}{\zf@adjust} + {<->ssub*\zf@family/#2/\itdefault}{\l_fontspec_postadjust_tl} } } } @@ -873,38 +899,42 @@ language = \l_fontspec_lang_tl ; } } -\newcommand*{\zf@update@family}[1]{ +\cs_new:Nn \fontspec_update_fontid:n { \ifzf@firsttime - \xdef\zf@family@long{\zf@family@long#1} + \tl_gput_right:Nx \l_fontspec_fontid_tl {#1} \fi } \cs_set:Npn \fontspec_get_features:n #1 { - \let\l_fontspec_rawfeatures_sclist \@empty + \sclist_clear:N \l_fontspec_rawfeatures_sclist \tl_clear:N \l_fontspec_scale_tl \tl_set_eq:NN \l_fontspec_opacity_tl \g_fontspec_opacity_tl \tl_set_eq:NN \l_fontspec_hexcol_tl \g_fontspec_hexcol_tl - \let\zf@adjust \@empty - \fontspec_setkeys:xx {options} {#1} + \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 } } - \zf@update@ff{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} -} -\tl_clear:N \zf@bf -\tl_clear:N \zf@it -\tl_clear:N \zf@fake@slant -\tl_clear:N \zf@fake@embolden -\tl_clear:N \zf@bfit -\tl_clear:N \zf@sl -\tl_clear:N \zf@bfsl -\tl_clear:N \zf@sc -\tl_clear:N \zf@up@feat -\tl_clear:N \zf@bf@feat -\tl_clear:N \zf@it@feat -\tl_clear:N \zf@bfit@feat -\tl_clear:N \zf@sl@feat -\tl_clear:N \zf@bfsl@feat -\tl_clear:N \zf@sc@feat + \str_if_eq:xxF { \l_fontspec_hexcol_tl \l_fontspec_opacity_tl } + { \g_fontspec_hexcol_tl \g_fontspec_opacity_tl } + { + \fontspec_update_featstr:n{color=\l_fontspec_hexcol_tl\l_fontspec_opacity_tl} + } +} +\tl_clear:N \l_fontspec_fontname_bf_tl +\tl_clear:N \l_fontspec_fontname_it_tl +\tl_clear:N \l_fontspec_fake_slant_tl +\tl_clear:N \l_fontspec_fake_embolden_tl +\tl_clear:N \l_fontspec_fontname_bfit_tl +\tl_clear:N \l_fontspec_fontname_sl_tl +\tl_clear:N \l_fontspec_fontname_bfsl_tl +\tl_clear:N \l_fontspec_fontname_sc_tl +\tl_clear:N \l_fontspec_fontfeat_up_clist +\tl_clear:N \l_fontspec_fontfeat_bf_clist +\tl_clear:N \l_fontspec_fontfeat_it_clist +\tl_clear:N \l_fontspec_fontfeat_bfit_clist +\tl_clear:N \l_fontspec_fontfeat_sl_clist +\tl_clear:N \l_fontspec_fontfeat_bfsl_clist +\tl_clear:N \l_fontspec_fontfeat_sc_clist \tl_clear:N \l_fontspec_script_name_tl \tl_clear:N \l_fontspec_script_tl \tl_clear:N \l_fontspec_lang_name_tl @@ -928,34 +958,44 @@ \luatexpostexhyphenchar= 0 % fixme } } -\newcommand*\zf@make@smallcaps{ - \let\zf@smallcaps\@empty - \xetex_or_luatex:nn - { +\cs_set:Nn \fontspec_make_ot_smallcaps:T { + \tl_clear:N \l_fontspec_sc_featstr_sclist + \fontspec_check_ot_feat:nT {+smcp} { + \tl_set:Nx \l_fontspec_sc_featstr_sclist {+smcp;} + #1 + } +} +\xetex_or_luatex:nn +{ + \cs_set:Nn \fontspec_make_smallcaps:T { \ifzf@atsui - \fontspec_make_AAT_feature_string:nn{3}{3} - \unless\ifx\@tempa\@empty - \edef\zf@smallcaps{\@tempa;} - \fi + \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 - \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}} + \fontspec_make_ot_smallcaps:T {#1} \fi } - { - \fontspec_check_ot_feat:nT {+smcp} {\edef\zf@smallcaps{+smcp;}} - } } -\cs_new:Npn \sclist_put_right:Nn #1#2 { +{ + \cs_set_eq:NN \fontspec_make_smallcaps:T \fontspec_make_ot_smallcaps:T +} +\cs_set_eq:NN \sclist_new:N \tl_new:N +\cs_set_eq:NN \sclist_clear:N \tl_clear:N +\cs_new:Npn \sclist_gput_right:Nn #1#2 { \tl_if_empty:NTF #1 { - \tl_set:Nn #1 {#2} + \tl_gset:Nn #1 {#2} }{ - \tl_put_right:Nn #1 {;#2} + \tl_gput_right:Nn #1 {;#2} } } -\newcommand*\zf@update@ff[1]{ +\cs_generate_variant:Nn \sclist_gput_right:Nn {Nx} +\cs_new:Nn \fontspec_update_featstr:n { \unless\ifzf@firsttime - \xdef\l_fontspec_rawfeatures_sclist{\l_fontspec_rawfeatures_sclist #1;} + \sclist_gput_right:Nx \l_fontspec_rawfeatures_sclist {#1} \fi } \cs_new:Npn \fontspec_make_feature:nnn #1#2#3 { @@ -975,37 +1015,32 @@ \cs_generate_variant:Nn \fontspec_make_feature:nnn {nnx} \cs_new:Npn \fontspec_make_AAT_feature:nn #1#2 { \tl_if_empty:nTF {#1} + { \fontspec_warning:n {aat-feature-not-exist} } { - \fontspec_warning:n {aat-feature-not-exist} - } - { - \fontspec_make_AAT_feature_string:nn {#1}{#2} - \ifx\@tempa\@empty - \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} - \else - \zf@update@family{+#1,#2} - \zf@update@ff\@tempa - \fi + \fontspec_make_AAT_feature_string:nnTF {#1}{#2} + { + \fontspec_update_fontid:n {+#1,#2} + \fontspec_update_featstr:n {\l_fontspec_feature_string_tl} + } + { \fontspec_warning:nx {aat-feature-not-exist-in-font} {#1,#2} } } } \cs_new:Npn \fontspec_make_ICU_feature:n #1 { \tl_if_empty:nTF {#1} + { \fontspec_warning:n {icu-feature-not-exist} } { - \fontspec_warning:n {icu-feature-not-exist} - } - { - \fontspec_check_ot_feat:nTF {#1} { - \zf@update@family{#1} - \zf@update@ff{#1} - }{ - \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} + \fontspec_check_ot_feat:nTF {#1} + { + \fontspec_update_fontid:n {#1} + \fontspec_update_featstr:n{#1} } + { \fontspec_warning:nx {icu-feature-not-exist-in-font} {#1} } } } -\newcommand*\zf@define@font@feature[1]{ +\cs_new:Nn \fontspec_define_font_feature:n { \define@key[zf]{options}{#1}{{\setkeys[zf@feat]{#1}{##1}}} } -\newcommand*\zf@define@feature@option[5]{ +\cs_new:Nn \fontspec_define_feature_option:nnnnn { \define@key[zf@feat]{#1}{#2}[]{\fontspec_make_feature:nnn{#3}{#4}{#5}} } \newcommand*\keyval@alias@key[4][KV]{ @@ -1025,66 +1060,69 @@ } { \keyval@alias@key[zf]{options}{#1}{#2} } } -\cs_new:Npn \fontspec_make_AAT_feature_string:nn #1#2 { - \edef\@tempa{\XeTeXfeaturename\zf@basefont #1} - \unless\ifx\@tempa\@empty - \ifnum\XeTeXisexclusivefeature\zf@basefont #1>0 - \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2} - \else - \unless\ifodd #2 - \edef\@tempb{\XeTeXselectorname\zf@basefont #1\space #2} - \else - \edef\@tempb{ +\prg_new_conditional:Nnn \fontspec_make_AAT_feature_string:nn {TF,T,F} { + \tl_set:Nx \l_tmpa_tl { \XeTeXfeaturename \zf@basefont #1 } + \tl_if_empty:NTF \l_tmpa_tl + { \prg_return_false: } + { + \intexpr_compare:nTF { \XeTeXisexclusivefeature\zf@basefont #1 > 0 } + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} + }{ + \intexpr_if_even:nTF {#2} + { + \tl_set:Nx \l_tmpb_tl {\XeTeXselectorname\zf@basefont #1\space #2} + }{ + \tl_set:Nx \l_tmpb_tl { \XeTeXselectorname\zf@basefont #1\space \numexpr#2-1\relax } - \unless\ifx\@tempb\@empty - \edef\@tempb{!\@tempb} - \fi - \fi - \fi - \unless\ifx\@tempb\@empty - \edef\@tempa{\@tempa=\@tempb} - \else - \let\@tempa\@empty - \fi - \fi + \tl_if_empty:NF \l_tmpb_tl { \tl_put_left:Nn \l_tmpb_tl {!} } + } + } + \tl_if_empty:NTF \l_tmpb_tl + { \prg_return_false: } + { + \tl_set:Nx \l_fontspec_feature_string_tl { \l_tmpa_tl = \l_tmpb_tl } + \prg_return_true: + } + } } -\cs_set:Npn \fontspec_iv_str_to_num:n #1 { - \fontspec_iv_str_to_num:w #1 \@empty \@empty \q_nil +\cs_set:Npn \fontspec_iv_str_to_num:Nn #1#2 { + \fontspec_iv_str_to_num:w #1 \q_nil #2 \@empty \@empty \q_nil } -\cs_set:Npn \fontspec_iv_str_to_num:w #1#2#3#4#5 \q_nil { - \int_set:Nn \l_fontspec_strnum_int { - `#1 * "1000000 - + `#2 * "10000 - + \ifx \@empty #3 32 \else `#3 \fi * "100 - + \ifx \@empty #4 32 \else `#4 \fi +\cs_set:Npn \fontspec_iv_str_to_num:w #1 \q_nil #2#3#4#5#6 \q_nil { + \int_set:Nn #1 { + `#2 * "1000000 + + `#3 * "10000 + + \ifx \@empty #4 32 \else `#4 \fi * "100 + + \ifx \@empty #5 32 \else `#5 \fi } } -\cs_set:Npn \fontspec_v_str_to_num:n #1 { +\cs_generate_variant:Nn \fontspec_iv_str_to_num:Nn {No} +\cs_set:Npn \fontspec_v_str_to_num:Nn #1#2 { \bool_if:nTF { - \tl_if_head_eq_charcode_p:nN {#1} {+} || - \tl_if_head_eq_charcode_p:nN {#1} {-} - } - { - \exp_after:wN \fontspec_iv_str_to_num:n - \exp_after:wN { \use_none:n #1 } + \tl_if_head_eq_charcode_p:nN {#2} {+} || + \tl_if_head_eq_charcode_p:nN {#2} {-} } - { \fontspec_iv_str_to_num:n {#1} } + { \fontspec_iv_str_to_num:No #1 { \use_none:n #2 } } + { \fontspec_iv_str_to_num:Nn #1 {#2} } } \xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_script:n {TF}} { - \fontspec_iv_str_to_num:n{#1} - \@tempcntb\XeTeXOTcountscripts\zf@basefont - \c@zf@index\z@ \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTscripttag\zf@basefont\c@zf@index=\l_fontspec_strnum_int + \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \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 } + { + \ifnum \XeTeXOTscripttag\zf@basefont \l_tmpa_int = \l_fontspec_strnum_int \@tempswatrue - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -1093,18 +1131,21 @@ } \xetex_or_luatex:nnn {\prg_new_conditional:Nnn \fontspec_check_lang:n {TF}} { - \fontspec_iv_str_to_num:n{#1} - \@tempcntb\XeTeXOTcountlanguages\zf@basefont\c@zf@script - \c@zf@index\z@ + \fontspec_iv_str_to_num:Nn \l_fontspec_strnum_int {#1} + \int_set:Nn \l_tmpb_int { + \XeTeXOTcountlanguages \zf@basefont \l_fontspec_script_int + } + \int_zero:N \l_tmpa_int \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTlanguagetag\zf@basefont\c@zf@script\c@zf@index=\l_fontspec_strnum_int + \bool_until_do:nn { \intexpr_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 - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -1116,19 +1157,24 @@ \xetex_or_luatex:nnn { \prg_new_conditional:Nnn \fontspec_check_ot_feat:n {TF,T} } { - \@tempcntb\XeTeXOTcountfeatures\zf@basefont\c@zf@script\c@zf@language - \fontspec_v_str_to_num:n {#1} - \c@zf@index\z@ + \int_set:Nn \l_tmpb_int { + \XeTeXOTcountfeatures \zf@basefont + \l_fontspec_script_int + \l_fontspec_language_int + } + \fontspec_v_str_to_num:Nn \l_fontspec_strnum_int {#1} + \int_zero:N \l_tmpa_int \@tempswafalse - \loop\ifnum\c@zf@index<\@tempcntb - \ifnum\XeTeXOTfeaturetag\zf@basefont\c@zf@script\c@zf@language - \c@zf@index=\l_fontspec_strnum_int + \bool_until_do:nn { \intexpr_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 \@tempswatrue - \c@zf@index\@tempcntb + \int_set:Nn \l_tmpa_int {\l_tmpb_int} \else - \advance\c@zf@index\@ne + \int_incr:N \l_tmpa_int \fi - \repeat + } \if@tempswa \prg_return_true: \else: \prg_return_false: \fi: } { @@ -1160,7 +1206,7 @@ \tl_clear:N \l_fontspec_extension_tl \define@choicekey[zf]{preparse}{Renderer}[\l_tmpa_tl\l_tmpa_num] {AAT,ICU,Graphite,Full,Basic}{ - \zf@update@family{+rend:#1} + \fontspec_update_fontid:n {+rend:#1} \intexpr_compare:nTF {\l_tmpa_num < 3} { \xetex_or_luatex:nn { @@ -1183,98 +1229,102 @@ \define@key[zf]{preparse}{Script}{ \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} } \tl_set:Nn \l_fontspec_script_name_tl {#1} - \zf@update@family{+script:#1} + \fontspec_update_fontid:n {+script:#1} } \define@key[zf]{preparse}{Language}{ \xetex_if_engine:T { \setkeys[zf]{preparse}{Renderer=ICU} } \tl_set:Nn \l_fontspec_lang_name_tl {#1} - \zf@update@family{+language:#1} + \fontspec_update_fontid:n {+language:#1} } \define@key[zf]{preparse-external}{UprightFont}{ - \fontspec_complete_fontname:Nn \zf@up {#1} - \zf@update@family{up:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_up_tl {#1} + \fontspec_update_fontid:n {up:#1} } \define@key[zf]{preparse-external}{BoldFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@nobftrue - \zf@update@family{nobf} - \else + \fontspec_update_fontid:n {nobf} + } + { \zf@nobffalse - \fontspec_complete_fontname:Nn \zf@bf {#1} - \zf@update@family{bf:#1} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bf_tl {#1} + \fontspec_update_fontid:n {bf:#1} + } } \define@key[zf]{preparse-external}{ItalicFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@noittrue - \zf@update@family{noit} - \else + \fontspec_update_fontid:n {noit} + }{ \zf@noitfalse - \fontspec_complete_fontname:Nn \zf@it {#1} - \zf@update@family{it:#1} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_it_tl {#1} + \fontspec_update_fontid:n {it:#1} + } } \define@key[zf]{preparse-external}{BoldItalicFont}{ - \fontspec_complete_fontname:Nn \zf@bfit {#1} - \zf@update@family{bfit:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfit_tl {#1} + \fontspec_update_fontid:n {bfit:#1} } \define@key[zf]{preparse-external}{SlantedFont}{ - \fontspec_complete_fontname:Nn \zf@sl {#1} - \zf@update@family{sl:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_sl_tl {#1} + \fontspec_update_fontid:n {sl:#1} } \define@key[zf]{preparse-external}{BoldSlantedFont}{ - \fontspec_complete_fontname:Nn \zf@bfsl {#1} - \zf@update@family{bfsl:#1} + \fontspec_complete_fontname:Nn \l_fontspec_fontname_bfsl_tl {#1} + \fontspec_update_fontid:n {bfsl:#1} } \define@key[zf]{options}{SmallCapsFont}{ - \edef\@tempa{#1} - \ifx\@tempa\@empty + \tl_if_empty:nTF {#1} + { \zf@nosctrue - \zf@update@family{nosc} - \else + \fontspec_update_fontid:n {nosc} + }{ \zf@noscfalse - \fontspec_complete_fontname:Nn \zf@sc {#1} - \zf@update@family{sc:\zap@space #1~\@empty} - \fi + \fontspec_complete_fontname:Nn \l_fontspec_fontname_sc_tl {#1} + \fontspec_update_fontid:n {sc:\zap@space #1~\@empty} + } } \cs_set:Npn \fontspec_complete_fontname:Nn #1#2 { \tl_set:Nn #1 {#2} - \tl_replace_all_in:Nnx #1 {*} {\zf@fontname} + \tl_replace_all_in:Nnx #1 {*} {\l_fontspec_fontname_tl} + \luatex_if_engine:T { + \tl_replace_all_in:Nnn #1 {~} {} + } } \cs_generate_variant:Nn \tl_replace_all_in:Nnn {Nnx} \define@key[zf]{preparse}{UprightFeatures}{ - \def\zf@up@feat{, #1} - \zf@update@family{rmfeat:#1} + \def\l_fontspec_fontfeat_up_clist{, #1} + \fontspec_update_fontid:n {rmfeat:#1} } \define@key[zf]{preparse}{BoldFeatures}{ - \def\zf@bf@feat{, #1} - \zf@update@family{bffeat:#1} + \def\l_fontspec_fontfeat_bf_clist{, #1} + \fontspec_update_fontid:n {bffeat:#1} } \define@key[zf]{preparse}{ItalicFeatures}{ - \def\zf@it@feat{, #1} - \zf@update@family{itfeat:#1} + \def\l_fontspec_fontfeat_it_clist{, #1} + \fontspec_update_fontid:n {itfeat:#1} } \define@key[zf]{preparse}{BoldItalicFeatures}{ - \def\zf@bfit@feat{, #1} - \zf@update@family{bfitfeat:#1} + \def\l_fontspec_fontfeat_bfit_clist{, #1} + \fontspec_update_fontid:n {bfitfeat:#1} } \define@key[zf]{preparse}{SlantedFeatures}{ - \def\zf@sl@feat{, #1} - \zf@update@family{slfeat:#1} + \def\l_fontspec_fontfeat_sl_clist{, #1} + \fontspec_update_fontid:n {slfeat:#1} } \define@key[zf]{preparse}{BoldSlantedFeatures}{ - \def\zf@bfsl@feat{, #1} - \zf@update@family{bfslfeat:#1} + \def\l_fontspec_fontfeat_bfsl_clist{, #1} + \fontspec_update_fontid:n {bfslfeat:#1} } \define@key[zf]{options}{SmallCapsFeatures}{ - \unless\ifzf@firsttime\def\zf@sc@feat{, #1}\fi - \zf@update@family{scfeat:\zap@space #1~\@empty} + \unless\ifzf@firsttime\def\l_fontspec_fontfeat_sc_clist{, #1}\fi + \fontspec_update_fontid:n {scfeat:\zap@space #1~\@empty} } \define@key[zf]{preparse}{SizeFeatures}{ \tl_set:Nn \l_fontspec_sizefeat_clist {#1} - \zf@update@family{sizefeat:\zap@space #1~\@empty} + \fontspec_update_fontid:n {sizefeat:\zap@space #1~\@empty} } \define@key[zf]{sizing}{Size}{ \tl_set:Nn \l_fontspec_size_tl {#1} } \define@key[zf]{sizing}{Font}{ @@ -1287,7 +1337,7 @@ {MatchUppercase} { \fontspec_calc_scale:n {8} } } { \tl_set:Nx \l_fontspec_scale_tl {#1} } - \zf@update@family{+scale:\l_fontspec_scale_tl} + \fontspec_update_fontid:n {+scale:\l_fontspec_scale_tl} \tl_set:Nx \l_fontspec_scale_tl { s*[\l_fontspec_scale_tl] } } \cs_new:Npn \fontspec_calc_scale:n #1 { @@ -1305,7 +1355,7 @@ \dim_set:Nn #1 { \fontdimen #2 #3 } \dim_compare:nNnT #1 = {0pt} { \settoheight #1 { - \tl_if_eq:nnTF {#3} {\font} \rmfamily #3 + \str_if_eq:nnTF {#3} {\font} \rmfamily #3 \prg_case_int:nnn #2 { {5} {x} % x-height {8} {X} % cap-height @@ -1314,51 +1364,51 @@ } } \define@key[zf]{options}{WordSpace}{ - \zf@update@family{+wordspace:#1} + \fontspec_update_fontid:n {+wordspace:#1} \unless\ifzf@firsttime - \zf@wordspace@parse#1,\zf@@ii,\zf@@iii,\zf@@ + \_fontspec_parse_wordspace:w #1,,,\q_stop \fi } -\def\zf@wordspace@parse#1,#2,#3,#4\zf@@{ - \def\@tempa{#4} - \ifx\@tempa\@empty - \setlength\@tempdima{#1\fontdimen2\zf@basefont} - \@tempdimb\@tempdima - \@tempdimc\@tempdima - \else - \setlength\@tempdima{#1\fontdimen2\zf@basefont} - \setlength\@tempdimb{#2\fontdimen3\zf@basefont} - \setlength\@tempdimc{#3\fontdimen4\zf@basefont} - \fi - \edef\zf@adjust{ - \zf@adjust +\cs_set:Npn \_fontspec_parse_wordspace:w #1,#2,#3,#4 \q_stop { + \tl_if_empty:nTF {#4} + { + \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont} + \dim_set:Nn \@tempdimb {\@tempdima} + \dim_set:Nn \@tempdimc {\@tempdima} + }{ + \dim_set:Nn \@tempdima {#1\fontdimen2\zf@basefont} + \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 \fontdimen2\font\the\@tempdima \fontdimen3\font\the\@tempdimb \fontdimen4\font\the\@tempdimc } } \define@key[zf]{options}{PunctuationSpace}{ - \zf@update@family{+punctspace:#1} + \fontspec_update_fontid:n {+punctspace:#1} \setlength\@tempdima{#1\fontdimen7\zf@basefont} - \edef\zf@adjust{\zf@adjust\fontdimen7\font\the\@tempdima} + \tl_set:Nx \l_fontspec_postadjust_tl {\l_fontspec_postadjust_tl\fontdimen7\font\the\@tempdima} } \define@key[zf]{options}{LetterSpace}{ - \zf@update@family{+tracking:#1} - \zf@update@ff{letterspace=#1} + \fontspec_update_fontid:n {+tracking:#1} + \fontspec_update_featstr:n{letterspace=#1} } \define@key[zf]{options}{HyphenChar}{ - \zf@update@family{+hyphenchar:#1} - \tl_if_eq:nnTF {#1} {None} + \fontspec_update_fontid:n {+hyphenchar:#1} + \str_if_eq:nnTF {#1} {None} { - \tl_put_right:Nn \zf@adjust { \hyphenchar \font = \c_minus_one } + \tl_put_right:Nn \l_fontspec_postadjust_tl { \hyphenchar \font = \c_minus_one } } { \tl_if_single:nTF {#1} { \tl_set:Nn \l_fontspec_hyphenchar_tl {`#1} } { \tl_set:Nn \l_fontspec_hyphenchar_tl { #1} } - \fontspec_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl} + \font_glyph_if_exist:NnTF \zf@basefont {\l_fontspec_hyphenchar_tl} { - \xetex_or_luatex:nnn { \tl_put_right:Nn \zf@adjust } + \xetex_or_luatex:nnn { \tl_put_right:Nn \l_fontspec_postadjust_tl } { \hyphenchar \font = \l_fontspec_hyphenchar_tl \scan_stop: } { \hyphenchar \font = \c_zero @@ -1369,7 +1419,7 @@ } } \define@key[zf]{options}{Color}{ - \zf@update@family{+col:#1} + \fontspec_update_fontid:n {+col:#1} \cs_if_exist:cTF {\token_to_str:N\color@#1} { \convertcolorspec{named}{#1}{HTML}\l_fontspec_hexcol_tl @@ -1401,7 +1451,7 @@ \keyval@alias@key[zf]{options}{Color}{Colour} \newcounter{fontspec_tmp_int} \define@key[zf]{options}{Opacity}{ - \zf@update@family{+opac:#1} + \fontspec_update_fontid:n {+opac:#1} \setcounter {fontspec_tmp_int} { 255*\real{#1} } \tl_if_eq:NNF \l_fontspec_opacity_tl \g_fontspec_opacity_tl { @@ -1415,10 +1465,10 @@ \xetex_or_luatex:nnn { \define@key[zf]{options}{Mapping} }{ - \zf@update@family{+map:#1} - \zf@update@ff{mapping=#1} + \fontspec_update_fontid:n {+map:#1} + \fontspec_update_featstr:n{mapping=#1} }{ - \tl_if_eq:nnTF {#1} {tex-text} { + \str_if_eq:nnTF {#1} {tex-text} { \fontspec_warning:n {no-mapping-ligtex} \msg_redirect_name:nnn {fontspec} {no-mapping-ligtex} {none} \setkeys[zf]{options}{ Ligatures=TeX } @@ -1427,26 +1477,26 @@ } } \define@key[zf]{options}{FeatureFile}{ - \zf@update@family{+fea:#1} - \zf@update@ff{featurefile=#1} + \fontspec_update_fontid:n {+fea:#1} + \fontspec_update_featstr:n{featurefile=#1} } \define@key[zf]{options}{Weight}{ - \zf@update@family{+weight:#1} - \zf@update@ff{weight=#1} + \fontspec_update_fontid:n {+weight:#1} + \fontspec_update_featstr:n{weight=#1} } \define@key[zf]{options}{Width}{ - \zf@update@family{+width:#1} - \zf@update@ff{width=#1} + \fontspec_update_fontid:n {+width:#1} + \fontspec_update_featstr:n{width=#1} } \define@key[zf]{options}{OpticalSize}{ \xetex_or_luatex:nn { \ifzf@icu \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \zf@update@family{+size:#1} + \fontspec_update_fontid:n {+size:#1} \fi \ifzf@mm - \zf@update@family{+size:#1} - \zf@update@ff{optical size=#1} + \fontspec_update_fontid:n {+size:#1} + \fontspec_update_featstr:n{optical size=#1} \fi \ifzf@icu\else \ifzf@mm\else @@ -1457,154 +1507,154 @@ \fi }{ \tl_set:Nn \l_fontspec_optical_size_tl {/ S = #1} - \zf@update@family{+size:#1} + \fontspec_update_fontid:n {+size:#1} } } \define@key[zf]{options}{FakeSlant}[0.2]{ - \zf@update@family{+slant:#1} - \zf@update@ff{slant=#1} + \fontspec_update_fontid:n {+slant:#1} + \fontspec_update_featstr:n{slant=#1} } \define@key[zf]{options}{FakeStretch}[1.2]{ - \zf@update@family{+extend:#1} - \zf@update@ff{extend=#1} + \fontspec_update_fontid:n {+extend:#1} + \fontspec_update_featstr:n{extend=#1} } \define@key[zf]{options}{FakeBold}[1.5]{ - \zf@update@family{+embolden:#1} - \zf@update@ff{embolden=#1} + \fontspec_update_fontid:n {+embolden:#1} + \fontspec_update_featstr:n{embolden=#1} } \define@key[zf]{options}{AutoFakeSlant}[0.2]{ \ifzf@firsttime - \tl_set:Nn \zf@fake@slant {#1} - \tl_put_right:Nn \zf@it@feat {,FakeSlant=#1} - \tl_set_eq:NN \zf@it \zf@fontname - \zf@update@family{fakeit:#1} - \tl_if_empty:NF \zf@fake@embolden { - \tl_put_right:Nx \zf@bfit@feat - {,FakeBold=\zf@fake@embolden,FakeSlant=#1} - \tl_set_eq:NN \zf@bfit \zf@fontname + \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 + \fontspec_update_fontid:n {fakeit:#1} + \tl_if_empty:NF \l_fontspec_fake_embolden_tl { + \tl_put_right:Nx \l_fontspec_fontfeat_bfit_clist + {,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 - \tl_set:Nn \zf@fake@embolden {#1} - \tl_put_right:Nn \zf@bf@feat {,FakeBold=#1} - \tl_set_eq:NN \zf@bf \zf@fontname - \zf@update@family{fakebf:#1} - \tl_if_empty:NF \zf@fake@slant { - \tl_put_right:Nx \zf@bfit@feat - {,FakeSlant=\zf@fake@slant,FakeBold=#1} - \tl_set_eq:NN \zf@bfit \zf@fontname + \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 + \fontspec_update_fontid:n {fakebf:#1} + \tl_if_empty:NF \l_fontspec_fake_slant_tl { + \tl_put_right:Nx \l_fontspec_fontfeat_bfit_clist + {,FakeSlant=\l_fontspec_fake_slant_tl,FakeBold=#1} + \tl_set_eq:NN \l_fontspec_fontname_bfit_tl \l_fontspec_fontname_tl } \fi } -\zf@define@font@feature{Ligatures} -\zf@define@feature@option{Ligatures}{Required} {1}{0}{+rlig} -\zf@define@feature@option{Ligatures}{NoRequired} {1}{1}{-rlig} -\zf@define@feature@option{Ligatures}{Common} {1}{2}{+liga} -\zf@define@feature@option{Ligatures}{NoCommon} {1}{3}{-liga} -\zf@define@feature@option{Ligatures}{Rare} {1}{4}{+dlig} -\zf@define@feature@option{Ligatures}{NoRare} {1}{5}{-dlig} -\zf@define@feature@option{Ligatures}{Discretionary} {1}{4}{+dlig} -\zf@define@feature@option{Ligatures}{NoDiscretionary}{1}{5}{-dlig} -\zf@define@feature@option{Ligatures}{Contextual} {}{} {+clig} -\zf@define@feature@option{Ligatures}{NoContextual} {}{} {-clig} -\zf@define@feature@option{Ligatures}{Historic} {}{} {+hlig} -\zf@define@feature@option{Ligatures}{NoHistoric} {}{} {-hlig} -\zf@define@feature@option{Ligatures}{Logos} {1}{6} {} -\zf@define@feature@option{Ligatures}{NoLogos} {1}{7} {} -\zf@define@feature@option{Ligatures}{Rebus} {1}{8} {} -\zf@define@feature@option{Ligatures}{NoRebus} {1}{9} {} -\zf@define@feature@option{Ligatures}{Diphthong} {1}{10}{} -\zf@define@feature@option{Ligatures}{NoDiphthong} {1}{11}{} -\zf@define@feature@option{Ligatures}{Squared} {1}{12}{} -\zf@define@feature@option{Ligatures}{NoSquared} {1}{13}{} -\zf@define@feature@option{Ligatures}{AbbrevSquared} {1}{14}{} -\zf@define@feature@option{Ligatures}{NoAbbrevSquared}{1}{15}{} -\zf@define@feature@option{Ligatures}{Icelandic} {1}{32}{} -\zf@define@feature@option{Ligatures}{NoIcelandic} {1}{33}{} +\fontspec_define_font_feature:n{Ligatures} +\fontspec_define_feature_option:nnnnn{Ligatures}{Required} {1}{0}{+rlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRequired} {1}{1}{-rlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Common} {1}{2}{+liga} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoCommon} {1}{3}{-liga} +\fontspec_define_feature_option:nnnnn{Ligatures}{Rare} {1}{4}{+dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRare} {1}{5}{-dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Discretionary} {1}{4}{+dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiscretionary}{1}{5}{-dlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Contextual} {}{} {+clig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoContextual} {}{} {-clig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Historic} {}{} {+hlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoHistoric} {}{} {-hlig} +\fontspec_define_feature_option:nnnnn{Ligatures}{Logos} {1}{6} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoLogos} {1}{7} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{Rebus} {1}{8} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoRebus} {1}{9} {} +\fontspec_define_feature_option:nnnnn{Ligatures}{Diphthong} {1}{10}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoDiphthong} {1}{11}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{Squared} {1}{12}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoSquared} {1}{13}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{AbbrevSquared} {1}{14}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoAbbrevSquared}{1}{15}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{Icelandic} {1}{32}{} +\fontspec_define_feature_option:nnnnn{Ligatures}{NoIcelandic} {1}{33}{} \define@key[zf@feat]{Ligatures}{TeX}[]{ \xetex_or_luatex:nn { - \zf@update@family{+map:tex-text} - \zf@update@ff{mapping=tex-text} + \fontspec_update_fontid:n {+map:tex-text} + \fontspec_update_featstr:n{mapping=tex-text} }{ - \zf@update@family{+tlig+trep} - \zf@update@ff{+tlig;+trep} - } -} -\zf@define@font@feature{Letters} -\zf@define@feature@option{Letters}{Normal} {3}{0}{} -\zf@define@feature@option{Letters}{Uppercase} {3}{1}{+case} -\zf@define@feature@option{Letters}{Lowercase} {3}{2}{} -\zf@define@feature@option{Letters}{SmallCaps} {3}{3}{+smcp} -\zf@define@feature@option{Letters}{PetiteCaps} {} {} {+pcap} -\zf@define@feature@option{Letters}{UppercaseSmallCaps} {} {} {+c2sc} -\zf@define@feature@option{Letters}{UppercasePetiteCaps}{} {} {+c2pc} -\zf@define@feature@option{Letters}{InitialCaps} {3}{4}{} -\zf@define@feature@option{Letters}{Unicase} {} {} {+unic} -\zf@define@font@feature{Numbers} -\zf@define@feature@option{Numbers}{Monospaced} {6} {0}{+tnum} -\zf@define@feature@option{Numbers}{Proportional} {6} {1}{+pnum} -\zf@define@feature@option{Numbers}{Lowercase} {21}{0}{+onum} -\zf@define@feature@option{Numbers}{OldStyle} {21}{0}{+onum} -\zf@define@feature@option{Numbers}{Uppercase} {21}{1}{+lnum} -\zf@define@feature@option{Numbers}{Lining} {21}{1}{+lnum} -\zf@define@feature@option{Numbers}{SlashedZero} {14}{5}{+zero} -\zf@define@feature@option{Numbers}{NoSlashedZero}{14}{4}{-zero} + \fontspec_update_fontid:n {+tlig+trep} + \fontspec_update_featstr:n{+tlig;+trep} + } +} +\fontspec_define_font_feature:n{Letters} +\fontspec_define_feature_option:nnnnn{Letters}{Normal} {3}{0}{} +\fontspec_define_feature_option:nnnnn{Letters}{Uppercase} {3}{1}{+case} +\fontspec_define_feature_option:nnnnn{Letters}{Lowercase} {3}{2}{} +\fontspec_define_feature_option:nnnnn{Letters}{SmallCaps} {3}{3}{+smcp} +\fontspec_define_feature_option:nnnnn{Letters}{PetiteCaps} {} {} {+pcap} +\fontspec_define_feature_option:nnnnn{Letters}{UppercaseSmallCaps} {} {} {+c2sc} +\fontspec_define_feature_option:nnnnn{Letters}{UppercasePetiteCaps}{} {} {+c2pc} +\fontspec_define_feature_option:nnnnn{Letters}{InitialCaps} {3}{4}{} +\fontspec_define_feature_option:nnnnn{Letters}{Unicase} {} {} {+unic} +\fontspec_define_font_feature:n{Numbers} +\fontspec_define_feature_option:nnnnn{Numbers}{Monospaced} {6} {0}{+tnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Proportional} {6} {1}{+pnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Lowercase} {21}{0}{+onum} +\fontspec_define_feature_option:nnnnn{Numbers}{OldStyle} {21}{0}{+onum} +\fontspec_define_feature_option:nnnnn{Numbers}{Uppercase} {21}{1}{+lnum} +\fontspec_define_feature_option:nnnnn{Numbers}{Lining} {21}{1}{+lnum} +\fontspec_define_feature_option:nnnnn{Numbers}{SlashedZero} {14}{5}{+zero} +\fontspec_define_feature_option:nnnnn{Numbers}{NoSlashedZero}{14}{4}{-zero} \luatex_if_engine:T { - \zf@define@feature@option{Numbers}{Arabic}{}{}{+anum} -} -\zf@define@font@feature {Contextuals} -\zf@define@feature@option{Contextuals}{Swash} {} {} {+cswh} -\zf@define@feature@option{Contextuals}{NoSwash} {} {} {-cswh} -\zf@define@feature@option{Contextuals}{Alternate} {} {} {+calt} -\zf@define@feature@option{Contextuals}{NoAlternate} {} {} {-calt} -\zf@define@feature@option{Contextuals}{WordInitial} {8}{0}{+init} -\zf@define@feature@option{Contextuals}{NoWordInitial}{8}{1}{-init} -\zf@define@feature@option{Contextuals}{WordFinal} {8}{2}{+fina} -\zf@define@feature@option{Contextuals}{NoWordFinal} {8}{3}{-fina} -\zf@define@feature@option{Contextuals}{LineInitial} {8}{4}{} -\zf@define@feature@option{Contextuals}{NoLineInitial}{8}{5}{} -\zf@define@feature@option{Contextuals}{LineFinal} {8}{6}{+falt} -\zf@define@feature@option{Contextuals}{NoLineFinal} {8}{7}{-falt} -\zf@define@feature@option{Contextuals}{Inner} {8}{8}{+medi} -\zf@define@feature@option{Contextuals}{NoInner} {8}{9}{-medi} -\zf@define@font@feature{Diacritics} -\zf@define@feature@option{Diacritics}{Show} {9}{0}{} -\zf@define@feature@option{Diacritics}{Hide} {9}{1}{} -\zf@define@feature@option{Diacritics}{Decompose} {9}{2}{} -\zf@define@feature@option{Diacritics}{MarkToBase} {}{}{+mark} -\zf@define@feature@option{Diacritics}{NoMarkToBase}{}{}{-mark} -\zf@define@feature@option{Diacritics}{MarkToMark} {}{}{+mkmk} -\zf@define@feature@option{Diacritics}{NoMarkToMark}{}{}{-mkmk} -\zf@define@feature@option{Diacritics}{AboveBase} {}{}{+abvm} -\zf@define@feature@option{Diacritics}{NoAboveBase} {}{}{-abvm} -\zf@define@feature@option{Diacritics}{BelowBase} {}{}{+blwm} -\zf@define@feature@option{Diacritics}{NoBelowBase} {}{}{-blwm} -\zf@define@font@feature{Kerning} -\zf@define@feature@option{Kerning}{Uppercase}{}{}{+cpsp} -\zf@define@feature@option{Kerning}{On} {}{}{+kern} -\zf@define@feature@option{Kerning}{Off} {}{}{-kern} -\zf@define@font@feature{VerticalPosition} -\zf@define@feature@option{VerticalPosition}{Normal} {10}{0}{} -\zf@define@feature@option{VerticalPosition}{Superior} {10}{1}{+sups} -\zf@define@feature@option{VerticalPosition}{Inferior} {10}{2}{+subs} -\zf@define@feature@option{VerticalPosition}{Ordinal} {10}{3}{+ordn} -\zf@define@feature@option{VerticalPosition}{Numerator} {} {} {+numr} -\zf@define@feature@option{VerticalPosition}{Denominator}{} {} {+dnom} -\zf@define@feature@option{VerticalPosition}{ScientificInferior}{}{}{+sinf} -\zf@define@font@feature{Fractions} -\zf@define@feature@option{Fractions}{On} {11}{1}{+frac} -\zf@define@feature@option{Fractions}{Off} {11}{0}{-frac} -\zf@define@feature@option{Fractions}{Diagonal} {11}{2}{} -\zf@define@feature@option{Fractions}{Alternate}{} {} {+afrc} + \fontspec_define_feature_option:nnnnn{Numbers}{Arabic}{}{}{+anum} +} +\fontspec_define_font_feature:n {Contextuals} +\fontspec_define_feature_option:nnnnn{Contextuals}{Swash} {} {} {+cswh} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoSwash} {} {} {-cswh} +\fontspec_define_feature_option:nnnnn{Contextuals}{Alternate} {} {} {+calt} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoAlternate} {} {} {-calt} +\fontspec_define_feature_option:nnnnn{Contextuals}{WordInitial} {8}{0}{+init} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordInitial}{8}{1}{-init} +\fontspec_define_feature_option:nnnnn{Contextuals}{WordFinal} {8}{2}{+fina} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoWordFinal} {8}{3}{-fina} +\fontspec_define_feature_option:nnnnn{Contextuals}{LineInitial} {8}{4}{} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineInitial}{8}{5}{} +\fontspec_define_feature_option:nnnnn{Contextuals}{LineFinal} {8}{6}{+falt} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoLineFinal} {8}{7}{-falt} +\fontspec_define_feature_option:nnnnn{Contextuals}{Inner} {8}{8}{+medi} +\fontspec_define_feature_option:nnnnn{Contextuals}{NoInner} {8}{9}{-medi} +\fontspec_define_font_feature:n{Diacritics} +\fontspec_define_feature_option:nnnnn{Diacritics}{Show} {9}{0}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{Hide} {9}{1}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{Decompose} {9}{2}{} +\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToBase} {}{}{+mark} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToBase}{}{}{-mark} +\fontspec_define_feature_option:nnnnn{Diacritics}{MarkToMark} {}{}{+mkmk} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoMarkToMark}{}{}{-mkmk} +\fontspec_define_feature_option:nnnnn{Diacritics}{AboveBase} {}{}{+abvm} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoAboveBase} {}{}{-abvm} +\fontspec_define_feature_option:nnnnn{Diacritics}{BelowBase} {}{}{+blwm} +\fontspec_define_feature_option:nnnnn{Diacritics}{NoBelowBase} {}{}{-blwm} +\fontspec_define_font_feature:n{Kerning} +\fontspec_define_feature_option:nnnnn{Kerning}{Uppercase}{}{}{+cpsp} +\fontspec_define_feature_option:nnnnn{Kerning}{On} {}{}{+kern} +\fontspec_define_feature_option:nnnnn{Kerning}{Off} {}{}{-kern} +\fontspec_define_font_feature:n{VerticalPosition} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Normal} {10}{0}{} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Superior} {10}{1}{+sups} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Inferior} {10}{2}{+subs} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Ordinal} {10}{3}{+ordn} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Numerator} {} {} {+numr} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{Denominator}{} {} {+dnom} +\fontspec_define_feature_option:nnnnn{VerticalPosition}{ScientificInferior}{}{}{+sinf} +\fontspec_define_font_feature:n{Fractions} +\fontspec_define_feature_option:nnnnn{Fractions}{On} {11}{1}{+frac} +\fontspec_define_feature_option:nnnnn{Fractions}{Off} {11}{0}{-frac} +\fontspec_define_feature_option:nnnnn{Fractions}{Diagonal} {11}{2}{} +\fontspec_define_feature_option:nnnnn{Fractions}{Alternate}{} {} {+afrc} \define@key[zf]{options}{Alternate}[0]{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Alternate}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Alternate} \fontspec_make_feature:nnx {17}{#1} { \fontspec_salt:n {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } \xetex_or_luatex:nnn { \cs_set:Npn \fontspec_salt:n #1 } @@ -1612,83 +1662,83 @@ \define@key[zf]{options}{Variant}{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Variant}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Variant} \fontspec_make_feature:nnx {18}{#1} { +ss \two@digits {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } \aliasfontfeature{Variant}{StylisticSet} \define@key[zf]{options}{CharacterVariant}{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{CharacterVariant}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{CharacterVariant} \fontspec_make_feature:nnx {}{} { +cv \two@digits {#1} } - \fi + } \clist_set_eq:NN \XKV@rm \l_fontspec_tmpa_clist } -\zf@define@font@feature{Style} -\zf@define@feature@option{Style}{Alternate} {} {} {+salt} -\zf@define@feature@option{Style}{Italic} {32}{2}{+ital} -\zf@define@feature@option{Style}{Ruby} {28}{2}{+ruby} -\zf@define@feature@option{Style}{Swash} {} {} {+swsh} -\zf@define@feature@option{Style}{Historic} {} {} {+hist} -\zf@define@feature@option{Style}{Display} {19}{1}{} -\zf@define@feature@option{Style}{Engraved} {19}{2}{} -\zf@define@feature@option{Style}{TitlingCaps} {19}{4}{+titl} -\zf@define@feature@option{Style}{TallCaps} {19}{5}{} -\zf@define@feature@option{Style}{HorizontalKana}{} {} {+hkna} -\zf@define@feature@option{Style}{VerticalKana} {} {} {+vkna} -\zf@define@font@feature{CJKShape} -\zf@define@feature@option{CJKShape}{Traditional}{20}{0} {+trad} -\zf@define@feature@option{CJKShape}{Simplified} {20}{1} {+smpl} -\zf@define@feature@option{CJKShape}{JIS1978} {20}{2} {+jp78} -\zf@define@feature@option{CJKShape}{JIS1983} {20}{3} {+jp83} -\zf@define@feature@option{CJKShape}{JIS1990} {20}{4} {+jp90} -\zf@define@feature@option{CJKShape}{Expert} {20}{10}{+expt} -\zf@define@feature@option{CJKShape}{NLC} {20}{13}{+nlck} -\zf@define@font@feature{CharacterWidth} -\zf@define@feature@option{CharacterWidth}{Proportional}{22}{0}{+pwid} -\zf@define@feature@option{CharacterWidth}{Full}{22}{1}{+fwid} -\zf@define@feature@option{CharacterWidth}{Half}{22}{2}{+hwid} -\zf@define@feature@option{CharacterWidth}{Third}{22}{3}{+twid} -\zf@define@feature@option{CharacterWidth}{Quarter}{22}{4}{+qwid} -\zf@define@feature@option{CharacterWidth}{AlternateProportional}{22}{5}{+palt} -\zf@define@feature@option{CharacterWidth}{AlternateHalf}{22}{6}{+halt} -\zf@define@feature@option{CharacterWidth}{Default}{22}{7}{} -\zf@define@feature@option{Annotation}{Off}{24}{0}{} -\zf@define@feature@option{Annotation}{Box}{24}{1}{} -\zf@define@feature@option{Annotation}{RoundedBox}{24}{2}{} -\zf@define@feature@option{Annotation}{Circle}{24}{3}{} -\zf@define@feature@option{Annotation}{BlackCircle}{24}{4}{} -\zf@define@feature@option{Annotation}{Parenthesis}{24}{5}{} -\zf@define@feature@option{Annotation}{Period}{24}{6}{} -\zf@define@feature@option{Annotation}{RomanNumerals}{24}{7}{} -\zf@define@feature@option{Annotation}{Diamond}{24}{8}{} -\zf@define@feature@option{Annotation}{BlackSquare}{24}{9}{} -\zf@define@feature@option{Annotation}{BlackRoundSquare}{24}{10}{} -\zf@define@feature@option{Annotation}{DoubleCircle}{24}{11}{} +\fontspec_define_font_feature:n{Style} +\fontspec_define_feature_option:nnnnn{Style}{Alternate} {} {} {+salt} +\fontspec_define_feature_option:nnnnn{Style}{Italic} {32}{2}{+ital} +\fontspec_define_feature_option:nnnnn{Style}{Ruby} {28}{2}{+ruby} +\fontspec_define_feature_option:nnnnn{Style}{Swash} {} {} {+swsh} +\fontspec_define_feature_option:nnnnn{Style}{Historic} {} {} {+hist} +\fontspec_define_feature_option:nnnnn{Style}{Display} {19}{1}{} +\fontspec_define_feature_option:nnnnn{Style}{Engraved} {19}{2}{} +\fontspec_define_feature_option:nnnnn{Style}{TitlingCaps} {19}{4}{+titl} +\fontspec_define_feature_option:nnnnn{Style}{TallCaps} {19}{5}{} +\fontspec_define_feature_option:nnnnn{Style}{HorizontalKana}{} {} {+hkna} +\fontspec_define_feature_option:nnnnn{Style}{VerticalKana} {} {} {+vkna} +\fontspec_define_font_feature:n{CJKShape} +\fontspec_define_feature_option:nnnnn{CJKShape}{Traditional}{20}{0} {+trad} +\fontspec_define_feature_option:nnnnn{CJKShape}{Simplified} {20}{1} {+smpl} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1978} {20}{2} {+jp78} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1983} {20}{3} {+jp83} +\fontspec_define_feature_option:nnnnn{CJKShape}{JIS1990} {20}{4} {+jp90} +\fontspec_define_feature_option:nnnnn{CJKShape}{Expert} {20}{10}{+expt} +\fontspec_define_feature_option:nnnnn{CJKShape}{NLC} {20}{13}{+nlck} +\fontspec_define_font_feature:n{CharacterWidth} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Proportional}{22}{0}{+pwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Full}{22}{1}{+fwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Half}{22}{2}{+hwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Third}{22}{3}{+twid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Quarter}{22}{4}{+qwid} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateProportional}{22}{5}{+palt} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{AlternateHalf}{22}{6}{+halt} +\fontspec_define_feature_option:nnnnn{CharacterWidth}{Default}{22}{7}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Off}{24}{0}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Box}{24}{1}{} +\fontspec_define_feature_option:nnnnn{Annotation}{RoundedBox}{24}{2}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Circle}{24}{3}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackCircle}{24}{4}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Parenthesis}{24}{5}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Period}{24}{6}{} +\fontspec_define_feature_option:nnnnn{Annotation}{RomanNumerals}{24}{7}{} +\fontspec_define_feature_option:nnnnn{Annotation}{Diamond}{24}{8}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackSquare}{24}{9}{} +\fontspec_define_feature_option:nnnnn{Annotation}{BlackRoundSquare}{24}{10}{} +\fontspec_define_feature_option:nnnnn{Annotation}{DoubleCircle}{24}{11}{} \define@key[zf]{options}{Annotation}[0]{ \clist_set_eq:NN \l_fontspec_tmpa_clist \XKV@rm \setkeys*[zf@feat]{Annotation}{#1} - \unless\ifx\XKV@rm\@empty + \tl_if_empty:NF \XKV@rm { \def\XKV@tfam{Alternate} \fontspec_make_feature:nnx {}{} { \fontspec_nalt:n {#1} } - \fi + } \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} } -\zf@define@font@feature{Vertical} +\fontspec_define_font_feature:n{Vertical} \define@key[zf@feat]{Vertical}{RotatedGlyphs}[]{ \ifzf@icu \fontspec_make_feature:nnn{}{}{+vrt2} - \zf@update@family{+vert} - \zf@update@ff{vertical} + \fontspec_update_fontid:n {+vert} + \fontspec_update_featstr:n{vertical} \else - \zf@update@family{+vert} - \zf@update@ff{vertical} + \fontspec_update_fontid:n {+vert} + \fontspec_update_featstr:n{vertical} \fi } \newfontscript{Arabic}{arab} \newfontscript{Armenian}{armn} @@ -1928,27 +1978,28 @@ \newfontlanguage{Zulu}{ZUL} \define@key[zf@feat]{Lang}{Turkish}[]{ \fontspec_check_lang:nTF {TRK} { - \c@zf@language\l_fontspec_strnum_int\relax - \zf@update@family{+lang=Turkish} + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} + \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TRK} }{ \fontspec_check_lang:nTF {TUR} { - \c@zf@language\l_fontspec_strnum_int\relax - \zf@update@family{+lang=Turkish} + \int_set:Nn \l_fontspec_language_int {\l_fontspec_strnum_int} + \fontspec_update_fontid:n {+lang=Turkish} \tl_set:Nn \l_fontspec_lang_tl {TUR} }{ \fontspec_warning:nx {language-not-exist} {#1} + \setkeys[zf@feat]{Lang}{Default} } } } \define@key[zf@feat]{Lang}{Default}[]{ - \zf@update@family{+lang=dflt} + \fontspec_update_fontid:n {+lang=dflt} \tl_set:Nn \l_fontspec_lang_tl {DFLT} - \c@zf@language=0\relax + \int_zero:N \l_fontspec_language_int } \define@key[zf]{options}{RawFeature}{ - \zf@update@family{+Raw:#1} - \zf@update@ff{#1} + \fontspec_update_fontid:n {+Raw:#1} + \fontspec_update_featstr:n{#1} } \providecommand*{\sidefault}{si} \DeclareRobustCommand{\sishape}{ @@ -1956,37 +2007,34 @@ \fontshape\sidefault\selectfont } \DeclareTextFontCommand{\textsi}{\sishape} -\newcommand*{\zf@merge@shape}[3]{ - \edef\@tempa{#1} - \edef\@tempb{#2} - \ifx\f@shape\@tempb - \ifcsname\f@encoding/\f@family/\f@series/#3\endcsname - \edef\@tempa{#3} - \fi - \fi - \fontshape{\@tempa}\selectfont +\cs_new:Nn \fontspec_blend_shape:nnn { + \bool_if:nTF + { + \str_if_eq_p:xx {\f@shape} {#2} && + \cs_if_exist_p:c {\f@encoding/\f@family/\f@series/#3} + } + { \fontshape{#3}\selectfont } + { \fontshape{#1}\selectfont } } \DeclareRobustCommand \itshape { \not@math@alphabet\itshape\mathit - \zf@merge@shape\itdefault\scdefault\sidefault + \fontspec_blend_shape:nnn\itdefault\scdefault\sidefault } \DeclareRobustCommand \slshape { \not@math@alphabet\slshape\relax - \zf@merge@shape\sldefault\scdefault\sidefault + \fontspec_blend_shape:nnn\sldefault\scdefault\sidefault } \DeclareRobustCommand \scshape { \not@math@alphabet\scshape\relax - \zf@merge@shape\scdefault\itdefault\sidefault + \fontspec_blend_shape:nnn\scdefault\itdefault\sidefault } \DeclareRobustCommand \upshape { \not@math@alphabet\upshape\relax - \zf@merge@shape\updefault\sidefault\scdefault + \fontspec_blend_shape:nnn\updefault\sidefault\scdefault } \@ifpackageloaded{euler}{\zf@package@euler@loadedtrue} {\zf@package@euler@loadedfalse} -\def\zf@math{ - \let\zf@font@warning\@font@warning - \let\@font@warning\@font@info +\cs_set:Nn \fontspec_setup_maths: { \@ifpackageloaded{euler}{ \ifzf@package@euler@loaded \zf@math@eulertrue @@ -2009,13 +2057,12 @@ \DeclareMathAccent{\hat} {\mathalpha}{legacymaths}{94} % too bad, euler \DeclareMathAccent{\dot} {\mathalpha}{legacymaths}{95} \DeclareMathAccent{\mathring}{\mathalpha}{legacymaths}{23} - \begingroup + \group_begin: \mathchardef\@tempa="603A \relax - \let\next\egroup \ifx\colon\@tempa \DeclareMathSymbol{\colon}{\mathpunct}{legacymaths}{58} \fi - \endgroup + \group_end: \ifzf@math@euler\else \DeclareMathSymbol{!}{\mathclose}{legacymaths}{33} \DeclareMathSymbol{:}{\mathrel} {legacymaths}{58} @@ -2053,26 +2100,26 @@ \DeclareMathSymbol{\mathdollar}{\mathord}{legacymaths}{36} \fi \fi - \DeclareSymbolFont{operators}\zf@enc\zf@rmmaths\mddefault\updefault - \SetSymbolFont{operators}{normal}\zf@enc\zf@rmmaths\mddefault\updefault - \SetMathAlphabet\mathrm{normal}\zf@enc\zf@rmmaths\mddefault\updefault - \SetMathAlphabet\mathit{normal}\zf@enc\zf@rmmaths\mddefault\itdefault - \SetMathAlphabet\mathbf{normal}\zf@enc\zf@rmmaths\bfdefault\updefault - \SetMathAlphabet\mathsf{normal}\zf@enc\zf@sfmaths\mddefault\updefault - \SetMathAlphabet\mathtt{normal}\zf@enc\zf@ttmaths\mddefault\updefault - \SetSymbolFont{operators}{bold}\zf@enc\zf@rmmaths\bfdefault\updefault - \ifdefined\zf@rmboldmaths - \SetMathAlphabet\mathrm{bold}\zf@enc\zf@rmboldmaths\mddefault\updefault - \SetMathAlphabet\mathbf{bold}\zf@enc\zf@rmboldmaths\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmboldmaths\mddefault\itdefault + \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 + \SetMathAlphabet\mathit{normal}\zf@enc\g_fontspec_mathrm_tl\mddefault\itdefault + \SetMathAlphabet\mathbf{normal}\zf@enc\g_fontspec_mathrm_tl\bfdefault\updefault + \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 + \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\zf@rmmaths\bfdefault\updefault - \SetMathAlphabet\mathit{bold}\zf@enc\zf@rmmaths\bfdefault\itdefault + \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\zf@sfmaths\bfdefault\updefault - \SetMathAlphabet\mathtt{bold}\zf@enc\zf@ttmaths\bfdefault\updefault - \let\font@warning\zf@font@warning} -\def\zf@math@maybe{ + \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}{} @@ -2098,13 +2145,13 @@ \@ifpackageloaded{breqn}{\@zf@mathfalse}{} \if@zf@math \fontspec_info:n {setup-math} - \zf@math + \fontspec_setup_maths: \fi } -\AtBeginDocument{\zf@math@maybe} +\AtBeginDocument{\fontspec_maybe_setup_maths:} \if@zf@configfile \InputIfFileExists{fontspec.cfg} - {\typeout{fontspec.cfg~ loaded.}} + {} {\typeout{No~ fontspec.cfg~ file~ found;~ no~ configuration~ loaded.}} \fi %% |