X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fpatches%2Flltjfont.sty;h=43ef5593e234e179b65c498ba8e171bb77729cfd;hb=c3bc0f3aa98ff13cb5fa9392eaf58ea71012384a;hp=946d6857f26dbfdcd485466971eddd993256e30b;hpb=260a9a830c9825505e0ff04760e0a435f7aea05e;p=luatex-ja%2Fluatexja.git diff --git a/src/patches/lltjfont.sty b/src/patches/lltjfont.sty index 946d685..43ef559 100644 --- a/src/patches/lltjfont.sty +++ b/src/patches/lltjfont.sty @@ -3,7 +3,7 @@ % \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{lltjfont}[2018/10/08 Patch to NFSS2 for LuaTeX-ja] +\ProvidesPackage{lltjfont}[2019/01/29 Patch to NFSS2 for LuaTeX-ja] \def\ltj@chardef@text@cmd#1{% \let\@ifdefinable\@@ifdefinable% @@ -392,19 +392,21 @@ \EverySelectfont{\ltj@selectfont@patch} \bgroup - \def\ltj@@dir@patch#1#2{% + \def\ltj@@dir@patch#1#2#3{% \global\csletcs{ltj@@orig@#1}{#1}% \protected\expandafter\xdef\csname #1\endcsname{% \csname ltj@@orig@#1\endcsname - \unexpanded{\let\ltj@@protect\protect\set@typeset@protect}% + \unexpanded{\ifnum#3<\z@\let\ltj@@protect\protect\set@typeset@protect}% \unexpanded{\global\let\ltj@afont@name=\font@name}% \expandonce{\csname ltj@selectfont@#2\endcsname}% \unexpanded{\global\let\font@name=\ltj@afont@name}% - \unexpanded{\let\protect\ltj@@protect}% + \unexpanded{\let\protect\ltj@@protect\fi}% }% } - \ltj@@dir@patch{yoko}{yoko}\ltj@@dir@patch{tate}{tate} - \ltj@@dir@patch{utod}{yoko}\ltj@@dir@patch{dtou}{yoko} + \ltj@@dir@patch{yoko}{yoko}{\ltj@curjfnt} + \ltj@@dir@patch{tate}{tate}{\ltj@curtfnt} + \ltj@@dir@patch{utod}{yoko}{\ltj@curjfnt} + \ltj@@dir@patch{dtou}{yoko}{\ltj@curjfnt} \egroup \def\KanjiEncodingPair#1#2{\@namedef{t@enc@#1}{#2}\@namedef{y@enc@#2}{#1}} @@ -637,6 +639,15 @@ \let\extract@font\extract@afont \fi \let\getjfont\font@name + \else + \begingroup\escapechar\m@ne + \ifcsname ltj@@fontjfm/\expandafter\string\font@name\endcsname\else + \let\extract@font\extract@jfont@onlyjfm + \define@newfont + \let\extract@font\extract@afont + \fi + \endgroup + \csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font@name\endcsname \fi } \def\pickup@tfont{% @@ -651,24 +662,34 @@ \let\gettfont\font@name \else \begingroup\escapechar\m@ne - \ifcsname ltj@@tfontjfm/\expandafter\string\font@name\endcsname\else + \ifcsname ltj@@fontjfm/\expandafter\string\font@name\endcsname\else \let\extract@font\extract@tfont@onlyjfm \define@newfont \let\extract@font\extract@afont - \fi\endgroup - \csname ltj@@tfontjfm/\string\font@name\endcsname + \fi + \endgroup + \csname ltj@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font@name\endcsname \fi } % 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように % わざと「ゴミをつける」 \def\ltj@@patch@external@font#1 at{% - #1\directlua{luatexja.jfont.print_aftl_address()}\space at% + \directlua{ + local s = '\luatexluaescapestring{#1}' + local is_braced, is_quoted + if s:sub(1,1)=='{' and s:sub(-1)=='}' then is_braced=true; s=s:sub(2,-2) end + if s:sub(1,1)=='"' and s:sub(-1)=='"' then is_quoted=true; s=s:sub(2,-2) end + s=s..luatexja.jfont.print_aftl_address() + if is_braced then s='{'..s..'}' elseif is_quoted then s='"'..s..'"' end + %print(s, is_quoted, is_braced) + tex.sprint(-2, s)}% + \space at% } \def\extract@jfont{% \get@external@font \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}{% - \edef\external@font{\expandafter\ltj@@patch@external@font\external@font}% + \edef\external@font{\expandafter\ltj@@patch@external@font\romannumeral-`0\external@font}% }% \expandafter\globaljfont\font@name\external@font\relax\font@name% ここで時間がかかる \csname \f@encoding+\f@family\endcsname @@ -681,14 +702,20 @@ \expandafter\globaltfont\font@name\external@font\relax\font@name \csname \f@encoding+\f@family\endcsname \csname\curr@fontshape\endcsname} +\def\extract@jfont@onlyjfm{% + \get@external@font + \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{% + \directlua{% + luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'yoko') + }% + }} \def\extract@tfont@onlyjfm{% \get@external@font - \csxdef{ltj@@tfontjfm/\expandafter\string\font@name}{% + \csxdef{ltj@@fontjfm/\expandafter\string\font@name}{% \directlua{% - luatexja.jfont.load_tfont_jfmonly('\luatexluaescapestring{\external@font}') + luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'tate') }% - }% -} + }} \let\ltj@@al@do@subst@correction=\do@subst@correction \def\ltj@@ja@do@subst@correction{% @@ -716,12 +743,15 @@ \let\ltj@@al@getanddefine@fonts=\getanddefine@fonts \def\ltj@@ja@getanddefine@fonts#1#2{% + \csletcs{if@ltj@tempif}{ifltjselectfont@force@define} + \ltjselectfont@force@definetrue \xdef\font@name{\csname \string#2/\tf@size\endcsname}% \pickup@jfont\let\textfont@name\font@name \xdef\font@name{\csname \string#2/\sf@size\endcsname}% \pickup@jfont\let\scriptfont@name\font@name \xdef\font@name{\csname \string#2/\ssf@size\endcsname}% \pickup@jfont + \csletcs{ifltjselectfont@force@define}{if@ltj@tempif} \edef\math@fonts{\math@fonts\ltj@setpar@global% \ltj@@set@stackfont#1,\textfont@name:{MJT}% \ltj@@set@stackfont#1,\scriptfont@name:{MJS}%