diff options
Diffstat (limited to 'macros/unicodetex/latex')
42 files changed, 481 insertions, 171 deletions
diff --git a/macros/unicodetex/latex/emotion/doc/emotion-doc.pdf b/macros/unicodetex/latex/emotion/doc/emotion-doc.pdf Binary files differindex ba22192aff..96ffcc5fdd 100644 --- a/macros/unicodetex/latex/emotion/doc/emotion-doc.pdf +++ b/macros/unicodetex/latex/emotion/doc/emotion-doc.pdf diff --git a/macros/unicodetex/latex/emotion/doc/emotion-doc.tex b/macros/unicodetex/latex/emotion/doc/emotion-doc.tex index 6c4fae83c5..97801c76b0 100644 --- a/macros/unicodetex/latex/emotion/doc/emotion-doc.tex +++ b/macros/unicodetex/latex/emotion/doc/emotion-doc.tex @@ -10,7 +10,8 @@ xcolor, listings } -\setmainfont{KpMath Light} + +\setmainfont{KpMath} \geometry{ a4paper, diff --git a/macros/unicodetex/latex/emotion/emotion.def b/macros/unicodetex/latex/emotion/emotion.def index 4e6387e627..715c0ad63c 100644 --- a/macros/unicodetex/latex/emotion/emotion.def +++ b/macros/unicodetex/latex/emotion/emotion.def @@ -1,5 +1,5 @@ \ProvidesExplFile{emotion.def} - {2024/02/06}{0.1}{LaTeX emoji} + {2024/02/13}{0.2}{LaTeX emoji} \tl_const:cn{l__emotion_ 🇦}{^^^^^^01f1e6} \tl_const:cn{l__emotion_ 🇧}{^^^^^^01f1e7} diff --git a/macros/unicodetex/latex/emotion/emotion.lua b/macros/unicodetex/latex/emotion/emotion.lua deleted file mode 100644 index bde272c2b5..0000000000 --- a/macros/unicodetex/latex/emotion/emotion.lua +++ /dev/null @@ -1,21 +0,0 @@ -function unicodes(chs) - local text = "" - for _, c in utf8.codes(chs) do - text = text .. unicode(c) - end - print(text) -end - -function unicode(codepoint) - local value = NULL - if codepoint > 0xFFFF then - value = string.format("^^^^^^%06x", codepoint) - elseif codepoint > 0xFF then - value = string.format("^^^^%04x", codepoint) - else - value = string.format("^^%02x", codepoint) - end - return value -end - -unicodes("🀁♀")
\ No newline at end of file diff --git a/macros/unicodetex/latex/emotion/emotion.sty b/macros/unicodetex/latex/emotion/emotion.sty index 34b02f82ed..7e4070dd39 100644 --- a/macros/unicodetex/latex/emotion/emotion.sty +++ b/macros/unicodetex/latex/emotion/emotion.sty @@ -1,12 +1,12 @@ \RequirePackage{expl3} -\ProvidesExplPackage{emotion}{2024/02/06}{0.1}{LaTeX emoji} +\ProvidesExplPackage{emotion}{2024/02/13}{0.2}{LaTeX emoji} \RequirePackage { fontspec } \ExplSyntaxOn % add emotion command -\newfontface \emotionfont: { Apple~Color~Emoji } [ Renderer = Harfbuzz ] +\newfontface \emotionfont: { Twemoji~Mozilla } [ Renderer = Harfbuzz ] % enable update emoji font \newcommand{\emotionsetup}[1]{ @@ -23,17 +23,14 @@ % import pre-defined emotion \file_input:n { emotion.def } -\tl_set:Nn \l__emotion_tmp_tl {❓} +\tl_set:Nn \l__emotion_nodef_tl {❓} \newcommand{\emotion}[1]{ -\group_begin: -\tl_set:Nn \l__emotion_tmp_tl {#1} \ifcsname l__emotion_#1\endcsname {\emotionfont:{\tl_use:c {l__emotion_ #1}}} \else - {\emotionfont:{\tl_use:N \l__emotion_tmp_tl}} + {\emotionfont:#1} \fi -\group_end: } \ExplSyntaxOff diff --git a/macros/unicodetex/latex/fontspec/CHANGES.md b/macros/unicodetex/latex/fontspec/CHANGES.md index 10841c18c3..dd938d5d51 100644 --- a/macros/unicodetex/latex/fontspec/CHANGES.md +++ b/macros/unicodetex/latex/fontspec/CHANGES.md @@ -1,6 +1,20 @@ Change history ============== + +## v2.9a (2024/02/13) + + * Added a `Scale=MatchAveragecase` paramater which averages `Scale=MatchLowercase` and `Scale=MatchUppercase`. + * Switched options to LaTeX keyval handler. + * Added option `verbose` to undo silent/quiet. + * `euenc`/`tuenc` options are now obsolete (TU is the only encoding). + * Support variable fonts under LuaLaTeX. + * Skip scanning for filenames when loading fonts by name on LuaLaTeX. + * Allow restricting filename lookup to kpathsea lookups using `KpseOnly`. + * Added support for named colors from l3color. + * Support with lualatex spotcolors and cmyk colors in the pdf. + + ## v2.8a (2022/01/15) * Add `SwashFont` and `BoldSwashFont` features to support LaTeX's now-builtin `\textsw` diff --git a/macros/unicodetex/latex/fontspec/README.md b/macros/unicodetex/latex/fontspec/README.md index f5dceebaeb..349b2c39f2 100644 --- a/macros/unicodetex/latex/fontspec/README.md +++ b/macros/unicodetex/latex/fontspec/README.md @@ -54,10 +54,10 @@ Release versions of fontspec are available from CTAN: <http://www.ctan.org/pkg/fontspec> Development and historical versions are available from Github: - <http://github.com/wspr/fontspec> + <http://github.com/latex3/fontspec> Please offer suggestions and file bug reports in the issue tracker: - <http://github.com/wspr/fontspec/issues> + <http://github.com/latex3/fontspec/issues> If you are running TeX Live, you can update to the latest version of this package by running @@ -67,12 +67,11 @@ If you wish to manually download the latest release version from CTAN, get the p http://mirror.ctan.org/install/macros/latex/contrib/fontspec.tds.zip -If you wish to use the latest development version from Github, either use git to obtain the bleeding edge version with +If you wish to use the latest development version from Github, use git to obtain the latest repository code with - git clone git://github.com/wspr/fontspec.git + git clone git://github.com/latex3/fontspec.git -(For bleeding edge versions, see the `working` branch.) -Having obtained the package from Github, install the package code by running +See the `working` branch for changes that have not been released to CTAN yet (no guarantees the code in that branch will always be fully functional). Having obtained the package from Github, install the package code by running l3build install diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-api.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-api.dtx index 17f22a23e7..e8a8878e66 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-api.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-api.dtx @@ -378,6 +378,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-closing.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-closing.dtx index 5adc879707..91b5ebb7ee 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-closing.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-closing.dtx @@ -32,6 +32,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-enc.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-enc.dtx index f477998130..17434643e0 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-enc.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-enc.dtx @@ -146,6 +146,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-feat-aat.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-feat-aat.dtx index 994fae553c..fdffc058e5 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-feat-aat.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-feat-aat.dtx @@ -231,6 +231,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-feat-opentype.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-feat-opentype.dtx index a278057442..c48e40deb0 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-feat-opentype.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-feat-opentype.dtx @@ -571,6 +571,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-fontload.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-fontload.dtx index 4f3dcea690..12dc8472df 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-fontload.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-fontload.dtx @@ -34,7 +34,7 @@ % % \begin{macro}[pTF]{\@@_primitive_font_if_null:N} % \begin{macrocode} -\prg_set_conditional:Nnn \@@_primitive_font_if_null:N {p,TF,T,F} +\prg_new_conditional:Nnn \@@_primitive_font_if_null:N {p,TF,T,F} { \ifx #1 \nullfont \prg_return_true: @@ -47,12 +47,12 @@ % % \begin{macro}[pTF]{\@@_primitive_font_set:NnnTF,\@@_primitive_font_gset:NnnTF} % \begin{macrocode} -\prg_set_conditional:Nnn \@@_primitive_font_set:Nnn {TF,T,F} +\prg_new_conditional:Nnn \@@_primitive_font_set:Nnn {TF,T,F} { \@@_primitive_font_set:Nnn #1 {#2} {#3} \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} } -\prg_set_conditional:Nnn \@@_primitive_font_gset:Nnn {TF,T,F} +\prg_new_conditional:Nnn \@@_primitive_font_gset:Nnn {TF,T,F} { \@@_primitive_font_gset:Nnn #1 {#2} {#3} \@@_primitive_font_if_null:NTF #1 {\prg_return_false:} {\prg_return_true:} @@ -66,7 +66,7 @@ % % \begin{macro}[TF]{\@@_primitive_font_if_exist:n} % \begin{macrocode} -\prg_set_conditional:Nnn \@@_primitive_font_if_exist:n {TF,T,F} +\prg_new_conditional:Nnn \@@_primitive_font_if_exist:n {TF,T,F} { \group_begin: \@@_font_suppress_not_found_error: @@ -124,6 +124,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-graphite.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-graphite.dtx index 2a26211c2a..f794f469e1 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-graphite.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-graphite.dtx @@ -116,6 +116,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-interfaces.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-interfaces.dtx index d76dd61d60..09c855905d 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-interfaces.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-interfaces.dtx @@ -284,6 +284,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx index ee7e36cc88..b45a7d3c6c 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-internal.dtx @@ -282,13 +282,14 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:} +% \begin{macro}{\@@_font_is_file:,\@@_font_is_name:,\@@_font_is_kpse:} % The \cs{@@_fontname_wrap:n} command takes the font name and either passes it through unchanged or wraps it in the syntax for loading a font `by filename'. -% \XeTeX's syntax is followed since \pkg{luaotfload} provides compatibility. +% For Lua\TeX\ there are two kinds kinds of filename based loading supported: Regular filename lookups which include system fonts and lookups restricted to kpse. % \begin{macrocode} \cs_new:Nn \@@_font_is_name: { - \cs_set_eq:NN \@@_fontname_wrap:n \use:n +%<XE> \cs_set_eq:NN \@@_fontname_wrap:n \use:n +%<LU> \cs_set:Npn \@@_fontname_wrap:n ##1 { name: ##1 } } % \end{macrocode} % @@ -298,6 +299,16 @@ \cs_set:Npn \@@_fontname_wrap:n ##1 { [ \l_@@_font_path_tl ##1 ] } } % \end{macrocode} +% +% \begin{macrocode} +%<*LU> +\cs_new:Nn \@@_font_is_kpse: + { + \cs_set:Npn \@@_fontname_wrap:n ##1 { kpse: ##1 } + } +%</LU> +%<XE>\cs_new_eq:NN \@@_font_is_kpse: \@@_font_is_file: +% \end{macrocode} % \end{macro} % % \begin{macro}{\@@_set_scriptlang:} @@ -360,7 +371,8 @@ \str_if_eq:eeF { \l_@@_hexcol_tl \l_@@_opacity_tl } { \c_@@_hexcol_tl \c_@@_opacity_tl } - { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } } +%<XE> { \@@_update_featstr:n { color = \l_@@_hexcol_tl\l_@@_opacity_tl } } +%<LU> { \@@_update_featstr:n { color = {\l_@@_hexcol_tl\l_@@_opacity_tl} } } } % \end{macrocode} % \end{macro} @@ -445,7 +457,7 @@ \prop_gput:cnx {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {fontdef} { \@@_construct_font_call:nn {\l_fontspec_fontname_tl} - { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } + { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: } } \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {script-num} \l_@@_script_int \prop_gput:cnV {g_@@_fontinfo_ \g_@@_nfss_family_tl _prop} {lang-num} \l_@@_language_int @@ -649,7 +661,7 @@ \group_begin: \@@_primitive_font_set:Nnn \l_@@_tmpa_font { \@@_construct_font_call:nn {#1} { \l_@@_pre_feat_sclist } } { \f@size pt + 1sp } \@@_primitive_font_set:Nnn \l_@@_tmpb_font { \@@_construct_font_call:nn {#1#2} { \l_@@_pre_feat_sclist } } { \f@size pt + 1sp } - \str_if_eq:eeTF { \@@_primitive_font_get_name:N \l_@@_tmpa_font } { \@@_primitive_font_get_name:N \l_@@_tmpb_font } + \cs_if_eq:NNTF \l_@@_tmpa_font \l_@@_tmpb_font { \group_end: \prg_return_false: } { \group_end: \prg_return_true: } } @@ -790,7 +802,7 @@ %<debug>\typeout{====~Setup~NFSS~shape:~<\l_@@_size_tl>~\l_fontspec_fontname_tl} \@@_get_features:n { #2 , #3 , #4 } -%<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist} +%<debug>\typeout{====~Gathered~features:~\g_@@_rawfeatures_sclist \@@_get_variations:} \tl_if_empty:NF \l_@@_scale_tl { @@ -801,7 +813,7 @@ { <\l_@@_size_tl> \l_@@_scale_tl \@@_construct_font_call:nn { \l_fontspec_fontname_tl } - { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist } + { \l_@@_pre_feat_sclist \g_@@_rawfeatures_sclist \@@_get_variations: } } } % \end{macrocode} @@ -1052,6 +1064,33 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\@@_get_variations:} +% \cmd{\@@_get_variations:} builds the feature string representing the +% current variation instance and/or axis settings. +% \begin{macrocode} +\cs_generate_variant:Nn \tl_tail:n { e } +\cs_new:Nn \@@_format_axis:nn + { + , #1 = #2 + } +\cs_new:Nn \@@_get_variations: + { + \tl_if_empty:NF \g_@@_instance_tl + { + instance = { \g_@@_instance_tl }; + } + \prop_if_empty:NF \g_@@_rawvariations_prop + { + axis = { + \tl_tail:e { + \prop_map_function:NN \g_@@_rawvariations_prop \@@_format_axis:nn + } + }; + } + } +% \end{macrocode} +% \end{macro} +% % \subsection{Initialisation} % % \begin{macro}{\@@_init:} @@ -1089,6 +1128,8 @@ \cs_new:Nn \@@_init_fontface: { \tl_gclear:N \g_@@_rawfeatures_sclist + \prop_gclear:N \g_@@_rawvariations_prop + \tl_gclear:N \g_@@_instance_tl \tl_clear:N \l_@@_scale_tl \tl_set_eq:NN \l_@@_opacity_tl \c_@@_opacity_tl \tl_set_eq:NN \l_@@_hexcol_tl \c_@@_hexcol_tl @@ -1210,6 +1251,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-keyval.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-keyval.dtx index bb18912f8a..57ff738183 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-keyval.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-keyval.dtx @@ -63,7 +63,13 @@ \bool_set_true:N \l_@@_noit_bool \bool_set_true:N \l_@@_external_bool \tl_set:Nn \l_@@_font_path_tl {#1} - \@@_font_is_file: + \bool_lazy_and:nnTF { \l_@@_external_kpse_bool } { \tl_if_empty_p:N \l_@@_font_path_tl } + { + \@@_font_is_kpse: + } + { + \@@_font_is_file: + } %<*XE> \keys_set:nn {fontspec-renderer} {Renderer=OpenType} %</XE> @@ -89,6 +95,22 @@ \@@_keys_define_code:nnn {fontspec} {Extension} {} % \end{macrocode} % +% \paragraph{\feat{KpseOnly}} +% If the font is specified by filename, only search for it through kpse. +% \XeTeX\ does not support finding system fonts by filename so this is always implicitly set +% there. +% \begin{macrocode} +\@@_keys_define_code:nnn {fontspec-preparse-external} {KpseOnly} + { + \bool_set_true:N \l_@@_external_kpse_bool + \bool_if:NT \l_@@_external_bool + { + \@@_font_is_kpse: + } + } +\@@_keys_define_code:nnn {fontspec} {KpseOnly} {} +% \end{macrocode} +% % % \paragraph{\feat{Renderer}} % This feature must be processed before all others (the other font shape and features @@ -463,8 +485,8 @@ % % \paragraph{Scale} % If the input isn't one of the pre-defined string options, then -% it's gotta be numerical. \cs{fontspec_calc_scale:n} does all the work in -% the auto-scaling cases. +% it's gotta be numerical. \cs{fontspec_calc_scale:n} and \cs{fontspec_calc_scale:nn} +% do all the work in the auto-scaling cases. % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Scale} { @@ -472,8 +494,10 @@ { {MatchLowercase} { \@@_calc_scale:n {5} } {MatchUppercase} { \@@_calc_scale:n {8} } + {MatchAveragecase} { \@@_calc_scale:nn {5} {8} } } { \tl_set:Nx \l_@@_scale_tl {#1} } + \@@_info:n {set-scale} } % \end{macrocode} % @@ -520,7 +544,6 @@ \dim_to_fp:n {\l_@@_tmpb_dim} } } - \@@_info:n {set-scale} \exp_args:NNNx \group_end: \tl_set:Nx \l_@@_scale_tl { \l_@@_scale_tl } @@ -529,6 +552,26 @@ % \end{macro} % % +% \begin{macro}{\@@_calc_scale:nn} +% This macro calls \cs{fontspec_calc_scale:n} twice +% and then sets the scale to the average of the two results. +% \begin{macrocode} +\cs_new:Nn \@@_calc_scale:nn +{ + \group_begin: + \__fontspec_calc_scale:n {#1} + \tl_set_eq:NN \l_@@_tmp_tl \l_@@_scale_tl + \__fontspec_calc_scale:n {#2} + \tl_set:Nx \l_@@_scale_tl + { + \fp_eval:n { (\l_@@_tmp_tl + \l_@@_scale_tl)/2 } + } + \exp_args:NNNx + \group_end: + \tl_set:Nx \l_@@_scale_tl { \l_@@_scale_tl } + } +% \end{macrocode} +% \end{macro} % \begin{macro}{\@@_set_font_dimen:NnN} % This function sets the dimension |#1| (for font |#3|) to `fontdimen' |#2| % for either font dimension 5 (x-height) or 8 (cap-height). If, for some @@ -675,26 +718,61 @@ % \end{macrocode} % % \paragraph{Color} -% Hooks into pkg{xcolor}, which names its colours \texttt{\char`\\color@<name>}. +% Test first if the color is a named l3color, then if it is a color from +% \pkg{xcolor}, which names its colours \texttt{\char`\\color@<name>}. +% If this fails the argument is assumed to be a hex color. +% % \begin{macrocode} \@@_keys_define_code:nnn {fontspec} {Color} { - \cs_if_exist:cTF { \token_to_str:N \color@ #1 } +%<*XE> + \color_if_exist:nTF {#1} { - \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl + \color_export:nnN {#1} {HTML}\l_@@_hexcol_tl } { - \int_compare:nTF { \tl_count:n {#1} == 6 } - { \tl_set:Nn \l_@@_hexcol_tl {#1} } + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl + } { - \int_compare:nTF { \tl_count:n {#1} == 8 } - { \fontspec_parse_colour:viii #1 } + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l_@@_hexcol_tl {#1} } { - \bool_if:NF \l_@@_firsttime_bool - { \@@_warning:nx {bad-colour} {#1} } + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {bad-colour} {#1} } + } } } } +%</XE> +%<*LU> + \color_if_exist:nTF {#1} + { + \tl_set:Nn \l_@@_hexcol_tl {#1} + } + { + \cs_if_exist:cTF { \token_to_str:N \color@ #1 } + { + \convertcolorspec{named}{#1}{HTML}\l_@@_hexcol_tl + } + { + \int_compare:nTF { \tl_count:n {#1} == 6 } + { \tl_set:Nn \l_@@_hexcol_tl {#1} } + { + \int_compare:nTF { \tl_count:n {#1} == 8 } + { \fontspec_parse_colour:viii #1 } + { + \bool_if:NF \l_@@_firsttime_bool + { \@@_warning:nx {bad-colour} {#1} } + } + } + } + } +%</LU> } % \end{macrocode} % @@ -723,6 +801,7 @@ } \tl_set:Nx \l_@@_opacity_tl { +%<LU> , \int_compare:nT { \l_@@_tmp_int <= "F } {0} % zero pad \int_to_hex:n { \l_@@_tmp_int } } @@ -760,14 +839,21 @@ % \subsubsection{Continuous font axes} % % \begin{macrocode} +%<*XE> \@@_keys_define_code:nnn {fontspec} {Weight} { \@@_update_featstr:n{weight=#1} } +%</XE> +%<LU>\@@_define_opentype_variation_axis:nn {Weight} {wght} +%<*XE> \@@_keys_define_code:nnn {fontspec} {Width} { \@@_update_featstr:n{width=#1} } +%</XE> +%<LU>\@@_define_opentype_variation_axis:nn {Width} {wdth} +\@@_define_opentype_variation_axis:nn {Slant} {slnt} \@@_keys_define_code:nnn {fontspec} {OpticalSize} %<*XE> { @@ -795,6 +881,23 @@ %</LU> % \end{macrocode} % +% For other potentially font specific variation axes, there is a raw setter available: +% \begin{macrocode} +\@@_keys_define_code:nnn {fontspec-opentype} {RawAxis} + { + \prop_gput_from_keyval:Nn \g_@@_rawvariations_prop {#1} + } +% \end{macrocode} +% +% \subsubsection{Variation instances} +% +% \begin{macrocode} +\@@_keys_define_code:nnn {fontspec-opentype} {Instance} + { + \tl_gset:Nn \g_@@_instance_tl {#1} + } +% \end{macrocode} +% % \subsubsection{Font transformations} % These are to be specified to apply directly to a font shape: % \begin{macrocode} @@ -914,6 +1017,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-lang.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-lang.dtx index 22bde48834..1e52fc9d26 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-lang.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-lang.dtx @@ -407,6 +407,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-load.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-load.dtx index 4f7ec3bd83..db7f370031 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-load.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-load.dtx @@ -21,7 +21,7 @@ { \RequirePackage{luaotfload} \lua_now:e{require("fontspec")} - \RequirePackageWithOptions{fontspec-luatex} + \RequirePackage{fontspec-luatex} \endinput } % \end{macrocode} @@ -30,7 +30,7 @@ % \begin{macrocode} \sys_if_engine_xetex:T { - \RequirePackageWithOptions{fontspec-xetex} + \RequirePackage{fontspec-xetex} \endinput } % \end{macrocode} @@ -60,6 +60,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-math.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-math.dtx index 73f29782af..01d99c8641 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-math.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-math.dtx @@ -248,6 +248,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-msg.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-msg.dtx index 1eafe2333d..1785437fa0 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-msg.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-msg.dtx @@ -13,6 +13,7 @@ \cs_new:Npn \@@_error:n { \msg_error:nn {fontspec} } \cs_new:Npn \@@_error:nn { \msg_error:nnn {fontspec} } \cs_new:Npn \@@_error:nx { \msg_error:nnx {fontspec} } +\cs_new:Npn \@@_error:nxx { \msg_error:nnxx {fontspec} } \cs_new:Npn \@@_warning:n { \msg_warning:nn {fontspec} } \cs_new:Npn \@@_warning:nx { \msg_warning:nnx {fontspec} } \cs_new:Npn \@@_warning:nxx { \msg_warning:nnxx {fontspec} } @@ -188,10 +189,21 @@ Input mapping not supported in LuaTeX.\\ Use "Ligatures=TeX" instead of "Mapping=tex-text". } -\@@_msg_new:nn {cm-default-obsolete} +% \end{macrocode} +% message for package options must be loaded earlier +% \begin{macrocode} +%</fontspec> +%<*options> +\msg_new:nnn {fontspec} {cm-default-obsolete} + { + The~"cm-default"~package~option~is~obsolete. + } +\msg_new:nnn {fontspec} {enc-obsolete} { - The "cm-default" package option is obsolete. + The~"#1"~package~option~is~obsolete.~TU~is~the~default~encoding. } +%</options> +%<*fontspec> \@@_msg_new:nn {font-index-needs-ttc} { The "FontIndex" feature is only supported by TTC (TrueType Collection) fonts.\\ @@ -268,6 +280,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-opening.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-opening.dtx index 60253a1ea8..103fe2addf 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-opening.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-opening.dtx @@ -4,75 +4,74 @@ % % \iffalse % \begin{macrocode} -%<*fontspec> +%<*options> % \end{macrocode} % \fi % % \subsection{Package options} % % \begin{macrocode} -\DeclareOption{cm-default} +\DeclareKeys { - \@@_warning:n {cm-default-obsolete} - } + cm-default .code:n = { \msg_warning:nn {fontspec} {cm-default-obsolete} } % \end{macrocode} % % \begin{macrocode} -\DeclareOption {math} { \bool_gset_true:N \g_@@_math_bool } -\DeclareOption {no-math} { \bool_gset_false:N \g_@@_math_bool } -\DeclareOption {config} { \bool_gset_true:N \g_@@_cfg_bool } -\DeclareOption {no-config}{ \bool_gset_false:N \g_@@_cfg_bool } -\DeclareOption {euenc} { \bool_gset_true:N \g_@@_euenc_bool } -\DeclareOption {tuenc} { \bool_gset_false:N \g_@@_euenc_bool } + ,math .bool_gset:N = \g_@@_math_bool + ,math .usage:n = preamble + ,no-math .bool_gset_inverse:N = \g_@@_math_bool + ,no-math .usage:n = preamble + ,config .bool_gset:N = \g_@@_cfg_bool + ,config .usage:n = load + ,no-config .bool_gset_inverse:N = \g_@@_cfg_bool + ,no-config .usage:n = load + ,euenc .code:n = { \msg_warning:nnn {fontspec} {enc-obsolete}{euenc} } + ,tuenc .code:n = { \msg_warning:nnn {fontspec} {enc-obsolete}{tuenc} } % \end{macrocode} % % \begin{macrocode} -\DeclareOption {quiet} - { - \msg_redirect_module:nnn { fontspec } { warning } { info } - \msg_redirect_module:nnn { fontspec } { info } { none } - } -\DeclareOption{silent} - { - \msg_redirect_module:nnn { fontspec } { warning } { none } - \msg_redirect_module:nnn { fontspec } { info } { none } - } + ,quiet .code:n = + { + \msg_redirect_module:nnn { fontspec } { warning } { info } + \msg_redirect_module:nnn { fontspec } { info } { none } + } + ,silent .code:n = + { + \msg_redirect_module:nnn { fontspec } { warning } { none } + \msg_redirect_module:nnn { fontspec } { info } { none } + } + ,verbose .code:n = + { + \msg_redirect_module:nnn { fontspec } { warning } { warning } + \msg_redirect_module:nnn { fontspec } { info } { info } + } + } % \end{macrocode} % % \begin{macrocode} -\ExecuteOptions{config,math,tuenc} -\ProcessOptions* +\SetKeys{config,math} +\ProcessKeyOptions % \end{macrocode} % -% +% \iffalse +% \begin{macrocode} +%</options> +%<*fontspec> +% \end{macrocode} +% \fi % % % \subsection{Encodings} % -% Soon to be the default, with a just-in-case check: +% Now the default, with a just-in-case check: % \begin{macrocode} -\bool_if:NF \g_@@_euenc_bool - { - \file_if_exist:nTF {tuenc.def} - { - \cs_if_exist:cF {T@TU} - { - \@@_warning:n {tu-clash} - \DeclareFontEncoding{TU}{}{} - \DeclareFontSubstitution{TU}{lmr}{m}{n} - } - } - { - \@@_warning:n {tu-missing} - \bool_gset_true:N \g_@@_euenc_bool - } - } -\bool_if:NTF \g_@@_euenc_bool +\cs_if_exist:cF {T@TU} { -%<XE> \tl_gset:Nn \g_fontspec_encoding_tl {EU1} -%<LU> \tl_gset:Nn \g_fontspec_encoding_tl {EU2} + \@@_warning:n {tu-clash} + \DeclareFontEncoding{TU}{}{} + \DeclareFontSubstitution{TU}{lmr}{m}{n} } - { \tl_gset:Nn \g_fontspec_encoding_tl { TU } } +\tl_gset:Nn \g_fontspec_encoding_tl { TU } % \end{macrocode} % % \begin{macrocode} @@ -100,16 +99,6 @@ % Something to do with \cmd\select@language\ ending up in the \texttt{.aux} % file which is read at the beginning of the document. % -% \begin{macrocode} -\bool_if:NT \g_@@_euenc_bool - { -%<LU> \cs_set_eq:NN \fontspec_tmp: \XeTeXpicfile -%<LU> \cs_set:Npn \XeTeXpicfile {} - \RequirePackage{xunicode} -%<LU> \cs_set_eq:NN \XeTeXpicfile \fontspec_tmp: - } -% \end{macrocode} -% % % \subsection{Generic functions} % @@ -201,6 +190,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-opentype.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-opentype.dtx index 94be4acfca..1ea0a4eccf 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-opentype.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-opentype.dtx @@ -10,6 +10,22 @@ % % % +% \begin{macro}{\@@_define_opentype_variation_axis:nn} +% \begin{macrocode} +\cs_new:Nn \@@_define_opentype_variation_axis:nn + { + \keys_define:nn {fontspec-opentype} + { + #1 .code:n = { + \prop_gput:Nnn \g_@@_rawvariations_prop { #2 } { ##1 } + }, + #1 .value_required:n = true, + #1 .groups:n = {opentype}, + } + } +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\@@_define_opentype_feature_group:n} % \begin{macrocode} \cs_new:Nn \@@_define_opentype_feature_group:n @@ -466,6 +482,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-scripts.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-scripts.dtx index 7c2f79117c..d56a066e7e 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-scripts.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-scripts.dtx @@ -37,7 +37,7 @@ \newfontscript{CJK~Ideographic}{hani} \newfontscript{Coptic}{copt} \newfontscript{Cypriot~Syllabary}{cprt} -\newfontscript{Cypro~Minoan}{cpmn} +\newfontscript{Cypro-Minoan}{cpmn} \newfontscript{Cyrillic}{cyrl} \newfontscript{Default}{DFLT} \newfontscript{CustomDefault}{latn,DFLT} @@ -71,6 +71,7 @@ \newfontscript{Javanese}{java} \newfontscript{Kaithi}{kthi} \newfontscript{Kannada}{knd2,knda} +\newfontscript{Kawi}{kawi} \newfontscript{Kayah~Li}{kali} \newfontscript{Kharosthi}{khar} \newfontscript{Khitan~Small~Script}{kits} @@ -92,7 +93,7 @@ \newfontscript{Mandaic}{mand} \newfontscript{Manichaean}{mani} \newfontscript{Marchen}{marc} -\newfontscript{Masaram Gondi}{gonm} +\newfontscript{Masaram~Gondi}{gonm} \newfontscript{Math}{math} \newfontscript{Medefaidrin}{medf} \newfontscript{Meitei~Mayek}{mtei} @@ -108,6 +109,7 @@ \newfontscript{Myanmar}{mym2,mymr} \newfontscript{N'Ko}{nko~} \newfontscript{Nabataean}{nbat} +\newfontscript{Nag~Mundari}{nagm} \newfontscript{Nandinagari}{nand} \newfontscript{Newa}{newa} \newfontscript{Nushu}{nshu} @@ -195,6 +197,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-user.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-user.dtx index eeb704df58..d28eda0c2f 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-user.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-user.dtx @@ -540,6 +540,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-vars.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-vars.dtx index d24776218f..bb6d3b4eee 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-vars.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-vars.dtx @@ -4,6 +4,7 @@ % % \iffalse % \begin{macrocode} +%<@@=fontspec> %<*fontspec> % \end{macrocode} % \fi @@ -50,9 +51,12 @@ % \end{macrocode} % For package options: % \begin{macrocode} +%</fontspec> +%<*options> \bool_new:N \g_@@_cfg_bool \bool_new:N \g_@@_math_bool -\bool_new:N \g_@@_euenc_bool +%</options> +%<*fontspec> % \end{macrocode} % % \begin{macrocode} @@ -63,6 +67,7 @@ \bool_new:N \l_@@_defining_encoding_bool \bool_new:N \l_@@_scriptlang_exist_bool \bool_new:N \g_@@_em_normalise_slant_bool +\bool_new:N \l_@@_external_kpse_bool \bool_new:N \l_@@_proceed_bool % \end{macrocode} % @@ -151,6 +156,7 @@ \prop_new:N \g_@@_strong_prop \prop_new:N \g_@@_fontid_family_prop \prop_new:N \g_@@_family_int_prop +\prop_new:N \g_@@_rawvariations_prop % \end{macrocode} % % \paragraph{Token lists} @@ -288,11 +294,13 @@ \tl_new:N \l_@@_punctspace_adjust_tl \tl_new:N \l_@@_wordspace_adjust_tl \tl_new:N \l_@@_postadjust_tl +\tl_new:N \g_@@_instance_tl % \end{macrocode} % % \begin{macrocode} \tl_const:Nn \c_@@_hexcol_tl {000000} -\tl_const:Nn \c_@@_opacity_tl {FF~} +%<XE> \tl_const:Nn \c_@@_opacity_tl {FF~} +%<LU> \tl_const:Nn \c_@@_opacity_tl {} \tl_const:Nn \c_@@_postadjust_tl { \l_@@_wordspace_adjust_tl \l_@@_punctspace_adjust_tl } % \end{macrocode} % @@ -328,6 +336,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code-xfss.dtx b/macros/unicodetex/latex/fontspec/fontspec-code-xfss.dtx index ecbad84167..bac0e57d94 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code-xfss.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-code-xfss.dtx @@ -151,6 +151,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code.ltx b/macros/unicodetex/latex/fontspec/fontspec-code.ltx index 5ee01ccc80..1ec8fe6cd7 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code.ltx +++ b/macros/unicodetex/latex/fontspec/fontspec-code.ltx @@ -30,6 +30,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-code.pdf b/macros/unicodetex/latex/fontspec/fontspec-code.pdf Binary files differindex 0a86c16bf7..c11119f627 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-code.pdf +++ b/macros/unicodetex/latex/fontspec/fontspec-code.pdf diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-api.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-api.tex index 42970e3f37..bdcb1935b3 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-api.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-api.tex @@ -339,6 +339,7 @@ OpenType language tag |#1|. % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-enc.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-enc.tex index 8ab667b288..60da8dbb3a 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-enc.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-enc.tex @@ -204,6 +204,7 @@ the process of defining Unicode font range encodings: % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-featset.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-featset.tex index 4bb75d14b5..b95931c52e 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-featset.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-featset.tex @@ -330,7 +330,7 @@ Notably, this mechanism is different to that of the \pkg{color}/\pkg{xcolor}/\pk (For example, if you set the colour in a \verb|\setmainfont| command, \verb|\color{...}| and related commands, including hyperlink colouring, will no longer have any effect on text in this font.) Therefore, \pkg{fontspec}'s colour commands are best used to set explicit colours in specific situations, and the \pkg{xcolor} package is recommended for more general colour functionality. -The colour is defined as a triplet of two-digit Hex RGB +The colour can be defined as a triplet of two-digit Hex RGB values, with optionally another value for the transparency (where |00| is completely transparent and |FF| is opaque.) \begin{Lexample}{color}{Selecting colour with transparency.} @@ -341,8 +341,6 @@ values, with optionally another value for the transparency (where {\addfontfeature{Color=DDBB2299}P}\kern-0.5ex {\addfontfeature{Color=00BB3399}R} \end{Lexample} -Transparency is supported by \LuaLaTeX; \XeLaTeX\ with the \texttt{xdvipdfmx} driver -does not support this feature. If you load the \pkg{xcolor} package, you may use any named colour instead of writing the colours in hexadecimal. @@ -353,23 +351,68 @@ of writing the colours in hexadecimal. \definecolor{Foo}{rgb}{0.3,0.4,0.5} \fontspec[Color=Foo]{Verdana} ... \end{Verbatim} -The \pkg{color} package is \emph{not} supported; use \pkg{xcolor} instead. -You may specify the transparency with a named colour using the \feat{Opacity} -feature which takes an decimal from zero to one corresponding to -transparent to opaque respectively: +You may also use named colours defined with the color commands of the L3 +programming layer: +\begin{Verbatim} + \ExplSyntaxOn + \color_set:nnn{Foo}{rgb}{0.3,0.4,0.5} +\ExplSyntaxOff + ... + \fontspec[Color=Foo]{Verdana} ... +\end{Verbatim} + +Color expressions (\verb+red!50!blue+) are not supported. The \pkg{color} +package is \emph{not} supported neither. + +The code will at first test for color names of the L3 layer, then for xcolor +names and at last try to use the argument as a hexadecimal value. + +You may specify the transparency with a named colour using the \feat{Opacity} +feature which takes an decimal from zero to one corresponding to transparent +to opaque respectively: \begin{Verbatim} \fontspec[Color=red,Opacity=0.7]{Verdana} ... \end{Verbatim} It is still possible to specify a colour in six-char hexadecimal form while defining opacity in this way, if you like. +\subsubsection{Color models} + +With \XeTeX\ color are always written in the rgb color model into the PDF. +When using \LuaTeX, colors with the commands of the L3 layer can be written +as rgb or cmyk or as spot color depending on their definition and of the +value of the variable \verb+\l_color_fixed_model_tl+. + +\subsubsection{Spot colors} +With \LuaTeX\ it is possible to use spot colors. This requires the use of the +PDF management: +\begin{Verbatim} +\DocumentMetadata{} +\documentclass{article} +\usepackage{fontspec} +\ExplSyntaxOn + \color_model_new:nnn { sepblue } { Separation } + { + name = PANTONE~3005~U , + alternative-model = cmyk , + alternative-values = {1, 0.56, 0,0}, + } + \color_set:nnn{spotblue}{sepblue}{1} +\ExplSyntaxOff +... +\fontspec[Color=spotblue]{texgyreheros} +\end{Verbatim} + + + \subsection{Scale} \cmdbox{ \feat{Scale} = \meta{number} \\ \feat{Scale} = \opt{MatchLowercase} \\ - \feat{Scale} = \opt{MatchUppercase} + \feat{Scale} = \opt{MatchUppercase} \\ + \feat{Scale} = \opt{MatchAveragecase} } In its explicit form, \feat{Scale} takes a single @@ -377,18 +420,21 @@ numeric argument for linearly scaling the font, as demonstrated in \exref{fontload}. As well as a numerical argument, the \feat{Scale} feature -also accepts options \opt{MatchLowercase} -and \opt{MatchUppercase}, which will scale the font being selected to match -the current default roman font to either the height of the lowercase or -uppercase letters, respectively; these features are shown in \exref{scale}. +also accepts options \opt{MatchLowercase}, \opt{MatchUppercase}, +and \opt{MatchAveragecase}, which will scale the font being selected to match +the current default roman font to either the height of the lowercase, +the height of the uppercase letters, or the average of the two, +respectively; these features are shown in \exref{scale}. The amount of scaling used in each instance is reported in the \texttt{.log} file. \begin{Xexample}{scale}{Automatically calculated scale values.} - \setmainfont{Georgia} - \newfontfamily\lc[Scale=MatchLowercase]{Verdana} + \setmainfont{texgyrepagella-regular.otf} + \newfontfamily\lc[Scale=MatchLowercase]{texgyreadventor-regular.otf} The perfect match {\lc is hard to find.}\\ - \newfontfamily\uc[Scale=MatchUppercase]{Arial} - L O G O \uc F O N T + \newfontfamily\uc[Scale=MatchUppercase]{texgyreheros-regular.otf} + L O G O {\uc F O N T}\\ + \newfontfamily\ac[Scale=MatchAveragecase]{FiraMath-Regular.otf} + Lower {\ac and UPPER} CASE \end{Xexample} Additional calls to the \feat{Scale} feature overwrite the settings of the former. @@ -400,7 +446,8 @@ necessary. For example: [ Scale = 1.1 , ScaleAgain = 1.2 ] % -> scale of 1.32 \end{Verbatim} -Note that when |Scale=MatchLowercase| is used with |\setmainfont|, the new `main' +Note that when |Scale=MatchLowercase|, |Scale=MatchUppercase|, or |Scale=MatchAverageCase| +is used with |\setmainfont|, the new `main' font of the document will be scaled to match the old default. If you wish to automatically scale all fonts except have the main font use `natural' scaling, you may write @@ -608,12 +655,97 @@ This functionality is not generally used for lowercase text in modern typesettin In particular, small amounts of letter spacing can be very useful, when setting small caps or all caps titles. Also see the OpenType \opt{Uppercase} option of the \feat{Letters} feature (\vref{sec:letters}). + +\section{Variable fonts} \label{sec:variable} + +OpenType variable fonts and Multiple Master fonts are parameterised over +orthogonal font axes, allowing continuous selection along such features +as weight, width, and optical size. + +Currently OpenType variable fonts are only supported in \LuaTeX, while +Multiple Master fonts only work with \XeTeX. + +\subsection{Optical font sizes} \label{sec:aat-opticalsize} +Whereas traditional OpenType fonts will have only a few separate +optical sizes, a Variable or Multiple Master font's optical size can be +specified over a continuous range. Unfortunately, this flexibility makes +it harder to create an automatic interface through \LaTeX, and the +optical size for a Variable or Multiple Master font must always be specified +explicitly. +\begin{Verbatim} + \fontspec{Minion MM Roman}[OpticalSize=11] + MM optical size test \\ + \fontspec{Minion MM Roman}[OpticalSize=47] + MM optical size test \\ + \fontspec{Minion MM Roman}[OpticalSize=71] + MM optical size test \\ +\end{Verbatim} + + +\subsection{Weight} \label{sec:variable-weight} +For fonts with a variable weight axis, the weight can be specified through the +\feat{Weight} feature. The value should be between 0 and 1000, where typically +400 corresponds to regular wight and 700 is a bold font. +\begin{Verbatim} + \fontspec{Source Serif Variable}[Weight=700] + Bold \\ + \fontspec{Source Serif Variable}[Weight=200] + Extra Light \\ +\end{Verbatim} + + +\subsection{Width} \label{sec:variable-width} +Similarly, the \feat{Width} feature allows specifying the value of the width axis, +where the value is a percentage of normal width. +\begin{Verbatim} + \fontspec{Noto Serif}[Width=100] + Normal Width \\ + \fontspec{Noto Serif}[Width=75] + Condensed \\ +\end{Verbatim} + +\subsection{Slant} \label{sec:variable-slant} +Also fonts with a slant axis can be controlled with the \feat{Slant} feature. +In a standard compliant font the value should specify the clockwise angle in degree +the glyphs are slanted. Therefore for a typical forward leaning slanted font, a +negative value should be passed. + +Many fonts use this feature in non-standard ways, so you might have to experiment +a bit with the value. +\begin{Verbatim} + \fontspec{Roboto Flex}[Slant=0] + Upright \\ + \fontspec{Roboto Flex}[Slant=-5] + Slanted \\ +\end{Verbatim} + +\subsection{Other axes} \label{sec:variable-raw} +For OpenType variable fonts, additional axis values can be specified +if the four letter tag of these axes is known. +Than their value can be set with the \feat{RawAxis} feature: +\begin{Verbatim} + \fontspec{Noto Serif}[RawAxis={CTGR=100}] + Maximal contrast \\ + \fontspec{Noto Serif}[RawAxis={CTGR=0}] + Regular contrast \\ +\end{Verbatim} + +\subsection{Instances} \label{sec:variable-instances} +Instead of manually setting axis values, many fonts contain named instances which are predefined settings of all axes. + +To select such an instance, the \feat{Instance} feature can be used: +\begin{Verbatim} + \fontspec{Noto Serif}[Instance=ExtraCondensed Bold] + This is in extra condensed bold. +\end{Verbatim} + \end{document} % /© % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-fontsel.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-fontsel.tex index d6ac139ef6..aecd47e176 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-fontsel.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-fontsel.tex @@ -129,6 +129,7 @@ wish to have them all installed in your system's font directories. In this case, it is more convenient to load them from a different location on your disk. This technique is also necessary in \XeTeX\ when loading OpenType fonts that are present within your \TeX\ distribution, such as \path{/usr/local/texlive/2013/texmf-dist/fonts/opentype/public}. Fonts in such locations are visible to \XeTeX\ but cannot be loaded by font name, only file name; \LuaTeX\ does not have this restriction. +(If you for some reason want to restrict the fonts to the ones provided by your \TeX\ distribution even though you are using \LuaTeX\ you can use the \texttt{KpseOnly} option) When selecting fonts by file name, any font that can be found in the default search paths may be used directly (including in the current directory) @@ -641,6 +642,7 @@ if it were a `naked' control sequence; \eg, `|M. \fontspec{...} N|' and % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-intro.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-intro.tex index 4e913b6107..07345d19d7 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-intro.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-intro.tex @@ -75,17 +75,19 @@ For basic use, no package options are required: \usepackage{fontspec} \end{Verbatim} Package options will be introduced below; some preliminary details are discussed first. - +Package options are setup with the in-built \LaTeX{} keyval options handler. This means +that the package can be loaded more than once with different options without triggering +an option clash error. The \texttt{config} and \texttt{no-config} option must be used in +the first loading and are ignored later. \subsection{Font encodings} -The (default) \texttt{tuenc} package option switches the \textsc{nfss} font encoding to \texttt{TU}. +The package switches the \textsc{nfss} font encoding to \texttt{TU}. \texttt{TU} is a new Unicode font encoding, intended for both \XeTeX\ and \LuaTeX\ engines, and automatically contains support for symbols covered by \LaTeX's traditional \texttt{T1} and \texttt{TS1} font encodings (for example, |\%|, |\textbullet|, |\"u|, and so on). Some additional features are provided by \pkg{fontspec} to customise some encoding details; see Part~\vref{part:enc} for further details. -Pre-2017 behaviour can be achieved with the \texttt{euenc} package option. -This selects the \texttt{EU1} or \texttt{EU2} encoding (\XeTeX/\LuaTeX, resp.) and loads the \pkg{xunicode} package for symbol support. -Package authors and users who have referred explicitly to the encoding names \texttt{EU1} or \texttt{EU2} should update their code or documents. +Pre-2017 behaviour is now obsolete. The \texttt{euenc} and \texttt{tuenc} package options are +ignored. Package authors and users who have referred explicitly to the encoding names \texttt{EU1} or \texttt{EU2} should update their code or documents. (See internal variable names described in \vref{sec:api} for how to do this properly.) @@ -108,7 +110,7 @@ A |fontspec.cfg| file is distributed with \pkg{fontspec} with a small number of To customise \pkg{fontspec} to your liking, use the standard |.cfg| file as a starting point or write your own from scratch, then either place it in the same folder as the main document for isolated cases, or in a location that \XeTeX\ or \LuaTeX\ searches by default; \eg\ in Mac\TeX: \path{~/Library/texmf/tex/latex/}. -The package option |no-config| will suppress the loading of the |fontspec.cfg| file under all circumstances. +The package option |no-config| will suppress the loading of the |fontspec.cfg| file under all circumstances. Both options must be used the first time \pkg{fontspec} is loaded and are ignored in later calls. \subsection{Warnings} @@ -121,7 +123,7 @@ transcript (\texttt{.log}) file instead. Use the |silent| package option to completely suppress these warnings if you don't even want the |.log| file cluttered up. - +Both options can also be used with \cs{Setkeys} in the document. Use the |verbose| option to get activate the warnings again. \section{Interaction with \LaTeXe\ and other packages} @@ -184,6 +186,7 @@ An example for setting up a font family for use with \cs{strong} is discussed in % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-luatex.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-luatex.tex index e0ed5881d6..b08a89230e 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-luatex.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-luatex.tex @@ -81,6 +81,7 @@ Please refer to the \LuaTeX/\pkg{luaotfload} documentation for more details. % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-opentype.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-opentype.tex index 3d6aa4601b..10bc9f0284 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-opentype.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-opentype.tex @@ -1467,6 +1467,7 @@ however; please get in touch if there are improvements that could be made. % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-doc-xetex.tex b/macros/unicodetex/latex/fontspec/fontspec-doc-xetex.tex index 4f1369ddd6..0033156971 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-doc-xetex.tex +++ b/macros/unicodetex/latex/fontspec/fontspec-doc-xetex.tex @@ -58,27 +58,6 @@ by \pkg{fontspec} before all others and will automatically and without warning select the \opt{OpenType} renderer.} -\subsection{Optical font sizes} \label{sec:aat-opticalsize} - -Multiple Master fonts are parameterised over -orthogonal font axes, allowing continuous selection along such -features as weight, width, and optical size. -Whereas an OpenType font will have only a few separate -optical sizes, a Multiple Master font's optical size can be -specified over a continuous range. Unfortunately, this flexibility makes -it harder to create an automatic interface through \LaTeX, and the -optical size for a Multiple Master font must always be specified -explicitly. -\begin{Verbatim} - \fontspec{Minion MM Roman}[OpticalSize=11] - MM optical size test \\ - \fontspec{Minion MM Roman}[OpticalSize=47] - MM optical size test \\ - \fontspec{Minion MM Roman}[OpticalSize=71] - MM optical size test \\ -\end{Verbatim} - - \subsection{Vertical typesetting} \XeTeX\ provides for vertical typesetting simply with the ability to rotate @@ -282,6 +261,7 @@ options: \opt{Off}, % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec-lua.dtx b/macros/unicodetex/latex/fontspec/fontspec-lua.dtx index 0ec3127188..09e123a053 100644 --- a/macros/unicodetex/latex/fontspec/fontspec-lua.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec-lua.dtx @@ -89,6 +89,7 @@ end % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec.dtx b/macros/unicodetex/latex/fontspec/fontspec.dtx index e6d8105a7a..f73bb4edcb 100644 --- a/macros/unicodetex/latex/fontspec/fontspec.dtx +++ b/macros/unicodetex/latex/fontspec/fontspec.dtx @@ -70,7 +70,7 @@ \ProvidesExplFile{fontspec.dtx} %</dtx> %<*fontspec> - {2022/01/15}{2.8a}{Font selection for XeLaTeX and LuaLaTeX} + {2024/02/13}{2.9a}{Font selection for XeLaTeX and LuaLaTeX} %</fontspec> % \end{macrocode} % @@ -89,8 +89,8 @@ %<lua>local fontspec = fontspec %<lua>fontspec.module = { %<lua> name = "fontspec", -%<lua> version = "2.8a", -%<lua> date = "2022/01/15", +%<lua> version = "2.9a", +%<lua> date = "2024/02/13", %<lua> description = "Font selection for XeLaTeX and LuaLaTeX", %<lua> author = "Khaled Hosny, Philipp Gesang, Will Robertson", %<lua> copyright = "Khaled Hosny, Philipp Gesang, Will Robertson", @@ -104,6 +104,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec.ins b/macros/unicodetex/latex/fontspec/fontspec.ins index be45e40b82..00b43f9ee2 100644 --- a/macros/unicodetex/latex/fontspec/fontspec.ins +++ b/macros/unicodetex/latex/fontspec/fontspec.ins @@ -32,6 +32,9 @@ the conditions of the LaTeX Project Public License, version 1.3c or higher \generate{\file{fontspec.sty}{ \from{fontspec.dtx}{fontspec,load\FSDEBUG} + \from{fontspec-code-vars.dtx}{options} + \from{fontspec-code-msg.dtx}{options} + \from{fontspec-code-opening.dtx}{options} \from{fontspec-code-load.dtx}{fontspec,load\FSDEBUG} }} @@ -48,6 +51,7 @@ the conditions of the LaTeX Project Public License, version 1.3c or higher % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec.ltx b/macros/unicodetex/latex/fontspec/fontspec.ltx index 239069ff7e..d6d2a2d642 100644 --- a/macros/unicodetex/latex/fontspec/fontspec.ltx +++ b/macros/unicodetex/latex/fontspec/fontspec.ltx @@ -28,6 +28,7 @@ % ------------------------------------------------ % The FONTSPEC package <wspr.io/fontspec> % ------------------------------------------------ +% Copyright 2022-2023 The LaTeX project % Copyright 2004-2022 Will Robertson, LPPL "maintainer" % Copyright 2009-2015 Khaled Hosny % Copyright 2013 Philipp Gesang diff --git a/macros/unicodetex/latex/fontspec/fontspec.pdf b/macros/unicodetex/latex/fontspec/fontspec.pdf Binary files differindex 3e223342f5..6fb58328d1 100644 --- a/macros/unicodetex/latex/fontspec/fontspec.pdf +++ b/macros/unicodetex/latex/fontspec/fontspec.pdf |