summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-06-18 22:07:21 +0000
committerKarl Berry <karl@freefriends.org>2016-06-18 22:07:21 +0000
commitd86d22e6f60a5ac70e824193345eaa0e344614e1 (patch)
tree65481d18fd1548f6d8f87534884be77332e344d9 /Master/texmf-dist/tex/luatex
parentaf496ee64508a29d6b74bae6034e7f6dc36842d0 (diff)
luatexja (18jun16)
git-svn-id: svn://tug.org/texlive/trunk@41489 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/luatex')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua27
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua7
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty1
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/luatexja.lua22
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty70
6 files changed, 93 insertions, 36 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua
index bc8ac9d6795..a4c1d681cc5 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-compat.lua
@@ -110,7 +110,7 @@ local function from_sjis(i)
if c1>0x7f then i=0x40 else i=0x3f end
c1 = c1 - i
else
- c1 = c1 - 0x7e
+ c1 = c1 - 0x9e
end
from_kuten(c2*256+c1)
end
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
index c54842a86b6..970a3f75972 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua
@@ -168,6 +168,8 @@ do
end
end
end
+ local node_next_node, node_tail_node = node.next, node.tail
+ local insert_after_node = node.insert_after
function luatexja.direction.set_list_direction_hook(v)
local lv = tex_nest.ptr -- must be >= 1
if not v then
@@ -178,10 +180,12 @@ do
elseif v=='adj' then
v = get_adjust_dir_count()
end
- local h = to_direct(tex_nest[lv].head)
- local w = dir_pool[v]()
- insert_after(h, h, w)
- tex_nest[lv].tail = to_node(node_tail(w))
+ local h = tex_nest[lv].head
+ local hn = node.next(h)
+ hn = (hn and hn.id==id_local) and hn or h
+ local w = to_node(dir_pool[v]())
+ insert_after_node(h, hn, w)
+ tex_nest[lv].tail = node_tail_node(w)
ensure_tex_attr(attr_icflag, 0)
ensure_tex_attr(attr_dir, 0)
end
@@ -203,7 +207,7 @@ do
"To change direction in an align, \n"
.. "you shold use \\hbox or \\vbox.")
else
- local h = (lv==0) and tex.lists.page_head or tex_nest[lv].head.next
+ local h = (lv==0) and tex.lists.page_head or tex_nest[lv].head.next
local flag,w = test_list(h,lv)
if flag==0 then
if lv==0 and not page_direction then
@@ -218,8 +222,15 @@ do
elseif flag==1 then
node_set_attr(w, attr_dir, v)
if lv==0 then page_direction = v end
- else
- if lv==0 then page_direction = v end
+ elseif lv==0 then
+ page_direction = v
+ else -- flag == 2: need to create dir whatsit.
+ local h = tex_nest[lv].head
+ local hn = node.next(h)
+ hn = (hn and hn.id==id_local) and hn or h
+ local w = to_node(dir_pool[v]())
+ insert_after_node(h,hn,w)
+ tex_nest[lv].tail = node_tail_node(w)
end
ensure_tex_attr(attr_icflag, 0)
end
@@ -234,7 +245,7 @@ local function create_dir_whatsit(hd, gc, new_dir)
getsubtype(hd)==sid_user and getfield(hd, 'user_id')==DIR then
set_attr(hd, attr_icflag,
get_attr_icflag(hd) + PROCESSED_BEGIN_FLAG)
- local n = node_next(hd)
+ local n =node_next(hd)
if n then
set_attr(n, attr_icflag,
get_attr_icflag(n) + PROCESSED_BEGIN_FLAG)
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
index 1a3a9759ba6..34472a261c2 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
@@ -122,7 +122,6 @@ end
local function skip_table_to_glue(n)
local g, st = node_new(id_glue), ltjs.fast_get_stack_skip(n)
setglue(g, st.width, st.stretch, st.shrink, st.stretch_order, st.shrink_order)
- -- luatexja.ext_show_node(to_node(g), 'sg ',print)
return g, (st.width==1073741823)
end
@@ -302,7 +301,7 @@ end
local ltjw_apply_ashift_math = ltjw.apply_ashift_math
local ltjw_apply_ashift_disc = ltjw.apply_ashift_disc
local min, max = math.min, math.max
-local function calc_np_aux_glyph_common(lp)
+local function calc_np_aux_glyph_common(lp, acc_flag)
Np.nuc = lp
Np.first= (Np.first or lp)
if getfield(lp, 'lang') == lang_ja then
@@ -380,7 +379,7 @@ local function calc_np_aux_glyph_common(lp)
node_free(r)
elseif (ct.left_protruding or 0) == 0 then
head = insert_before(head, npn, r)
- Np.first = (Np.first==npn) and r or npn
+ Np.first = acc_flag and Np.first or ((Np.first==npn) and r or npn)
elseif (ct.right_protruding or 0) == 0 then
insert_after(head, npn, r); Np.last, lp = r, r
else
@@ -490,7 +489,7 @@ local calc_np_auxtable = {
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED); lp = node_next(lp)
set_attr(lp, attr_icflag, PROCESSED);
- return calc_np_aux_glyph_common(lp)
+ return calc_np_aux_glyph_common(lp, true)
else
Np.first = Np.first or lp
Np.id = id_kern; set_attr(lp, attr_icflag, PROCESSED)
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
index f6d0e86711d..0d01f104d1e 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty
@@ -758,6 +758,7 @@
\protected\def\ltjsetht{\directlua{luatexja.direction.set_box_dim('height')}}
\protected\def\ltjsetdp{\directlua{luatexja.direction.set_box_dim('depth')}}
+
%%------------------ Load module for the format
\ifltj@in@latex %<*LaTeX>
diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
index 370141a85e7..2cf00758fcf 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua
@@ -230,8 +230,8 @@ end
do
luatexja.binary_pars = {
jacharrange = function(c, t)
- if type(c)~='number' or c<0 or c>31*ltjc.ATTR_RANGE then
- -- 0 はエラーにしない(隠し)
+ if type(c)~='number' or c<-1 or c>31*ltjc.ATTR_RANGE then
+ -- 0, -1 はエラーにしない(隠し)
ltjb.package_error('luatexja',
'invalid character range number (' .. tostring(c) .. ')',
'A character range number should be in the range 1..'
@@ -344,6 +344,24 @@ function luatexja.ext_cleanup()
end
+-- lastnodechar
+do
+ local id_glyph = node.id('glyph')
+ function luatexja.pltx_composite_last_node_char()
+ local n = tex.nest[tex.nest.ptr].tail
+ local r = '-1'
+ if n then
+ if n.id==id_glyph then
+ while n.componetns and n.subtype and n.subtype%4 >= 2 do
+ n = node.tail(n)
+ end
+ r = tostring(n.char)
+ end
+ end
+ tex.sprint(r)
+ end
+end
+
-- debug
do
diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
index 738e192004f..1b95d95a4c5 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjfont.sty
@@ -724,29 +724,57 @@
\directlua{luatexja.jfont.does_alt_set'\luatexluaescapestring{#1}'}}
%%%% patch \@text@composite because of {y,t}albaselineshift
-\def\@text@composite#1#2#3#{%
- \begingroup
- \setbox\z@=\hbox\bgroup%
- \ltj@yablshift\z@\ltj@tablshift\z@
- \expandafter\@text@composite@x
- \csname\string#1-\string#2\endcsname}
+
+%% \pltx@isletter from plfonts.dtx
+\def\pltx@mark{\pltx@mark@}
+\let\pltx@scanstop\relax
+\long\def\pltx@cond#1\fi{%
+ #1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}
+\long\def\pltx@isletter#1{%
+ \expandafter\pltx@isletter@i\romannumeral-`0#1\pltx@scanstop}
+\long\def\pltx@isletter@i#1\pltx@scanstop{%
+ \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi{\@firstoftwo}%
+ {\pltx@isletter@ii\pltx@scanstop#1\pltx@scanstop{}#1\pltx@mark}}
+\long\def\pltx@isletter@ii#1\pltx@scanstop#{%
+ \pltx@cond\ifx\pltx@mark#1\pltx@mark\fi%
+ {\pltx@isletter@iii}{\pltx@isletter@iv}}
+\long\def\pltx@isletter@iii#1\pltx@mark{\@secondoftwo}
+\long\def\pltx@isletter@iv#1#2#3\pltx@mark{%
+ \pltx@cond\ifx\pltx@mark#3\pltx@mark\fi{%
+ \pltx@cond{\ifnum0\ifcat A\noexpand#21\fi\ifcat=\noexpand#21\fi>\z@}\fi
+ {\@firstoftwo}{\@secondoftwo}%
+ }{\@secondoftwo}}
+
\def\@text@composite@x#1#2{%
\ifx#1\relax
- \expandafter\@secondoftwo
- \else
- \expandafter\@firstoftwo
- \fi
- #1{#2}\egroup
- \leavevmode
- \expandafter\lower
- \ifnum\ltjgetparameter{direction}=3
- \ltjgetparameter{talbaselineshift}
- \else\ifmmode
- \z@
+ #2%
+ \else\pltx@isletter{#1}{#1}{%
+ \begingroup
+ \setbox\z@\hbox\bgroup%
+ \ltj@yablshift\z@ \ltj@tablshift\z@
+ #1%
+ \@tempcntb\directlua{luatexja.pltx_composite_last_node_char()}%)
+ \xdef\pltx@composite@temp{\noexpand\@tempcntb=\the\@tempcntb\relax}%
+ \aftergroup\pltx@composite@temp
+ \egroup
+ \ifnum\ltjgetparameter{direction}=3 %
+ \@tempdima=\ltj@tablshift sp\else\@tempdima=\ltj@yablshift sp\fi
+ \ifnum\@tempcntb<\z@\@tempcnta\z@\else
+ \@tempcnta=\ltjgetparameter{jacharrange}{\ltjgetparameter{chartorange}{\@tempcntb}}\relax
+ \ifnum\@tempcnta=\z@\@tempdima\z@\fi
+ \fi
+ \ifnum\@tempcnta>\z@
+ \ifodd\ltjgetparameter{alxspmode}{\@tempcntb}\else\leavevmode\hbox{}\fi
+ \begingroup\mathsurround\z@$%
+ \hbox{\lower\@tempdima\box\z@}
+ $\endgroup%
+ \ifnum\ltjgetparameter{alxspmode}{\@tempcntb}<2\hbox{}\fi
\else
- \ltjgetparameter{yalbaselineshift}
- \fi\fi
- \box\z@
- \endgroup}
+ \ifdim\@tempdima=\z@{\ltj@yablshift\z@ \ltj@tablshift\z@#1}%
+ \else\lower\@tempdima\box\z@\fi
+ \fi
+ \endgroup}%
+ \fi
+}
\endinput