summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-09-07 01:48:55 +0000
committerKarl Berry <karl@freefriends.org>2014-09-07 01:48:55 +0000
commit35d45ab2551e2abe29f6f9c61bbb43bf1507a255 (patch)
treed8c9f1e4c63f849a69efc2a4eede9e4515065532 /Master/texmf-dist/tex
parentdcab4e9ed6f42f12615b9026353870a071b4f9b1 (diff)
luatexja (6sep14)
git-svn-id: svn://tug.org/texlive/trunk@35119 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty5
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua6
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua2
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua45
5 files changed, 43 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
index 57e58947418..1f73ea1b733 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
+++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty
@@ -146,7 +146,10 @@
%%%%%%%% TeX command
\protected\def\ltjruby{\@ifnextchar[\ltj@@ruby{\ltj@@ruby[]}}%]
-\AtBeginDocument{\ifdefined\ruby\else\let\ruby=\ltjruby\fi}
+\AtBeginDocument{%
+ \ifdefined\ruby\else\let\ruby=\ltjruby\fi
+ \directlua{luatexja.ruby.read_old_break_info()}%
+}
\def\ltj@@ruby[#1]#2#3{{% #1: option #2: 親文字群,#3: ルビ文字列群,共に| 区切り
\setkeys[ltj]{ruby}{#1}%
\directlua{ruby_tmplist_r = \string{\string}; ruby_tmplist_p = \string{\string}}%
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
index 5406399613d..6a5a300986e 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua
@@ -82,12 +82,14 @@ local function get_stretched(q, go, gs)
local qs = getfield(q, 'spec')
if not getfield(qs, 'writable') then return 0 end
if gs == 1 then -- stretching
- if getfield(qs, 'stretch_order') == go then
- return getfield(qs, 'stretch')
+ if getfield(qs, 'stretch_order') == go then
+ return getfield(qs, 'stretch')
+ else return 0
end
else -- shrinking
if getfield(qs, 'shrink_order') == go then
return getfield(qs, 'shrink')
+ else return 0
end
end
end
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
index 9486c322ca6..9840da825bb 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua
@@ -534,7 +534,7 @@ end
local function handle_penalty_always(post, pre, g)
local a = (pre or 0) + (post or 0)
if #Bp == 0 then
- if not (g and getid(g)==id_glue) then
+ if not (g and getid(g)==id_glue) or a~=0 then
local p = node_new(id_penalty)
if a<-10000 then a = -10000 elseif a>10000 then a = 10000 end
setfield(p, 'penalty', a)
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
index b81c269ab43..23b7e962dd6 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-rmlgbm.lua
@@ -206,7 +206,7 @@ end
local definers = fonts.definers
local function mk_rml(name, size, id)
local specification = definers.analyze(name,size)
- specification = definers.resolve(specification)
+ --specification = definers.resolve(specification) (not needed)
specification.detail = specification.detail or ''
local fontdata = {}
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
index a84256cd45f..145f332af60 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua
@@ -125,6 +125,15 @@ end
-- 実行回数 + ルビ中身 から uniq_id を作る関数
old_break_info = {} -- public, 前 run 時の分割情報
+local cache_handle
+function read_old_break_info()
+ if tex.jobname then
+ local fname = tex.jobname .. '.ltjruby'
+ local real_file = kpse.find_file(fname)
+ if real_file then dofile(real_file) end
+ cache_handle = io.open(fname, 'w')
+ end
+end
local make_uniq_id
do
local exec_count = 0
@@ -477,6 +486,7 @@ do
end
end
+local next_cluster_array = {}
-- ノード追加
local function pre_low_app_node(head, w, cmp, coef, ht, dp)
-- メインの node list 更新
@@ -497,17 +507,21 @@ local function pre_low_app_node(head, w, cmp, coef, ht, dp)
insert_after(head, nt, nta)
set_attr(nta, attr_ruby, 2*i+1)
-- glue
- nt = node_new(id_glue)
- local ntb = node_new(id_glue_spec);
+ local ntb = node_new(id_glue_spec);
setfield(ntb, 'width', coef[i*2+1][2*cmp+2])
setfield(ntb, 'stretch_order', 0); setfield(ntb, 'stretch', 0)
setfield(ntb, 'shrink_order', 0); setfield(ntb, 'shrink', 0)
+ if i~=cmp or not next_cluster_array[w] then
+ nt = node_new(id_glue); insert_after(head, nta, nt)
+ else
+ nt = next_cluster_array[w]
+ end
setfield(nt, 'subtype', 0); setfield(nt, 'spec', ntb)
set_attr(nt, attr_ruby, 2*i+2)
- insert_after(head, nta, nt)
end
tex.setattribute('global', attr_ruby, -0x7FFFFFFF)
setfield(w, 'user_id', RUBY_POST)
+ next_cluster_array[w]=nil
return head, first_whatsit(node_next(nt))
end
@@ -557,11 +571,11 @@ local post_lown
do
local function write_aux(wv, num)
local id = has_attr(wv, attr_ruby_id)
- if id>0 then
- tex.sprint(cat_lp,
- '\\write\\@mainaux{\\string\\directlua{luatexja.ruby.old_break_info['
- .. tostring(id) .. ']=' .. num
- .. '}}')
+ if id>0 and cache_handle then
+ cache_handle:write(
+ 'luatexja.ruby.old_break_info['
+ .. tostring(id) .. ']=' .. num
+ .. '\n')
end
end
@@ -575,7 +589,7 @@ do
if fn==2*cmp+2 then
local hn = node_tail(wv)
node_remove(wv, hn)
- insert_after(ch, rs[#rs], hn)
+ insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
write_aux(wv, has_attr(hn, attr_ruby))-- 行中形
else
@@ -583,7 +597,7 @@ do
for i = 1, deg do hn = node_next(hn) end;
node_remove(wv, hn)
setfield(hn, 'next', nil)
- insert_after(ch, rs[#rs], hn)
+ insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
write_aux(wv, has_attr(hn, attr_ruby))
end
@@ -593,7 +607,7 @@ do
-- -1 is needed except the case hn = 3,
-- because a ending-line form is removed already from the list
node_remove(wv, hn); setfield(hn, 'next', nil)
- insert_after(ch, rs[#rs], hn)
+ insert_after(ch, rs[1], hn)
set_attr(hn, attr_icflag, PROCESSED)
if fn == 2*cmp-1 then
write_aux(wv, has_attr(hn, attr_ruby))
@@ -727,8 +741,15 @@ end
do
local RIPOST = luatexja.stack_table_index.RIPOST
- local function whatsit_after_callback(s, Nq, Np, bsl)
+ local function whatsit_after_callback(s, Nq, Np)
if not s and getfield(Nq.nuc, 'user_id') == RUBY_PRE then
+ if Np then
+ local last_glue = node_new(id_glue)
+ set_attr(last_glue, attr_icflag, 0)
+ insert_before(Nq.nuc, Np.first, last_glue)
+ Np.first = last_glue
+ next_cluster_array[Nq.nuc] = last_glue -- ルビ処理用のグルー
+ end
local nqnv = getfield(Nq.nuc, 'value')
local x = node_next(node_next(nqnv))
for i = 2, getfield(nqnv, 'value') do x = node_next(node_next(x)) end