diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-15 22:23:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-15 22:23:04 +0000 |
commit | b12bc2332f229d9a6b10ce0e6ae81cd2870d644d (patch) | |
tree | 8efe6d848317f5b0b179949e8c8eae42e5b7ec11 /Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx | |
parent | c8f41ea19d9e98226e6da3d4544f848440659030 (diff) |
unicode-math (15feb19)
git-svn-id: svn://tug.org/texlive/trunk@50032 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx | 94 |
1 files changed, 41 insertions, 53 deletions
diff --git a/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx b/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx index 907556283fb..aec2eb3d5a0 100644 --- a/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx +++ b/Master/texmf-dist/source/latex/unicode-math/um-code-main.dtx @@ -11,7 +11,7 @@ % \darg{keyval options} % \darg{font name/file} % \begin{macrocode} -\cs_set:Nn \@@_setmathfont:nn +\@@_cs_new:Nn \@@_setmathfont:nn { % \end{macrocode} % \begin{itemize} @@ -35,14 +35,12 @@ \keys_set_known:nnN {unicode-math} {#1} \l_@@_unknown_keys_clist - \bool_if:NT \l_@@_init_bool - { - \@@_fontspec_trial_font: - \@@_declare_math_sizes: - } + \bool_if:NT \g_@@_init_bool \@@_fontspec_trial_font: + \bool_if:NT \g_@@_init_bool \@@_declare_math_sizes: + \@@_fontspec_select_font: \@@_setup_math_fam: - \bool_if:NT \l_@@_init_bool + \bool_if:NT \g_@@_init_bool { \@@_setup_legacy_fam_two: \@@_setup_legacy_fam_three: @@ -60,7 +58,7 @@ % this is an extensive part of the code; see Section~\ref{sec:mathmap}; % \end{itemize} % \begin{macrocode} - \bool_if:NT \l_@@_init_bool \@@_onceoff_setup: + \bool_if:NT \g_@@_init_bool \@@_onceoff_setup: \@@_remap_symbols: \@@_setup_mathactives: \@@_setup_delcodes: @@ -68,7 +66,7 @@ %% TODO: what of the above should only be run for the "default"/"main" font? - \bool_if:NTF \l_@@_init_bool + \bool_if:NTF \g_@@_init_bool { \bool_gset_true:N \g_@@_main_font_defined_bool %<LU> \@@_mathparam_store: @@ -87,16 +85,10 @@ % This needs to happen early so that all of the font-loading machinery executes before % the other `AtBeginDocument' code. % \begin{macrocode} -\AtBeginDocument { \@@_load_lm_if_necessary: } -\cs_new:Nn \@@_load_lm_if_necessary: +\AtBeginDocument { \bool_if:NF \g_@@_main_font_defined_bool \@@_load_lm: } +\@@_cs_new:Nn \@@_load_lm: { - \bool_if:NF \g_@@_main_font_defined_bool - { -%<debug>\typeout{SETTING~ DEFAULT~ FONT~(latinmodern-math)} - \setmathfont{latinmodern-math.otf} - [BoldFont={latinmodern-math.otf}] -%<debug>\typeout{END~ DEFAULT~ FONT)} - } + \setmathfont{latinmodern-math.otf}[BoldFont={latinmodern-math.otf}] } % \end{macrocode} % @@ -104,7 +96,7 @@ % Reset local variables. % Default to defining the font for every math symbol character. % \begin{macrocode} -\cs_new:Nn \@@_init:n +\@@_cs_new:Nn \@@_init:n { \tl_set:Nn \l_@@_fontname_tl {#1} \bool_gset_true:N \g_@@_ot_math_bool @@ -116,7 +108,7 @@ \tl_set_eq:NN \l_@@_script_font_tl \l_@@_fontname_tl \tl_set_eq:NN \l_@@_sscript_font_tl \l_@@_fontname_tl - \bool_set_true:N \l_@@_init_bool + \bool_gset_true:N \g_@@_init_bool \seq_gclear:N \g_@@_char_range_seq \clist_clear:N \l_@@_mathmap_charints_clist \seq_gclear:N \g_@@_mathalph_seq @@ -135,13 +127,13 @@ % Set the math sizes according to the recommended font parameters. % \begin{macrocode} \tl_new:N \g_@@_main_font_cmd_tl -\cs_new:Nn \@@_declare_math_sizes: +\cs_new:Nn \@@_sf_size: { \@@_fontdimen_to_scale:nN {10} \g_@@_trial_font } +\cs_new:Nn \@@_ssf_size: { \@@_fontdimen_to_scale:nN {11} \g_@@_trial_font } +\@@_cs_new:Nn \@@_declare_math_sizes: { \dim_compare:nF { \fontdimen 10 \g_@@_trial_font == 0pt } { - \DeclareMathSizes { \f@size } { \f@size } - { \@@_fontdimen_to_scale:nN {10} \g_@@_trial_font } - { \@@_fontdimen_to_scale:nN {11} \g_@@_trial_font } + \DeclareMathSizes { \f@size } { \f@size } { \@@_sf_size: } { \@@_ssf_size: } } } % \end{macrocode} @@ -151,12 +143,12 @@ % % \begin{macro}{\@@_fontspec_trial_font:} % \begin{macrocode} -\cs_new:Nn \@@_fontspec_trial_font: +\@@_cs_new:Nn \@@_fontspec_trial_font: { \tl_set:Nx \l_@@_font_keyval_tl { %<LU> Renderer = Basic, - BoldItalicFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, Script = Math, %<LU> FontAdjustment = { \@@_luatex_copy_fontdimens: }, \l_@@_unknown_keys_clist @@ -169,6 +161,7 @@ \exp_last_unbraced:NNo \@@_fontface_gset_eq:NN \g_@@_trial_font \font@name \fontspec_if_script:nF {math} { + \@@_warning:n {not-ot-math} \bool_gset_false:N \g_@@_ot_math_bool \bool_gset_false:N \g_@@_init_bool } @@ -180,15 +173,15 @@ % % \begin{macro}{\@@_fontspec_select_font:} % \begin{macrocode} -\cs_new:Nn \@@_fontspec_select_font: +\@@_cs_new:Nn \@@_fontspec_select_font: { - \fp_gset:Nn \g_@@_size_tfsf_fp { (\f@size +\sf@size )/2 } - \fp_gset:Nn \g_@@_size_sfssf_fp { (\sf@size+\ssf@size)/2 } + \fp_gset:Nn \g_@@_size_tfsf_fp { (\f@size + \@@_sf_size: )/2 } + \fp_gset:Nn \g_@@_size_sfssf_fp { (\@@_sf_size: + \@@_ssf_size:)/2 } \tl_set:Nx \l_@@_font_keyval_tl { %<LU> Renderer = Basic, - BoldItalicFont = {}, ItalicFont = {}, + BoldItalicFont = {}, ItalicFont = {}, SmallCapsFont = {}, Script = Math, SizeFeatures = { @@ -217,15 +210,10 @@ \fontfamily { \l_@@_family_tl } \selectfont \exp_last_unbraced:Nno \@@_fontface_gset_eq:cN {g_@@_mathfont_ \int_use:N \g_@@_fonts_used_int _font} \font@name \tl_gset:Nx \g_@@_curr_font_cmd_tl { \exp_not:c {g_@@_mathfont_ \int_use:N \g_@@_fonts_used_int _font} } - \bool_if:NT \l_@@_init_bool + \bool_if:NT \g_@@_init_bool { \exp_last_unbraced:NNo \@@_fontface_gset_eq:NN \l_@@_font \font@name } - \fontspec_if_script:nF {math} - { - \bool_gset_false:N \g_@@_ot_math_bool - \bool_gset_false:N \g_@@_init_bool - } \group_end: } % \end{macrocode} @@ -244,7 +232,7 @@ % might change the math params, which wouldn't be reflected in the fontdimens. % \begin{macrocode} %<*LU> -\cs_new_protected:Nn \@@_luatex_copy_fontdimens: +\@@_cs_new:Nn \@@_luatex_copy_fontdimens: { \@@_fontdimen_from_param:nn {10} {ScriptPercentScaleDown} \@@_fontdimen_from_param:nn {11} {ScriptScriptPercentScaleDown} @@ -271,7 +259,7 @@ % % \begin{macro}{\@@_setup_math_fam:} % \begin{macrocode} -\cs_new:Nn \@@_setup_math_fam: +\@@_cs_new:Nn \@@_setup_math_fam: { \cs_if_exist:cF { sym \l_@@_symfont_label_tl } { @@ -283,7 +271,7 @@ % \end{macrocode} % Set the bold math version. % \begin{macrocode} - \str_if_eq_x:nnT {\l_@@_mversion_tl} {normal} + \str_if_eq:eeT {\l_@@_mversion_tl} {normal} { \SetSymbolFont{\l_@@_symfont_label_tl}{bold} {\encodingdefault}{\l_@@_family_tl}{\bfdefault}{\updefault} @@ -295,12 +283,12 @@ % \begin{macro}{\@@_setup_legacy_fam_two:} % \TeX\ won't load the same font twice at the same scale, so we need to magnify this one by an imperceptable amount. % \begin{macrocode} -\cs_new:Nn \@@_setup_legacy_fam_two: +\@@_cs_new:Nn \@@_setup_legacy_fam_two: { \fontspec_set_family:Nxn \l_@@_fam_two_tl { \l_@@_font_keyval_tl, - Scale=1.00001, + ScaleAgain = 1.00001, FontAdjustment = { \@@_copy_fontdimen:nnN { 8} {43} \g_@@_main_font_cmd_tl @@ -324,7 +312,7 @@ \SetSymbolFont{symbols}{\l_@@_mversion_tl} {\encodingdefault}{\l_@@_fam_two_tl}{\mddefault}{\updefault} - \str_if_eq_x:nnT {\l_@@_mversion_tl} {normal} + \str_if_eq:eeT {\l_@@_mversion_tl} {normal} { \SetSymbolFont{symbols}{bold} {\encodingdefault}{\l_@@_fam_two_tl}{\bfdefault}{\updefault} @@ -336,12 +324,12 @@ % \begin{macro}{\@@_setup_legacy_fam_three:} % Similarly, this font is shrunk by an imperceptable amount for \TeX\ to load it again. % \begin{macrocode} -\cs_new:Nn \@@_setup_legacy_fam_three: +\@@_cs_new:Nn \@@_setup_legacy_fam_three: { \fontspec_set_family:Nxn \l_@@_fam_three_tl { \l_@@_font_keyval_tl, - Scale=0.99999, + ScaleAgain = 0.99999, FontAdjustment = { \@@_copy_fontdimen:nnN { 8} {48} \g_@@_main_font_cmd_tl \@@_copy_fontdimen:nnN { 9} {28} \g_@@_main_font_cmd_tl @@ -355,7 +343,7 @@ \SetSymbolFont{largesymbols}{\l_@@_mversion_tl} {\encodingdefault}{\l_@@_fam_three_tl}{\mddefault}{\updefault} - \str_if_eq_x:nnT {\l_@@_mversion_tl} {normal} + \str_if_eq:eeT {\l_@@_mversion_tl} {normal} { \SetSymbolFont{largesymbols}{bold} {\encodingdefault}{\l_@@_fam_three_tl}{\bfdefault}{\updefault} @@ -366,9 +354,9 @@ % % \begin{macro}{\@@_onceoff_setup:} % \begin{macrocode} -\cs_new:Nn \@@_onceoff_setup: +\@@_cs_new:Nn \@@_onceoff_setup: { - \@@_set_delcode:nnn {operators} {`\.} {\c_zero} + \@@_set_delcode:nnn {operators} {`\.} {0} } % \end{macrocode} % \end{macro} @@ -403,7 +391,7 @@ % This function is used to define the mathcodes for those chars which should % be mapped to a different glyph than themselves. % \begin{macrocode} -\cs_new:Nn \@@_remap_symbols: +\@@_cs_new:Nn \@@_remap_symbols: { \@@_remap_symbol:nnn {`\-} {\mathbin} {"2212} \@@_remap_symbol:nnn {`\*} {\mathbin} {"02217}% text asterisk to "centred asterisk" @@ -443,7 +431,7 @@ % TODO: if not an OpenType math font, we should ignore doing anything with primes. % This needs a revamped `range` feature, I think. % \begin{macrocode} -\cs_new:Npn \@@_setup_mathactives: +\@@_cs_new:Nn \@@_setup_mathactives: { \@@_make_mathactive:nNN {"2032} \@@_prime_single_mchar \mathord \@@_make_mathactive:nNN {"2033} \@@_prime_double_mchar \mathord @@ -514,7 +502,7 @@ % On the other hand, many fonts won't support them all being stretchy. % And some of them are probably not meant to stretch, either. But adding them here doesn't hurt. % \begin{macrocode} -\cs_new:Npn \@@_setup_delcodes: +\@@_cs_new:Nn \@@_setup_delcodes: { \@@_assign_delcode:nn {`\/} {\g_@@_slash_delimiter_usv} \@@_assign_delcode:nn {"2044} {\g_@@_slash_delimiter_usv} % fracslash @@ -605,7 +593,7 @@ % If the maths font were to be loaded later it would clobber our mathparam settings, so % this seems like a sensible move. % \begin{macrocode} -\cs_set:Nn \@@_mathparam_restore: +\@@_cs_new:Nn \@@_mathparam_restore: { \glb@settings \tl_use:N \g_@@_mathparam_settings_tl @@ -617,7 +605,7 @@ % \cs{glb@settings} is called to force maths fonts loading \emph{now} so the mathparams % are up-to-date. % \begin{macrocode} -\cs_set:Nn \@@_mathparam_store: +\@@_cs_new:Nn \@@_mathparam_store: { \glb@settings \tl_gset:Nx \g_@@_mathparam_settings_tl @@ -701,7 +689,7 @@ % the conditions of the LaTeX Project Public License, version 1.3c or higher % (your choice): <http://www.latex-project.org/lppl/>. % ------------------------------------------------ -% Copyright 2006-2018 Will Robertson, LPPL "maintainer" +% Copyright 2006-2019 Will Robertson, LPPL "maintainer" % Copyright 2010-2017 Philipp Stephani % Copyright 2011-2017 Joseph Wright % Copyright 2012-2015 Khaled Hosny |