summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty51
1 files changed, 45 insertions, 6 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 4855f503306..08f9b7ff027 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}[2015/08/28 Patch to NFSS2 for LuaTeX-ja]
+\ProvidesPackage{lltjfont}[2016/02/07 Patch to NFSS2 for LuaTeX-ja]
\let\k@encoding\@empty
\let\ck@encoding\@empty
@@ -365,10 +365,47 @@
\vrule\@width\z@
\@height.7\baselineskip \@depth.3\baselineskip}%
\let\size@update\relax}}
-\newbox\adjust@box
-\newbox\adjust@box@aux
-\newdimen\adjust@dimen
-\def\adjustbaseline{%
+
+\ifdefined\newluafunction
+ \newluafunction\ltj@@adjust@baseline@inner
+ \begingroup\catcode`\~=12
+ \directlua{%
+ local nulltable = {}
+ 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 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
+ local ht, dp, wd = fk.height or 0, fk.depth or 0,
+ fk.width or ft.zw or 0
+ local fm
+ = ((getfont(font.current()) or nulltable)
+ .characters or nulltable)[77] or nulltable %% 'M'
+ set_attr('ltj@tablshift',
+ 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
+ ht, dp, wd = fk.height or 0, fk.depth or 0,
+ fk.width or ft.zw or 0
+ end
+ setdimen('cht', ht); setdimen('cdp', dp)
+ setdimen('cwd', wd); setdimen('chs', wd)
+ setdimen('cHT', ht+dp)
+ end
+ }\endgroup
+ \def\adjustbaseline{\luafunction\ltj@@adjust@baseline@inner
+ \cvs\normalbaselineskip}
+\else
+ \newbox\adjust@box
+ \newbox\adjust@box@aux
+ \newdimen\adjust@dimen
+ \def\adjustbaseline{%
\setbox\adjust@box\hbox{%
\ltj@ykblshift\z@\ltj@tkblshift\z@ 漢}%
\cht\ht\adjust@box
@@ -385,7 +422,9 @@
\divide\adjust@dimen\tw@
\advance\adjust@dimen0.5\dp\adjust@box@aux
\advance\adjust@dimen-\dp\adjust@box
- \ltj@tablshift=\adjust@dimen}
+ \ltj@tablshift=\adjust@dimen
+ }
+\fi
\DeclareRobustCommand\romanencoding[1]{%
\expandafter\ifx\csname T@#1\endcsname\relax
\@latex@error{Encoding scheme `#1' unknown}\@eha