summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-01-07 22:13:27 +0000
committerKarl Berry <karl@freefriends.org>2019-01-07 22:13:27 +0000
commitbd1875cde7b10d9c50c1919729a178ffa0ca77d1 (patch)
treec39000513338bd200b3fb39221b2091798957cb5 /Master/texmf-dist/tex/luatex/luatexja/patches
parent0a0336d2291164dec0f697dc2941c1bfa06069e1 (diff)
luatexja (7jan19)
git-svn-id: svn://tug.org/texlive/trunk@49635 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty151
1 files changed, 110 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 6560f3fa3fe..515f7dfdbfb 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
@@ -3,7 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{lltjfont}[2018/10/08 Patch to NFSS2 for LuaTeX-ja]
+\ProvidesPackage{lltjfont}[2018/12/15 Patch to NFSS2 for LuaTeX-ja]
\def\ltj@chardef@text@cmd#1{%
\let\@ifdefinable\@@ifdefinable%
@@ -75,13 +75,13 @@
\fi\fi
}
-\def\ystrut{\relax\hbox{\yoko
+\def\ystrut{\relax\hbox{\ltj@@orig@yoko
\ifmmode\copy\ystrutbox\else\unhcopy\ystrutbox\fi}}
-\def\tstrut{\relax\hbox{\tate
+\def\tstrut{\relax\hbox{\ltj@@orig@tate
\ifmmode\copy\tstrutbox\else\unhcopy\tstrutbox\fi}}
-\def\dstrut{\relax\hbox{\dtou
+\def\dstrut{\relax\hbox{\ltj@@orig@dtou
\ifmmode\copy\dstrutbox\else\unhcopy\dstrutbox\fi}}
-\def\zstrut{\relax\hbox{\utod
+\def\zstrut{\relax\hbox{\ltj@@orig@utod
\ifmmode\copy\zstrutbox\else\unhcopy\zstrutbox\fi}}
{%
@@ -243,18 +243,24 @@
\gdef\f@baselineskip{#5pt}}
\@onlypreamble\DeclareKanjiSubstitution
\@onlypreamble\DeclareErrorKanjiFont
+
+\newif\ifltjselectfont@force@define
\def\DeclareFixedFont#1#2#3#4#5#6{%
\begingroup
\math@fontsfalse
\every@math@size{}%
\fontsize{#6}\z@
\directlua{luatexja.jfont.is_kyenc('\luatexluaescapestring{#2}')}\ifin@%
+ \ltjselectfont@force@definetrue
\usekanji{#2}{#3}{#4}{#5}%
\global\let#1\getjfont
+ \ltjselectfont@force@definefalse
\else
\directlua{luatexja.jfont.is_ktenc('\luatexluaescapestring{#2}')}\ifin@%
+ \ltjselectfont@force@definetrue
\usekanji{#2}{#3}{#4}{#5}%
\global\let#1\gettfont
+ \ltjselectfont@force@definefalse
\else
\useroman{#2}{#3}{#4}{#5}%
\global\expandafter\let\expandafter#1\the\font
@@ -314,6 +320,8 @@
\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
@@ -321,22 +329,26 @@
\def\ltj@selectfont@tate{%
\let\k@encoding\ct@encoding
\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
- \pickup@tfont\font@name
- \ltj@@does@alt@set{\curr@kfontshape}%
- % alt fonts の定義
- \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr@kfontshape}')}%
- % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
- \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ \pickup@tfont
+ \ifnum\ltjgetparameter{direction}=3 \font@name
+ \ltj@@does@alt@set{\curr@kfontshape}{%
+ % alt fonts の定義
+ \directlua{luatexja.jfont.output_alt_font_cmd('t', '\luatexluaescapestring{\curr@kfontshape}')}%
+ % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ }%
\fi}
\def\ltj@selectfont@yoko{%
\let\k@encoding\cy@encoding
\xdef\font@name{\csname\curr@kfontshape/\f@size\endcsname}%
- \pickup@jfont\font@name
- \ltj@@does@alt@set{\curr@kfontshape}%
- % alt fonts の定義
- \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr@kfontshape}')}%
- % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
- \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ \pickup@jfont
+ \unless\ifnum\ltjgetparameter{direction}=3 \font@name
+ \ltj@@does@alt@set{\curr@kfontshape}{%
+ % alt fonts の定義
+ \directlua{luatexja.jfont.output_alt_font_cmd('y', '\luatexluaescapestring{\curr@kfontshape}')}%
+ % 定義した alt fonts のデータを \ltjdeclarealtfont に渡すのと同等の処理をする
+ \directlua{luatexja.jfont.pickup_alt_font_a('\f@size')}%
+ }%
\fi}
\def\ltj@selectfont@patch{%
\directlua{luatexja.base.start_time_measure('selectfont')}%
@@ -354,8 +366,6 @@
\fi
\fi
\global\let\ltj@afont@name=\font@name
- %\ifnum3=\ltjgetparameter{direction}\relax \ltj@selectfont@tate
- %\else \ltj@selectfont@yoko\fi
\ltj@selectfont@tate\ltj@selectfont@yoko
%
\edef\tmp@item{{\k@encoding}}\expandafter\def\expandafter\k@encoding\tmp@item
@@ -381,6 +391,24 @@
}
\EverySelectfont{\ltj@selectfont@patch}
+\bgroup
+ \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{\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\fi}%
+ }%
+ }
+ \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}}
\def\set@fontsize#1#2#3{%
\@defaultunits\@tempdimb#2pt\relax\@nnil
@@ -394,16 +422,16 @@
\baselineskip\f@linespread\baselineskip
\normalbaselineskip\baselineskip
\adjustbaseline
- \setbox\ystrutbox\hbox{\yoko
+ \setbox\ystrutbox\hbox{\ltj@@orig@yoko
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
- \setbox\dstrutbox\hbox{\dtou
+ \setbox\dstrutbox\hbox{\ltj@@orig@dtou
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
- \setbox\tstrutbox\hbox{\tate
+ \setbox\tstrutbox\hbox{\ltj@@orig@tate
\vrule\@width\z@
\@height.5\baselineskip \@depth.5\baselineskip}%
- \setbox\zstrutbox\hbox{\utod
+ \setbox\zstrutbox\hbox{\ltj@@orig@utod
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
\let\size@update\relax}}
@@ -415,12 +443,13 @@
local t = lua.get_functions_table()
local getfont, dir_tate = font.getfont, luatexja.dir_table.dir_tate
local fmt, get_attr = luatexja.jfont.font_metric_table, tex.getattribute
+ local getcount=tex.getcount
local setdimen, set_attr = tex.setdimen, tex.setattribute
local dir = luatexja.unary_pars.direction
t[\the\ltj@@adjust@baseline@inner] = function()
local ft = fmt[get_attr('ltj@curtfnt')] or nulltable
- ft = ft and ft.char_type or nulltable
- local fk = ft and ft[0] or nulltable
+ ft = ft.char_type or nulltable
+ local fk = ft[0] or nulltable
local ht, dp, wd = fk.height or 0, fk.depth or 0,
fk.width or ft.zw or 0
local fm
@@ -430,8 +459,8 @@
tex.round(0.5*((fm.height or 0)- (fm.depth or 0) - ht+ dp)))
if dir() ~= dir_tate then
ft = fmt[get_attr('ltj@curjfnt')] or nulltable
- ft = ft and ft.char_type or nulltable
- fk = ft and ft[0] or nulltable
+ ft = ft.char_type or nulltable
+ fk = ft[0] or nulltable
ht, dp, wd = fk.height or 0, fk.depth or 0,
fk.width or ft.zw or 0
end
@@ -601,19 +630,47 @@
\let\extract@afont\extract@font
\def\pickup@jfont{%
+ \ifnum
+ \unless\ifnum\ltjgetparameter{direction}=3 1\else
+ \ifltjselectfont@force@define 1\else 0\fi\fi =1 %
\expandafter \ifx \font@name \relax
\let\extract@font\extract@jfont
\define@newfont
\let\extract@font\extract@afont
\fi
- \let\getjfont\font@name}
+ \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{%
+ \ifnum
+ \ifnum\ltjgetparameter{direction}=3 1\else
+ \ifltjselectfont@force@define 1\else 0\fi\fi =1 %
\expandafter \ifx \font@name \relax
\let\extract@font\extract@tfont
\define@newfont
\let\extract@font\extract@afont
\fi
- \let\gettfont\font@name}
+ \let\gettfont\font@name
+ \else
+ \begingroup\escapechar\m@ne
+ \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@@fontjfm/\expandafter\expandafter\expandafter\@gobble\expandafter\string\font@name\endcsname
+ \fi
+}
% 異なる和文 enc/fam/ser/shape からは異なるフォント番号が振られるように
% わざと「ゴミをつける」
@@ -621,23 +678,35 @@
#1\directlua{luatexja.jfont.print_aftl_address()}\space at%
}
\def\extract@jfont{%
- \get@external@font
- \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
+ \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}%
- \fi
- \expandafter\globaljfont\font@name\external@font\relax% ここで時間がかかる
- \font@name%\global\zw=\zw\global\zh=\zh
+ }%
+ \expandafter\globaljfont\font@name\external@font\relax\font@name% ここで時間がかかる
\csname \f@encoding+\f@family\endcsname
\csname\curr@fontshape\endcsname}
\def\extract@tfont{%
- \get@external@font
- \ltj@@does@alt@set{\f@encoding/\f@family/\f@series/\f@shape}%
+ \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}%
- \fi
- \expandafter\globaltfont\font@name\external@font\relax
- \font@name%\global\zw=\zw\global\zh=\zh
+ }%
+ \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@@fontjfm/\expandafter\string\font@name}{%
+ \directlua{%
+ luatexja.jfont.load_jfmonly('\luatexluaescapestring{\external@font}', 'tate')
+ }%
+ }}
\let\ltj@@al@do@subst@correction=\do@subst@correction
\def\ltj@@ja@do@subst@correction{%
@@ -737,8 +806,8 @@
\directlua{luatexja.jfont.pickup_alt_font_b(\the\ltj@tempcntc,'\luatexluaescapestring{#2}')}%
}
-\def\ltj@@does@alt@set#1{%
- \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}}
+\def\ltj@@does@alt@set#1#2{%
+ \directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}{#2}}
%%%% patch \@text@composite because of {y,t}albaselineshift