From: Hironori Kitagawa Date: Tue, 19 Jan 2021 20:46:52 +0000 (+0900) Subject: Use selectfont hook (LaTeX2e >=2021-05-01) if exists X-Git-Tag: 20210214.0~8 X-Git-Url: http://git.osdn.jp/view?a=commitdiff_plain;h=29b7fb601adedbd524fd68727919329981d7910a;p=luatex-ja%2Fluatexja.git Use selectfont hook (LaTeX2e >=2021-05-01) if exists --- diff --git a/src/patches/lltjfont.sty b/src/patches/lltjfont.sty index 287a396..ca4f666 100644 --- a/src/patches/lltjfont.sty +++ b/src/patches/lltjfont.sty @@ -350,18 +350,6 @@ \newif\if@knjcmd \DeclareRobustCommand\userelfont{\@knjcmdtrue} - -\RequirePackage{everysel} -\let\ltj@@EverySelectfont@Init=\@EverySelectfont@Init -\expandafter\expandafter\expandafter\let -\expandafter\expandafter\csname ltj@@orig@selectfont\endcsname\csname selectfont\space\endcsname -\@EverySelectfont@Init -%\let\ltj@@font@info\@font@info -%\let\ltj@@font@warning\@font@warning -\def\@EverySelectfont@Init{% - \expandafter\let\csname selectfont\space \endcsname \ltj@@orig@selectfont - \ltj@@EverySelectfont@Init -} \def\ltj@selectfont@tate{% \let\k@encoding\ct@encoding \xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}% @@ -386,7 +374,7 @@ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}% }% \fi} -\def\ltj@selectfont@patch{% +\protected\def\ltj@selectfont@patch{% \ltj@@start@time@measure{selectfont}% \let\tmp@error@fontshape\error@fontshape \let\error@fontshape\error@kfontshape @@ -427,7 +415,24 @@ \global\let\font@name=\ltj@afont@name \ltj@@stop@time@measure{selectfont}% } -\EverySelectfont{\ltj@selectfont@patch} +\def\@@ltj@old@selectfont@patch{% + \RequirePackage{everysel} + \let\ltj@@EverySelectfont@Init=\@EverySelectfont@Init + \expandafter\expandafter\expandafter\let + \expandafter\expandafter\csname ltj@@orig@selectfont\endcsname\csname selectfont\space\endcsname + \@EverySelectfont@Init% for LaTeX2e <=2020-10-01 + \def\@EverySelectfont@Init{% + \expandafter\let\csname selectfont\space \endcsname \ltj@@orig@selectfont + \ltj@@EverySelectfont@Init + } + \EverySelectfont{\ltj@selectfont@patch} +} +\ifltj@ltfilehook@avail + \IfHookExistsTF{selectfont}{\AddToHook{selectfont}[luatexja]{\ltj@selectfont@patch}}% LaTeX2e 2021-05-01 + {\@@ltj@old@selectfont@patch}% LaTeX2e 2020-10-01 +\else\@@ltj@old@selectfont@patch % LaTeX2e <=2020-02-02 +\fi +\let\@@ltj@old@selectfont@patch\undefined \bgroup \def\ltj@@dir@patch#1#2#3{%