diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty |
Initial commit
Diffstat (limited to 'macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty')
-rw-r--r-- | macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty b/macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty new file mode 100644 index 0000000000..d8c4055d14 --- /dev/null +++ b/macros/luatex/generic/luatexja/src/patches/lltjp-unicode-math.sty @@ -0,0 +1,87 @@ +% +% lltjp-unicode-math.sty 2018-10-09 +% + +\NeedsTeXFormat{LaTeX2e} + +\RequirePackage{unicode-math,etoolbox} + +\ExplSyntaxOn + +\cs_set:Nn \__um_define_math_chars: { + \group_begin: + \cs_set:Npn \__um_sym:nnn ##1##2##3 + { + \ltjsetmathletter{ ##1 } + \tl_if_in:nnT + { \mathord \mathalpha \mathbin \mathrel \mathpunct \mathop \mathfence } + {##3} + { + \exp_last_unbraced:NNx \cs_gset_eq:NN ##2 { \char_generate:nn {##1} {12} } + } + } + \__um_input_math_symbol_table: + \group_end: +} +\unless\ifltj@disablejfam +\cs_set:Npn \use@mathgroup #1 #2 +{ + %\typeout{UM <#1><#2>} + \mode_if_math:T % <- not sure + { + \math@bgroup + \cs_if_eq:cNF {M@\f@encoding} #1 {#1} + \__um_switchto_literal: + \ltj@tempcnta=#2 \expandafter\ltj@@mathJapaneseFonts\string#1\relax% + \ifin@ \jfam #2 \relax \else \mathgroup #2 \relax \fi + \math@egroup + } +} +\fi + +\ifcsname jsc@mag@xrealtrue \endcsname \else + \expandafter\expandafter\expandafter \ExplSyntaxOff \expandafter \endinput +\fi +\ifjsc@mag@xreal + \cs_if_exist:cTF { ltjs@orig@get@external@font } { + % ltjsclasses: use lua + \cs_new:Nn \lltjp_um_unmag_fsize: + { + \cs_gset:Nx \lltjp_um_f@size: {\directlua{luatexja.ltjs_unmagnify_fsize(\f@size)}} + \cs_gset:Nx \lltjp_um_sf@size: {\directlua{luatexja.ltjs_unmagnify_fsize(\sf@size)}} + \cs_gset:Nx \lltjp_um_ssf@size: {\directlua{luatexja.ltjs_unmagnify_fsize(\ssf@size)}} + } + }{ + % bxjscls: use \jsc@preadjust@extract@font + \cs_new:Nn \lltjp_um_unmag_fsize: + { + \group_begin: + \jsc@preadjust@extract@font + \cs_gset_eq:NN \lltjp_um_f@size: \f@size + \group_end: + \group_begin: + \cs_set_eq:NN \f@size \sf@size \jsc@preadjust@extract@font + \cs_gset_eq:NN \lltjp_um_sf@size: \f@size + \group_end: + \group_begin: + \cs_set_eq:NN \f@size \ssf@size \jsc@preadjust@extract@font + \cs_gset_eq:NN \lltjp_um_ssf@size: \f@size + \group_end: + } + } + \pretocmd { \__um_fontspec_select_font: } { + \cs_set_eq:NN \lltjp_um_orig_fsize: \f@size + \lltjp_um_unmag_fsize: + \cs_set_eq:NN \f@size \lltjp_um_f@size: + \cs_set_eq:NN \tf@size \lltjp_um_f@size: + \cs_set_eq:NN \sf@size \lltjp_um_sf@size: + \cs_set_eq:NN \ssf@size \lltjp_um_ssf@size: + } {} {} + \apptocmd { \__um_fontspec_select_font: } { + \cs_set_eq:NN \f@size \lltjp_um_orig_fsize: + } {} {} +\fi + +\ExplSyntaxOff + +\endinput |