diff options
Diffstat (limited to 'Master')
26 files changed, 651 insertions, 1612 deletions
diff --git a/Master/texmf-dist/doc/luatex/luatexja/README b/Master/texmf-dist/doc/luatex/luatexja/README index 8e977e82e36..6b8aaa89f90 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/README +++ b/Master/texmf-dist/doc/luatex/luatexja/README @@ -1,4 +1,4 @@ -The LuaTeX-ja Package 20160404.0 +The LuaTeX-ja Package 20160421.0 -------------------------------- Copyright (c) 2011--2016 The LuaTeX-ja project License: modified BSD (see COPYING) @@ -34,9 +34,9 @@ Installation 2. If you must/want to install manually: a. Download the source archive from CTAN, - or tagged as 20160404.0 in the Git repository by + or tagged as 20160421.0 in the Git repository by <http://git.osdn.jp/view?p=luatex-ja/luatexja.git - ;a=snapshot;h=refs/tags/20160404.0;sf=tgz> + ;a=snapshot;h=refs/tags/20160421.0;sf=tgz> b. Extract the archive and process following three files by LuaLaTeX to generate classes for Japanese typesetting: @@ -81,4 +81,4 @@ Notes * src/*.{ins.dtx} and src/ltj-kinsoku_make.tex are not needed in regular use. -Last commit date: Mon Apr 4 18:07:29 2016 +0900 +Last commit date: Thu Apr 21 18:42:08 2016 +0900 diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf Binary files differindex b4146ee2545..36be627e83d 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-en.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf Binary files differindex 05c381c509b..9ef69ecb43c 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ja.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf Binary files differindex d3904f315ca..edfcb71c6dd 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja-ruby.pdf diff --git a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx index 2ee6bd90e38..e325ee7f6d1 100644 --- a/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx +++ b/Master/texmf-dist/doc/luatex/luatexja/luatexja.dtx @@ -602,17 +602,17 @@ and \emph{Japanese fonts} for fonts used in \textbf{JAchar}. %<en>The following packages are needed for the \LuaTeX-ja\ package. %<ja>\LuaTeX-jaパッケージの動作には次のパッケージ類が必要である. \begin{itemize} -\item \LuaTeX\ beta-0.80.0 (or later) -\item \Pkg{luaotfload} v2.5 (or later) +\item \LuaTeX\ beta-0.85.0 (or later) +\item \Pkg{luaotfload} v2.6 (or later) \item \Pkg{adobemapping} (Adobe cmap and pdfmapping files) \item \Pkg{everysel} (if you want to use \LuaTeX-ja with \LaTeXe) \item \Pkg{fontspec} v2.4 %<en>\item \emph{IPAex fonts} (\url{http://ipafont.ipa.go.jp/}) %<ja>\item \emph{IPAexフォント(\url{http://ipafont.ipa.go.jp/})} \end{itemize} -%<en>In summary, this version of \LuaTeX-ja no longer supports \TeX~Live~2014 (or older version). +%<en>In summary, this version of \LuaTeX-ja no longer supports \TeX~Live~2015 (or older version). %<*ja> -要約すると,本バージョンの\LuaTeX-jaは\TeX~Live~2014以前では動作しない\footnote{% +要約すると,本バージョンの\LuaTeX-jaは\TeX~Live~2015以前では動作しない\footnote{% もっとも,自分で\LuaTeX のバイナリをSubversionリポジトリからビルドしていれば話は別である. }. %</ja> diff --git a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty index 1ba9cda333f..0e10c457799 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-adjust.sty @@ -64,7 +64,7 @@ \expandafter\let\csname ifltj@in@latex\expandafter\endcsname \csname iftrue\endcsname \NeedsTeXFormat{LaTeX2e} - \ProvidesPackage{luatexja-adjust}[2014/05/13] + \ProvidesPackage{luatexja-adjust}[2016/04/03] \fi %</LaTeX> % Load core module if not yet. @@ -84,7 +84,11 @@ %%------------------ %! Main part of luatexja-adjust -\RequireLuaTeXjaSubmodule{adjust} +\ifnum\luatexversion>90 + \RequireLuaTeXjaSubmodule{adjust} +\else + \RequireLuaTeXjaSubmodule{adjust_85} +\fi % enable/disable ``advanced'' line adjustment \protected\def\ltjdisableadjust{\directlua{luatexja.adjust.disable_cb()}} 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 6b5075f7ba6..2da6d5974dc 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/addons/luatexja-ruby.sty @@ -23,7 +23,7 @@ \ltj@@set@stack@real{RIPOST}{0}{0x7FFFFFFF}#1 } \def\ltj@@set@stack@real#1#2#3{% \directlua{luatexja.stack.set_stack_perchar(luatexja.stack_table_index.#1, - #2, #3, luatexja.token.scan_word)}} + #2, #3, token.scan_word)}} % ルビ用のキー設定 \def\ltj@@rkeydef#1{ diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua index 84f75b9509d..821099da607 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust.lua @@ -1,55 +1,45 @@ -- --- luatexja/otf.lua +-- ltj-adjust.lua -- -luatexbase.provides_module({ - name = 'luatexja.adjust', - date = '2014/09/30', - description = 'Advanced line adjustment for LuaTeX-ja', -}) -module('luatexja.adjust', package.seeall) - luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('direction'); local ltjd = luatexja.direction -local Dnode = node.direct or node - -local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end - -local node_traverse_id = Dnode.traverse_id -local node_new = Dnode.new -local node_copy = Dnode.copy -local node_hpack = Dnode.hpack -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local node_free = Dnode.free -local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev -local node_tail = Dnode.tail -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local insert_after = Dnode.insert_after +local to_node = node.direct.tonode +local to_direct = node.direct.todirect + +local setfield = node.direct.setfield +local setglue = luatexja.setglue +local getfield = node.direct.getfield +local is_zero_glue = node.direct.is_zero_glue +local getlist = node.direct.getlist +local getid = node.direct.getid +local getfont = node.direct.getfont +local getsubtype = node.direct.getsubtype + +local node_traverse_id = node.direct.traverse_id +local node_new = node.direct.new +local node_copy = node.direct.copy +local node_hpack = node.direct.hpack +local node_next = node.direct.getnext +local node_free = node.direct.free +local node_prev = node.direct.getprev +local node_tail = node.direct.tail +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local insert_after = node.direct.insert_after local id_glyph = node.id('glyph') local id_kern = node.id('kern') local id_hlist = node.id('hlist') local id_glue = node.id('glue') -local id_glue_spec = node.id('glue_spec') local id_whatsit = node.id('whatsit') local attr_icflag = luatexbase.attributes['ltj@icflag'] local attr_jchar_class = luatexbase.attributes['ltj@charclass'] local lang_ja = luatexja.lang_ja local ltjf_font_metric_table = ltjf.font_metric_table -local spec_zero_glue = ltjj.spec_zero_glue local round, pairs = tex.round, pairs local PACKED = luatexja.icflag_table.PACKED @@ -80,23 +70,20 @@ end -- box 内で伸縮された glue の合計値を計算 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(q, 'stretch_order') == go then + return getfield(q, 'stretch') else return 0 end else -- shrinking - if getfield(qs, 'shrink_order') == go then - return getfield(qs, 'shrink') + if getfield(q, 'shrink_order') == go then + return getfield(q, 'shrink') else return 0 end end end local res = {} -local gs_used_line = {} local function get_total_stretched(p, line) local go, gf, gs = getfield(p, 'glue_order'), getfield(p, 'glue_set'), getfield(p, 'glue_sign') @@ -111,23 +98,6 @@ local function get_total_stretched(p, line) elseif ic == XKANJI_SKIP_JFM then ic = XKANJI_SKIP end if type(res[ic]) == 'number' then - -- kanjiskip, xkanjiskip は段落内で spec を共有しているが, - -- それはここでは望ましくないので,各 glue ごとに異なる spec を使う. - -- 本当は各行ごとに glue_spec を共有させたかったが,安直にやると - -- ref_count が 0 なので Double-free が発生する.どうする? - -- JFM グルーはそれぞれ異なる glue_spec を用いているので,問題ない. - if (ic == KANJI_SKIP or ic == XKANJI_SKIP) and getsubtype(q)==0 then - local qs = getfield(q, 'spec') - if qs ~= spec_zero_glue then - if (gs_used_line[qs] or 0)<line then - setfield(q, 'spec', node_copy(qs)) - local f = node_new(id_glue); setfield(f, 'spec', qs); node_free(f) - -- decrese qs's reference count - else - gs_used_line[qs] = line - end - end - end res[ic], total = res[ic] + a, total + a else res[0], total = res[0] + a, total + a @@ -141,33 +111,21 @@ local function clear_stretch(p, ic, name) local f = get_attr_icflag(q) if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then - local qs = getfield(q, 'spec') - if getfield(qs, 'writable') then - setfield(qs, name..'_order', 0) - setfield(qs, name, 0) - end + setfield(q, name..'_order', 0) + setfield(q, name, 0) end end end -local set_stretch_table = {} local function set_stretch(p, after, before, ic, name) if before > 0 then local ratio = after/before - for i,_ in pairs(set_stretch_table) do - set_stretch_table[i] = nil - end for q in node_traverse_id(id_glue, getlist(p)) do local f = get_attr_icflag(q) if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then - local qs, do_flag = getfield(q, 'spec'), true - for i=1,#set_stretch_table do - if set_stretch_table[i]==qs then do_flag = false end - end - if getfield(qs, 'writable') and getfield(qs, name..'_order')==0 and do_flag then - setfield(qs, name, getfield(qs, name)*ratio) - set_stretch_table[#set_stretch_table+1] = qs + if getfield(q, name..'_order')==0 then + setfield(q, name, getfield(q, name)*ratio) end end end @@ -271,22 +229,20 @@ local function adjust_width(head) aw_step2(p, res, total, aw_step1(p, res, total)) end end - for i,_ in pairs(gs_used_line) do - gs_used_line[i] = nil - end return to_node(head) end do + luatexja.adjust = luatexja.adjust or {} local is_reg = false - function enable_cb() + function luatexja.adjust.enable_cb() if not is_reg then luatexbase.add_to_callback('post_linebreak_filter', adjust_width, 'Adjust width', 100) is_reg = true end end - function disable_cb() + function luatexja.adjust.disable_cb() if is_reg then luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') is_reg = false diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua new file mode 100644 index 00000000000..db85d8f3260 --- /dev/null +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-adjust_85.lua @@ -0,0 +1,291 @@ +-- +-- luatexja/otf.lua +-- +luatexja.load_module('jfont'); local ltjf = luatexja.jfont +luatexja.load_module('jfmglue'); local ltjj = luatexja.jfmglue +luatexja.load_module('stack'); local ltjs = luatexja.stack +luatexja.load_module('direction'); local ltjd = luatexja.direction + +local to_node = node.direct.tonode +local to_direct = node.direct.todirect + +local setfield = node.direct.setfield +local setglue = luatexja.setglue +local getfield = node.direct.getfield +local is_zero_glue = node.direct.is_zero_glue or + function(g) + return (getfield(g,'width')==0)and (getfield(g,'stretch')==0)and(getfield(g,'shrink')==0) + end +local getlist = node.direct.getlist +local getid = node.direct.getid +local getfont = node.direct.getfont +local getsubtype = node.direct.getsubtype + +local node_traverse_id = node.direct.traverse_id +local node_new = node.direct.new +local node_copy = node.direct.copy +local node_hpack = node.direct.hpack +local node_next = node.direct.getnext +local node_free = node.direct.free +local node_prev = node.direct.getprev +local node_tail = node.direct.tail +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local insert_after = node.direct.insert_after + +local id_glyph = node.id('glyph') +local id_kern = node.id('kern') +local id_hlist = node.id('hlist') +local id_glue = node.id('glue') +local id_whatsit = node.id('whatsit') +local attr_icflag = luatexbase.attributes['ltj@icflag'] +local attr_jchar_class = luatexbase.attributes['ltj@charclass'] +local lang_ja = luatexja.lang_ja + +local ltjf_font_metric_table = ltjf.font_metric_table +local round, pairs = tex.round, pairs + +local PACKED = luatexja.icflag_table.PACKED +local FROM_JFM = luatexja.icflag_table.FROM_JFM +local KANJI_SKIP = luatexja.icflag_table.KANJI_SKIP +local KANJI_SKIP_JFM = luatexja.icflag_table.KANJI_SKIP_JFM +local XKANJI_SKIP = luatexja.icflag_table.XKANJI_SKIP +local XKANJI_SKIP_JFM = luatexja.icflag_table.XKANJI_SKIP_JFM + +local priority_table = { + FROM_JFM + 2, + FROM_JFM + 1, + FROM_JFM, + FROM_JFM - 1, + FROM_JFM - 2, + XKANJI_SKIP, + KANJI_SKIP +} + +local get_attr_icflag +do + local PROCESSED_BEGIN_FLAG = luatexja.icflag_table.PROCESSED_BEGIN_FLAG + get_attr_icflag = function(p) + return (has_attr(p, attr_icflag) or 0) % PROCESSED_BEGIN_FLAG + end +end + +-- box 内で伸縮された glue の合計値を計算 + +local function get_stretched(q, go, gs) + if gs == 1 then -- stretching + if getfield(q, 'stretch_order') == go then + return getfield(q, 'stretch') + else return 0 + end + else -- shrinking + if getfield(q, 'shrink_order') == go then + return getfield(q, 'shrink') + else return 0 + end + end +end + +local res = {} +local gs_used_line = {} +local function get_total_stretched(p, line) + local go, gf, gs + = getfield(p, 'glue_order'), getfield(p, 'glue_set'), getfield(p, 'glue_sign') + if go ~= 0 then return nil end + res[0], res.glue_set, res.name = 0, gf, (gs==1) and 'stretch' or 'shrink' + for i=1,#priority_table do res[priority_table[i]]=0 end + if gs ~= 1 and gs ~= 2 then return res, 0 end + local total = 0 + for q in node_traverse_id(id_glue, getlist(p)) do + local a, ic = get_stretched(q, go, gs), get_attr_icflag(q) + if ic == KANJI_SKIP_JFM then ic = KANJI_SKIP + elseif ic == XKANJI_SKIP_JFM then ic = XKANJI_SKIP + end + if type(res[ic]) == 'number' then + -- kanjiskip, xkanjiskip は段落内で spec を共有しているが, + -- それはここでは望ましくないので,各 glue ごとに異なる spec を使う. + -- 本当は各行ごとに glue_spec を共有させたかったが,安直にやると + -- ref_count が 0 なので Double-free が発生する.どうする? + -- JFM グルーはそれぞれ異なる glue_spec を用いているので,問題ない. + if (ic == KANJI_SKIP or ic == XKANJI_SKIP) and getsubtype(q)==0 then + local qs = getfield(q, 'spec') + if is_zero_glue(q) then + if (gs_used_line[qs] or 0)<line then + setfield(q, 'spec', node_copy(qs)) + local f = node_new(id_glue); setfield(f, 'spec', qs); node_free(f) + -- decrese qs's reference count + else + gs_used_line[qs] = line + end + end + end + res[ic], total = res[ic] + a, total + a + else + res[0], total = res[0] + a, total + a + end + end + return res, total +end + +local function clear_stretch(p, ic, name) + for q in node_traverse_id(id_glue, getlist(p)) do + local f = get_attr_icflag(q) + if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) + or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then + local qs = getfield(q, 'spec') + if getfield(qs, 'writable') then + setfield(qs, name..'_order', 0) + setfield(qs, name, 0) + end + end + end +end + +local set_stretch_table = {} +local function set_stretch(p, after, before, ic, name) + if before > 0 then + local ratio = after/before + for i,_ in pairs(set_stretch_table) do + set_stretch_table[i] = nil + end + for q in node_traverse_id(id_glue, getlist(p)) do + local f = get_attr_icflag(q) + if (f == ic) or ((ic ==KANJI_SKIP) and (f == KANJI_SKIP_JFM)) + or ((ic ==XKANJI_SKIP) and (f == XKANJI_SKIP_JFM)) then + local qs, do_flag = getfield(q, 'spec'), true + for i=1,#set_stretch_table do + if set_stretch_table[i]==qs then do_flag = false end + end + if getfield(qs, 'writable') and getfield(qs, name..'_order')==0 and do_flag then + setfield(q, name, getfield(qs, name)*ratio) + set_stretch_table[#set_stretch_table+1] = qs + end + end + end + end +end + +-- step 1: 行末に kern を挿入(句読点,中点用) +local ltjd_glyph_from_packed = ltjd.glyph_from_packed +local function aw_step1(p, res, total) + local head = getlist(p) + local x = node_tail(head); if not x then return false end + -- x: \rightskip + x = node_prev(x); if not x then return false end + local xi, xc = getid(x) + if xi == id_glue and getsubtype(x) == 15 then + -- 段落最終行のときは,\penalty10000 \parfillskip が入るので, + -- その前の node が本来の末尾文字となる + x = node_prev(node_prev(x)); xi = getid(x) + end + -- local xi = getid(x) + -- while (get_attr_icflag(x) == PACKED) + -- and ((xi == id_penalty) or (xi == id_kern) or (xi == id_kern)) do + -- x = node_prev(x); xi = getid(x) + -- end + if xi == id_glyph and getfield(x, 'lang')==lang_ja then + -- 和文文字 + xc = x + elseif xi == id_hlist and get_attr_icflag(x) == PACKED then + -- packed JAchar + xc = ltjd_glyph_from_packed(x) + while getid(xc) == id_whatsit do xc = node_next(xc) end -- これはなんのために? + else + return false-- それ以外は対象外. + end + local xk = ltjf_font_metric_table[getfont(xc)] + .char_type[has_attr(xc, attr_jchar_class) or 0]['end_' .. res.name] or 0 + + if xk>0 and total>=xk then + total = total - xk + local kn = node_new(id_kern) + setfield(kn, 'kern', (res.name=='shrink' and -1 or 1) * xk) + set_attr(kn, attr_icflag, FROM_JFM) + insert_after(head, x, kn) + return true + else return false + end +end + +-- step 2: 行中の glue を変える +local function aw_step2(p, res, total, added_flag) + if total == 0 then -- もともと伸縮の必要なし + if added_flag then -- 行末に kern 追加したので,それによる補正 + local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') + setfield(f, 'head', nil) + setfield(p, 'glue_set', getfield(f, 'glue_set')) + setfield(p, 'glue_order', getfield(f, 'glue_order')) + setfield(p, 'glue_sign', getfield(f, 'glue_sign')) + node_free(f) + return + end + elseif total <= res[0] then -- 和文処理グルー以外で足りる + for _,v in pairs(priority_table) do clear_stretch(p, v, res.name) end + local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') + setfield(f, 'head', nil) + setfield(p, 'glue_set', getfield(f, 'glue_set')) + setfield(p, 'glue_order', getfield(f, 'glue_order')) + setfield(p, 'glue_sign', getfield(f, 'glue_sign')) + node_free(f) + else + total = total - res[0] + for i = 1, #priority_table do + local v = priority_table[i] + if total <= res[v] then + for j = i+1,#priority_table do + clear_stretch(p, priority_table[j], res.name) + end + set_stretch(p, total, res[v], v, res.name); break + end + total = total - res[v] + end + local f = node_hpack(getlist(p), getfield(p, 'width'), 'exactly') + setfield(f, 'head', nil) + setfield(p, 'glue_set', getfield(f, 'glue_set')) + setfield(p, 'glue_order', getfield(f, 'glue_order')) + setfield(p, 'glue_sign', getfield(f, 'glue_sign')) + node_free(f) + end +end + + +local ltjs_fast_get_stack_skip = ltjs.fast_get_stack_skip +local function adjust_width(head) + if not head then return head end + local line = 1 + for p in node_traverse_id(id_hlist, to_direct(head)) do + line = line + 1 + local res, total = get_total_stretched(p, line) + -- this is the same table as the table which is def'd in l. 92 + if res and res.glue_set<1 then + total = round(total * res.glue_set) + aw_step2(p, res, total, aw_step1(p, res, total)) + end + end + for i,_ in pairs(gs_used_line) do + gs_used_line[i] = nil + end + return to_node(head) +end + +do + luatexja.adjust = luatexja.adjust or {} + local is_reg = false + function luatexja.adjust.enable_cb() + if not is_reg then + luatexbase.add_to_callback('post_linebreak_filter', + adjust_width, 'Adjust width', 100) + is_reg = true + end + end + function luatexja.adjust.disable_cb() + if is_reg then + luatexbase.remove_from_callback('post_linebreak_filter', 'Adjust width') + is_reg = false + end + end +end + +luatexja.unary_pars.adjust = function(t) + return is_reg and 1 or 0 +end diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua index e66a196aee6..1ed8ab88bee 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.lua @@ -156,20 +156,6 @@ ltjb.mprint = mprint -------------------- Handling of TeX values do - local glue_spec_id = node.id("glue_spec") - - local function copy_skip(s1, s2) - if not s1 then - s1 = node.new(glue_spec_id) - end - s1.width = s2.width or 0 - s1.stretch = s2.stretch or 0 - s1.stretch_order = s2.stretch_order or 0 - s1.shrink = s2.shrink or 0 - s1.shrink_order = s2.shrink_order or 0 - return s1 - end - --! ixbase.to_dimen() と同じ local function to_dimen(val) if val == nil then @@ -192,44 +178,7 @@ do return tex.sp(val), fil end ---! ixbase.to_skip() と同じ - local function to_skip(val) - if type(val) == "userdata" then - return val - end - local res = node.new(glue_spec_id) - if val == nil then - res.width = 0 - elseif type(val) == "number" then - res.width = val - elseif type(val) == "table" then - copy_skip(res, val) - else - local t = tostring(val):lower():explode() - local w, p, m = t[1], t[3], t[5] - if t[2] == "minus" then - p, m = nil, t[3] - end - res.width = tex.sp(t[1]) - if p then - res.stretch, res.stretch_order = parse_dimen(p) - end - if m then - res.shrink, res.shrink_order = parse_dimen(m) - end - end - return res - end - - local function dump_skip(s) - print(("%s+%s<%s>-%s<%s>"):format( - s.width or 0, s.stretch or 0, s.stretch_order or 0, - s.shrink or 0, s.shrink_order or 0)) - end - ltjb.to_dimen = to_dimen - ltjb.dump_skip = dump_skip - ltjb.to_skip = to_skip end -------------------- Virtual table for LaTeX counters diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty index 75e2b7af65e..1dc744450f0 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-base.sty @@ -134,19 +134,19 @@ %% \ltj@gobble@num <number> %! 次に続く整数を(2 回展開で)読み捨てる. \def\ltj@gobble@num{ - \directlua{luatexja.token.scan_int()} + \directlua{token.scan_int()} } %% \ltj@gobble@glue <glue> %! 次に続くグルー値を(2 回展開で)読み捨てる. \def\ltj@gobble@glue{ - \directlua{luatexja.token.scan_glue()} + \directlua{token.scan_glue()} } %% \ltj@gobble@dimen <dimen> %! 次に続く寸法値を(2 回展開で)読み捨てる. \def\ltj@gobble@dimen{ - \directlua{luatexja.token.scan_dimen()} + \directlua{token.scan_dimen()} } %% \ltj@grab@num <number> @@ -160,7 +160,7 @@ %! (command_name が "assign_int" であるトークン). %! (注意: まだ文字表記(`A)に対応していません.) \def\ltj@grab@num{ - \directlua{tex.sprint('{' .. luatexja.token.scan_int() .. '}')} + \directlua{tex.sprint('{' .. token.scan_int() .. '}')} } %%------------------ Safe passing @@ -213,24 +213,6 @@ } } -%% \ltj@safe@glue{<glue>} -%! グルー値. -% For a glue. The result is a gluespec object. -\def\ltj@safe@glue{ - \ltj@safe@glue@or\ltj@safe@invalid -} -\def\ltj@safe@glue@or#1#2{ - \expandafter\expandafter\expandafter\ltj@@safe@glueA - \ltj@gobble@glue#2\ltj@@safe@end{#2}{#1} -} -\def\ltj@@safe@glueA#1\ltj@@safe@end#2#3{ - \ltj@if@blank{#1}{ - (luatexja.base.to_skip("\the\glueexpr#2\relax")) - }{ - #3 - } -} - %% \ltj@safe@real{<real>} %! 実数. これは十進表記に限る. % For a real number given in decimal notation or a macro that diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua index 020cec9a3c3..277b4dd9f48 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-charrange.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.charrange', - date = '2014/05/08', + date = '2014/06/03', description = 'Handling the range of Japanese characters', }) module('luatexja.charrange', package.seeall) @@ -11,9 +11,8 @@ local err, warn, info, log = luatexbase.errwarinf(_NAME) luatexja.load_module('base'); local ltjb = luatexja.base -local Dnode = node.direct or node -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local has_attr = Dnode.has_attribute +local getchar = node.direct.getchar +local has_attr = node.direct.has_attribute local has_attr_node = node.has_attribute local tex_getattr = tex.getattribute diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua index b5f267c4bb1..c54842a86b6 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-direction.lua @@ -10,26 +10,24 @@ local attr_dir = luatexbase.attributes['ltj@dir'] local attr_icflag = luatexbase.attributes['ltj@icflag'] local cat_lp = luatexbase.catcodetables['latex-package'] -local Dnode = node.direct or node -local nullfunc = function (n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local insert_before = Dnode.insert_before -local insert_after = Dnode.insert_after -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local node_new = Dnode.new -local node_tail = Dnode.tail -local node_free = Dnode.free -local node_remove = Dnode.remove -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local traverse = Dnode.traverse -local traverse_id = Dnode.traverse_id +local to_node = node.direct.tonode +local to_direct = node.direct.todirect +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local insert_before = node.direct.insert_before +local insert_after = node.direct.insert_after +local getid = node.direct.getid +local getsubtype = node.direct.getsubtype +local getlist = node.direct.getlist +local setfield = node.direct.setfield +local getfield = node.direct.getfield +local node_new = node.direct.new +local node_tail = node.direct.tail +local node_free = node.direct.free +local node_remove = node.direct.remove +local node_next = node.direct.getnext +local traverse = node.direct.traverse +local traverse_id = node.direct.traverse_id local start_time_measure, stop_time_measure = ltjb.start_time_measure, ltjb.stop_time_measure local abs = math.abs @@ -65,7 +63,7 @@ local page_direction -- local dir_pool do - local node_copy = Dnode.copy + local node_copy = node.direct.copy dir_pool = {} for _,i in pairs({dir_tate, dir_yoko, dir_dtou, dir_utod}) do local w = node_new(id_whatsit, sid_user) @@ -140,7 +138,6 @@ do local node_traverse = node.traverse local STCK = luatexja.userid_table.STCK local IHB = luatexja.userid_table.IHB - local sid_local = node.subtype('local_par') local id_local = node.id('local_par') local function test_list(h, lv) @@ -159,8 +156,6 @@ do elseif not(uid==IHB or uid==STCK) then flag = 0; break -- error end - elseif ps~=sid_local then - flag = 0; break end elseif p.id~=id_local then flag = 0; break @@ -581,7 +576,7 @@ local function unwrap_dir_node(b, head, box_dir) end local shift_old, b_dir, wh = nil, get_box_dir(bh, 0) if wh then - Dnode.flush_list(getfield(wh, 'value')) + node.direct.flush_list(getfield(wh, 'value')) setfield(wh, 'value', nil) end return nh, nb, bh, b_dir @@ -626,7 +621,7 @@ do -- dir_node としてカプセル化されている local _, dnc = get_box_dir(b, 0) if dnc then -- free all other dir_node - Dnode.flush_list(getfield(dnc, 'value')) + node.direct.flush_list(getfield(dnc, 'value')) setfield(dnc, 'value', nil) end set_attr(b, attr_dir, box_dir%dir_math_mod + dir_node_auto) @@ -656,7 +651,7 @@ do db=x; break end end - Dnode.flush_list(getfield(dn, 'value')) + node.direct.flush_list(getfield(dn, 'value')) setfield(dn, 'value', nil) db = db or create_dir_node(b, box_dir, new_dir, false) local w = getfield(b, 'width') @@ -687,7 +682,7 @@ do end -- lastbox - local node_prev = (Dnode~=node) and Dnode.getprev or node.prev + local node_prev = (node.direct~=node) and node.direct.getprev or node.prev local function lastbox_hook() start_time_measure('box_primitive_hook') local bn = tex_nest[tex_nest.ptr].tail @@ -705,7 +700,7 @@ do end local _, wh = get_box_dir(b, 0) -- clean dir_node attached to the box if wh then - Dnode.flush_list(getfield('value', wh)) + node.direct.flush_list(getfield('value', wh)) setfield(wh, 'value', nil) end end @@ -766,8 +761,8 @@ do luatexja.direction.get_box_dim = get_box_dim -- return value: (changed dimen of box itself?) - local scan_dimen, scan_int = luatexja.token.scan_dimen, luatexja.token.scan_int - local scan_keyword = luatexja.token.scan_keyword + local scan_dimen, scan_int = token.scan_dimen, token.scan_int + local scan_keyword = token.scan_keyword local function set_box_dim_common(key, s, l_dir) local s_dir, wh = get_box_dir(s, dir_yoko) s_dir = s_dir%dir_math_mod @@ -866,7 +861,7 @@ do end do - local getbox, setbox, copy_list = tex.getbox, tex.setbox, Dnode.copy_list + local getbox, setbox, copy_list = tex.getbox, tex.setbox, node.direct.copy_list -- raise, lower function luatexja.direction.raise_box() start_time_measure('box_primitive_hook') @@ -913,7 +908,7 @@ do 'luatexja', 'Direction Incompatible', "\\vadjust's argument and outer vlist must have same direction.") - Dnode.last_node() + node.direct.last_node() end end stop_time_measure('box_primitive_hook') @@ -964,14 +959,6 @@ do ltjs.list_dir = has_attr(bh, attr_dir); break end end - -- local bh=hd - -- for i=1,2 do - -- if bh and getid(bh)==id_whatsit - -- and getsubtype(bh)==sid_user and getfield(bh, 'user_id')==DIR then - -- ltjs.list_dir = has_attr(bh, attr_dir); break - -- end - -- bh = node_next(bh) - -- end if split_dir_whatsit then -- adjust direction of 'split_keep' set_attr(split_dir_whatsit, attr_dir, ltjs.list_dir) @@ -981,7 +968,9 @@ do split_dir_whatsit=nil else adjust_badness(hd) - hd = process_dir_node(create_dir_whatsit_vbox(hd, gc), gc) + -- hd = process_dir_node(create_dir_whatsit_vbox(hd, gc), gc) + -- done in append_to_vpack callback + hd = create_dir_whatsit_vbox(hd, gc) split_dir_whatsit=nil end stop_time_measure('direction_vpack') @@ -1012,23 +1001,44 @@ do end end --- buildpage filter +-- append_to_vlist filter do - local function dir_adjust_buildpage(info) - if info=='box' then - local head = to_direct(tex.lists.contrib_head) - if head then - head = make_dir_whatsit(head, - node_tail(head), - get_dir_count(), - 'buildpage') - tex.lists.contrib_head = to_node(head) + local id_glue = node.id('glue') + local getglue = node.direct.getglue or + function(g) + return getfield(g,'width'), getfield(g,'stretch'), getfield(g,'shrink'), + getfield(g,'stretch_order'), getfield(g,'shrink_order') + end +local setglue = luatexja.setglue + local function copy_glue (new_glue, old_glue, subtype, new_w) + setfield(new_glue, 'subtype', subtype) + local w,st,sp,sto,spo = getglue(to_direct(old_glue)) + setglue(new_glue, new_w or w, st, sp, sto, spo) + end + local node_write = node.direct.write + local function dir_adjust_append_vlist(b, loc, prev, mirrored) + local old_b = to_direct(b) + local new_b = loc=='box' and + make_dir_whatsit(old_b, old_b, get_dir_count(), 'append_vlist') or old_b + + if prev > -65536000 then + local d = tex.baselineskip.width - prev + - getfield(new_b, mirrored and 'depth' or 'height') + local g = node_new(id_glue) + if d < tex.lineskiplimit then + copy_glue(g, tex.lineskip, 1) + else + copy_glue(g, tex.baselineskip, 2, d); end + node_write(g) end + node_write(new_b) + tex.prevdepth = getfield(new_b, mirrored and 'height' or 'depth') + return nil -- do nothing on tex side end - ltjb.add_to_callback('buildpage_filter', - dir_adjust_buildpage, - 'ltj.direction', 10000) + ltjb.add_to_callback('append_to_vlist_filter', + dir_adjust_append_vlist, + 'ltj.direction', 10000) end -- finalize (executed just before \shipout) @@ -1088,7 +1098,7 @@ do end end local getbox = tex.getbox - local setbox, copy = Dnode.setbox, Dnode.copy + local setbox, copy = node.direct.setbox, node.direct.copy local lua_mem_kb = 0 function luatexja.direction.finalize() local a = to_direct(tex.getbox("AtBeginShipoutBox")) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua index 9a638e38928..1a3a9759ba6 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfmglue.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfmglue', - date = '2016/03/31', + date = '2016/04/03', description = 'Insertion process of JFM glues and kanjiskip', }) module('luatexja.jfmglue', package.seeall) @@ -16,35 +16,34 @@ luatexja.load_module('direction'); local ltjd = luatexja.direction luatexja.load_module('setwidth'); local ltjw = luatexja.setwidth local pairs = pairs -local Dnode = node.direct or node - local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end - -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local insert_before = Dnode.insert_before -local insert_after = Dnode.insert_after -local node_next = (Dnode ~= node) and Dnode.getnext or node.next +local to_node = node.direct.tonode +local to_direct = node.direct.todirect + +local setfield = node.direct.setfield +local setglue = luatexja.setglue +local getfield = node.direct.getfield +local getid = node.direct.getid +local getfont = node.direct.getfont +local getlist = node.direct.getlist +local getchar = node.direct.getchar +local getsubtype = node.direct.getsubtype + +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local insert_before = node.direct.insert_before +local insert_after = node.direct.insert_after +local node_next = node.direct.getnext local round = tex.round local ltjd_make_dir_whatsit = ltjd.make_dir_whatsit local ltjf_font_metric_table = ltjf.font_metric_table local ltjf_find_char_class = ltjf.find_char_class -local node_new = Dnode.new -local node_copy = Dnode.copy -local node_remove = Dnode.remove -local node_tail = Dnode.tail -local node_free = Dnode.free -local node_end_of_math = Dnode.end_of_math +local node_new = node.direct.new +local node_copy = node.direct.copy +local node_remove = node.direct.remove +local node_tail = node.direct.tail +local node_free = node.direct.free +local node_end_of_math = node.direct.end_of_math local id_glyph = node.id('glyph') local id_hlist = node.id('hlist') @@ -60,7 +59,6 @@ local id_glue = node.id('glue') local id_kern = node.id('kern') local id_penalty = node.id('penalty') -local id_glue_spec = node.id('glue_spec') local id_jglyph = 512 -- Japanese character local id_box_like = 256 -- vbox, shifted hbox local id_pbox = 257 -- already processed nodes (by \unhbox) @@ -121,25 +119,11 @@ do end end -local zero_glue = node_new(id_glue) -spec_zero_glue = to_node(node_new(id_glue_spec)) - -- must be public, since mentioned from other sources -local spec_zero_glue = to_direct(spec_zero_glue) -setfield(spec_zero_glue, 'width', 0) -setfield(spec_zero_glue, 'stretch', 0) -setfield(spec_zero_glue, 'shrink', 0) -setfield(spec_zero_glue, 'stretch_order', 0) -setfield(spec_zero_glue, 'shrink_order', 0) -setfield(zero_glue, 'spec', spec_zero_glue) - -local function skip_table_to_spec(n) - local g, st = node_new(id_glue_spec), ltjs.fast_get_stack_skip(n) - setfield(g, 'width', st.width) - setfield(g, 'stretch', st.stretch) - setfield(g, 'shrink', st.shrink) - setfield(g, 'stretch_order', st.stretch_order) - setfield(g, 'shrink_order', st.shrink_order) - return g +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 @@ -281,7 +265,7 @@ luatexbase.create_callback("luatexja.jfmglue.whatsit_after", "data", local calc_np do -local traverse = Dnode.traverse +local traverse = node.direct.traverse local function check_next_ickern(lp) if lp and getid(lp) == id_kern and ( getsubtype(lp)==3 or ITALIC == get_attr_icflag(lp)) then set_attr(lp, attr_icflag, IC_PROCESSED); @@ -318,7 +302,6 @@ 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 rule_subtype = (status.luatex_version>=85) and 3 or 0 local function calc_np_aux_glyph_common(lp) Np.nuc = lp Np.first= (Np.first or lp) @@ -379,7 +362,7 @@ local function calc_np_aux_glyph_common(lp) end local r if adj_depth>node_depth then - r = node_new(id_rule,rule_subtype) + r = node_new(id_rule,3) setfield(r, 'width', 0); setfield(r, 'height', 0) setfield(r, 'depth',adj_depth); setfield(r, 'dir', tex_dir) set_attr(r, attr_icflag, PROCESSED) @@ -520,17 +503,11 @@ local calc_np_auxtable = { end, } calc_np_auxtable[id_rule] = calc_np_auxtable.box_like -if status.luatex_version>=85 then - calc_np_auxtable[15] = calc_np_auxtable.box_like -else - calc_np_auxtable[13] = calc_np_auxtable.box_like -end +calc_np_auxtable[15] = calc_np_auxtable.box_like calc_np_auxtable[id_ins] = calc_np_auxtable.skip calc_np_auxtable[id_mark] = calc_np_auxtable.skip calc_np_auxtable[id_adjust] = calc_np_auxtable.skip -if node.id('local_par') then - calc_np_auxtable[node.id('local_par')] = calc_np_auxtable.skip -end +calc_np_auxtable[node.id('local_par')] = calc_np_auxtable.skip function calc_np(last, lp) local k @@ -709,13 +686,13 @@ local function new_jfm_glue(mc, bc, ac) -- bc, ac: char classes local g = mc[bc][ac] if g then - if g[1] then + if g[1] then + return node_copy(g[1]), g.ratio, false, false, false + else local f = node_new(id_glue) set_attr(f, attr_icflag, g.priority) - setfield(f, 'spec', node_copy(g[2])) + setglue(f, g.width, g.stretch, g.shrink) return f, g.ratio, g.kanjiskip_natural, g.kanjiskip_stretch, g.kanjiskip_shrink - else - return node_copy(g[2]), g.ratio, false, false, false end end return false, 0 @@ -756,14 +733,13 @@ do local k = 2*getid(gb) - getid(ga) if k == bg_ag then - local bs, as = getfield(gb, 'spec'), getfield(ga, 'spec') -- 両方とも glue. - setfield(bs, 'width', blend_diffmet( - getfield(bs, 'width'), getfield(as, 'width'), db, da)) - setfield(bs, 'stretch', blend_diffmet( - getfield(bs, 'stretch'), getfield(as, 'stretch'), db, da)) - setfield(bs, 'shrink', -blend_diffmet( - -getfield(bs, 'shrink'), -getfield(as, 'shrink'), db, da)) + setglue(gb, blend_diffmet( + getfield(gb, 'width'), getfield(ga, 'width'), db, da), + blend_diffmet( + getfield(gb, 'stretch'), getfield(ga, 'stretch'), db, da), + -blend_diffmet( + -getfield(gb, 'shrink'), -getfield(ga, 'shrink'), db, da)) node_free(ga) return gb elseif k == bk_ak then @@ -773,25 +749,23 @@ do node_free(ga) return gb elseif k == bk_ag then - local as = getfield(ga, 'spec') -- gb: kern, ga: glue - setfield(as, 'width', blend_diffmet( - getfield(gb, 'kern'), getfield(as, 'width'), db, da)) - setfield(as, 'stretch', blend_diffmet( - 0, getfield(as, 'stretch'), db, da)) - setfield(as, 'shrink', -blend_diffmet( - 0, -getfield(as, 'shrink'), db, da)) + setglue(ga, blend_diffmet( + getfield(gb, 'kern'), getfield(ga, 'width'), db, da), + blend_diffmet( + 0, getfield(ga, 'stretch'), db, da), + -blend_diffmet( + 0, -getfield(ga, 'shrink'), db, da)) node_free(gb) return ga, 0, 0, 0 else - local bs = getfield(gb, 'spec') -- gb: glue, ga: kern - setfield(bs, 'width', blend_diffmet( - getfield(bs, 'width'), getfield(ga, 'kern'), db, da)) - setfield(bs, 'stretch', blend_diffmet( - getfield(bs, 'stretch'), 0, db, da)) - setfield(bs, 'shrink', -blend_diffmet( - -getfield(bs, 'shrink'), 0, db, da)) + setglue(gb, blend_diffmet( + getfield(gb, 'width'), getfield(ga, 'kern'), db, da), + blend_diffmet( + getfield(gb, 'stretch'), 0, db, da), + -blend_diffmet( + -getfield(gb, 'shrink'), 0, db, da)) node_free(ga) return gb end @@ -810,26 +784,21 @@ do if flag or (qm.with_kanjiskip and (bn or bp or bh)) then if kanjiskip_jfm_flag then local g = node_new(id_glue); - local gx = node_new(id_glue_spec); - setfield(gx, 'stretch_order', 0); setfield(gx, 'shrink_order', 0) local bk = qm.kanjiskip or null_skip_table - setfield(gx, 'width', bn and (bn*bk[1]) or 0) - setfield(gx, 'stretch', bp and (bp*bk[2]) or 0) - setfield(gx, 'shrink', bh and (bh*bk[3]) or 0) - setfield(g, 'spec', gx) + setglue(g, bn and (bn*bk[1]) or 0, + bp and (bp*bk[2]) or 0, + bh and (bh*bk[3]) or 0, 0, 0) set_attr(g, attr_icflag, KANJI_SKIP_JFM) return g elseif flag then return node_copy(kanji_skip) else local g = node_new(id_glue); - local gx = node_new(id_glue_spec); - setfield(gx, 'stretch_order', 0); setfield(gx, 'shrink_order', 0) - local ks = getfield(kanji_skip, 'spec') - setfield(gx, 'width', bn and (bn*getfield(ks, 'width')) or 0) - setfield(gx, 'stretch', bp and (bp*getfield(ks, 'stretch')) or 0) - setfield(gx, 'shrink', bh and (bh*getfield(ks, 'shrink')) or 0) - setfield(g, 'spec', gx) + setglue(g, + bn and (bn*getfield(kanji_skip, 'width')) or 0, + bp and (bp*getfield(kanji_skip, 'stretch')) or 0, + bh and (bh*getfield(kanji_skip, 'shrink')) or 0, + 0, 0) set_attr(g, attr_icflag, KANJI_SKIP_JFM) return g end @@ -840,14 +809,14 @@ do if Np.auto_kspc or Nq.auto_kspc then local pm, qm = Np.met, Nq.met if (pm.char_type==qm.char_type) and (qm.var==pm.var) then - return get_kanjiskip_low(true, qm, 1, 1, 1) + return get_kanjiskip_low(true, qm, 1, 1, 1) else local gb = get_kanjiskip_low(true, qm, 1, 1, 1) local ga = get_kanjiskip_low(true, pm, 1, 1, 1) return calc_ja_ja_aux(gb, ga, 0, 1) end else - local g = node_copy(zero_glue) + local g = node_new(id_glue) set_attr(g, attr_icflag, kanjiskip_jfm_flag and KANJI_SKIP_JFM or KANJI_SKIP) return g end @@ -895,26 +864,21 @@ do if flag or (qm.with_kanjiskip and (bn or bp or bh)) then if xkanjiskip_jfm_flag then local g = node_new(id_glue); - local gx = node_new(id_glue_spec); - setfield(gx, 'stretch_order', 0); setfield(gx, 'shrink_order', 0) local bk = qm.xkanjiskip or null_skip_table - setfield(gx, 'width', bn and bk[1] or 0) - setfield(gx, 'stretch', bp and bk[2] or 0) - setfield(gx, 'shrink', bh and bk[3] or 0) - setfield(g, 'spec', gx) + setglue(g, bn and bk[1] or 0, + bp and bk[2] or 0, + bh and bk[3] or 0, 0, 0) set_attr(g, attr_icflag, XKANJI_SKIP_JFM) return g elseif flag then return node_copy(xkanji_skip) else local g = node_new(id_glue); - local gx = node_new(id_glue_spec); - setfield(gx, 'stretch_order', 0); setfield(gx, 'shrink_order', 0) - local ks = getfield(xkanji_skip, 'spec') - setfield(gx, 'width', bn and getfield(ks, 'width') or 0) - setfield(gx, 'stretch', bp and getfield(ks, 'stretch') or 0) - setfield(gx, 'shrink', bh and getfield(ks, 'shrink') or 0) - setfield(g, 'spec', gx) + setglue(g, + bn and (bn*getfield(xkanji_skip, 'width')) or 0, + bp and (bp*getfield(xkanji_skip, 'stretch')) or 0, + bh and (bh*getfield(xkanji_skip, 'shrink')) or 0, + 0, 0) set_attr(g, attr_icflag, XKANJI_SKIP_JFM) return g end @@ -925,7 +889,7 @@ do if (Nq.xspc>=2) and (Np.xspc%2==1) and (Nq.auto_xspc or Np.auto_xspc) then return get_xkanjiskip_low(true, Nn.met, 1, 1, 1) else - local g = node_copy(zero_glue) + local g = node_new(id_glue) set_attr(g, attr_icflag, xkanjiskip_jfm_flag and XKANJI_SKIP_JFM or XKANJI_SKIP) return g end @@ -1140,17 +1104,13 @@ do -- ithout this node, set_attr(kanji_skip, ...) somehow creates an "orphaned" attribute list. do - kanji_skip = node_new(id_glue); set_attr(kanji_skip, attr_icflag, KANJI_SKIP) - local s = skip_table_to_spec(KSK) - setfield(kanji_skip, 'spec', s) - kanjiskip_jfm_flag = (getfield(s, 'width') == 1073741823) + kanji_skip, kanjiskip_jfm_flag = skip_table_to_glue(KSK) + set_attr(kanji_skip, attr_icflag, KANJI_SKIP) end do - xkanji_skip = node_new(id_glue); set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP) - local s = skip_table_to_spec(XSK) - setfield(xkanji_skip, 'spec', s) - xkanjiskip_jfm_flag = (getfield(s, 'width') == 1073741823) + xkanji_skip, xkanjiskip_jfm_flag = skip_table_to_glue(XSK) + set_attr(xkanji_skip, attr_icflag, XKANJI_SKIP) end if mode then @@ -1226,8 +1186,8 @@ end do local IHB = luatexja.userid_table.IHB local BPAR = luatexja.userid_table.BPAR - local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev - local node_write = Dnode.write + local node_prev = node.direct.getprev + local node_write = node.direct.write -- \inhibitglue function create_inhibitglue_node() diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index 879d0b85b73..2bd7258bbfc 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -3,7 +3,7 @@ -- luatexbase.provides_module({ name = 'luatexja.jfont', - date = '2016/03/31', + date = '2016/04/03', description = 'Loader for Japanese fonts', }) module('luatexja.jfont', package.seeall) @@ -13,19 +13,14 @@ luatexja.load_module('charrange'); local ltjc = luatexja.charrange luatexja.load_module('rmlgbm'); local ltjr = luatexja.rmlgbm luatexja.load_module('direction'); local ltjd = luatexja.direction +local setfield = node.direct.setfield +local getid = node.direct.getid +local to_direct = node.direct.todirect -local Dnode = node.direct or node - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end - -local nullfunc = function(n) return n end -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local node_new = Dnode.new -local node_free = Dnode.free -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute +local node_new = node.direct.new +local node_free = node.direct.free +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute local round = tex.round local font_getfont = font.getfont @@ -34,11 +29,8 @@ local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] local attr_curtfnt = luatexbase.attributes['ltj@curtfnt'] local id_glyph = node.id('glyph') local id_kern = node.id('kern') -local id_glue_spec = node.id('glue_spec') -local id_glue = node.id('glue') local cat_lp = luatexbase.catcodetables['latex-package'] local FROM_JFM = luatexja.icflag_table.FROM_JFM -local tokenlib = luatexja.token ------------------------------------------------------------------------ -- LOADING JFM ------------------------------------------------------------------------ @@ -165,27 +157,22 @@ do ((v.align=='right') and 1 or 0.5) if type(i) == 'number' then -- char_type for k,w in pairs(v.glue) do - local h = node_new(id_glue_spec) v[k] = { - true, h, + nil, ratio=w.ratio/sz, priority=FROM_JFM + w.priority/sz, + width = w[1], stretch = w[2], shrink = w[3], kanjiskip_natural = w.kanjiskip_natural and w.kanjiskip_natural/sz, kanjiskip_stretch = w.kanjiskip_stretch and w.kanjiskip_stretch/sz, kanjiskip_shrink = w.kanjiskip_shrink and w.kanjiskip_shrink/sz, } - setfield(h, 'width', w[1]) - setfield(h, 'stretch', w[2]) - setfield(h, 'shrink', w[3]) - setfield(h, 'stretch_order', 0) - setfield(h, 'shrink_order', 0) end for k,w in pairs(v.kern) do local g = node_new(id_kern) setfield(g, 'kern', w[1]) setfield(g, 'subtype', 1) set_attr(g, attr_icflag, FROM_JFM) - v[k] = {false, g, ratio=w[2]/sz} + v[k] = {g, ratio=w[2]/sz} end end v.glue, v.kern = nil, nil @@ -661,14 +648,13 @@ do for k,w in pairs(v) do if type(k)=='number' then --if w[1] then gs = gs + 1 else ke = ke + 1 end - node_free(w[2]) + if w[1] then node_free(w[1]) end end end end n.size_cache[i]=nil end end - --print('glue spec: ', gs, 'kern: ', ke) end end @@ -943,12 +929,12 @@ end -- MISC ------------------------------------------------------------------------ do - local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end - local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end + local getfont = node.direct.getfont + local getchar = node.direct.getchar local get_dir_count = ltjd.get_dir_count local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct local ensure_tex_attr = ltjb.ensure_tex_attr - local node_write = Dnode.write + local node_write = node.direct.write local font = font local new_ic_kern if status.luatex_version>=89 then diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua deleted file mode 100644 index 7204c11c820..00000000000 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-kinsoku.lua +++ /dev/null @@ -1,1033 +0,0 @@ -return { - [0]=500, - { - ["shrink"]=26214, - ["shrink_order"]=0, - ["stretch"]=26214, - ["stretch_order"]=0, - ["width"]=0, - }, - { - ["shrink"]=65536, - ["shrink_order"]=0, - ["stretch"]=65536, - ["stretch_order"]=0, - ["width"]=157649, - }, - [256]=51, - [512]=52, - [768]=53, - [1024]=12295, - [1025]=19968, - [1026]=20108, - [1027]=19977, - [1028]=22235, - [1029]=20116, - [1030]=20845, - [1031]=19971, - [1032]=20843, - [1033]=20061, - [2097185]=10000, - [2097186]=10000, - [2097191]=10000, - [2097193]=10000, - [2097194]=500, - [2097195]=500, - [2097197]=10000, - [2097198]=10000, - [2097199]=500, - [2097210]=10000, - [2097211]=10000, - [2097215]=10000, - [2097245]=10000, - [2097322]=10000, - [2097330]=10000, - [2097331]=10000, - [2097332]=10000, - [2097337]=10000, - [2097338]=10000, - [2097339]=10000, - [2097872]=10000, - [2105369]=10000, - [2105373]=10000, - [2105381]=250, - [2105382]=250, - [2105404]=10000, - [2105415]=10000, - [2105416]=10000, - [2105417]=10000, - [2105634]=10000, - [2105874]=200, - [2107782]=10000, - [2109441]=10000, - [2109442]=10000, - [2109445]=10000, - [2109449]=10000, - [2109451]=10000, - [2109453]=10000, - [2109455]=10000, - [2109457]=10000, - [2109461]=10000, - [2109463]=10000, - [2109465]=10000, - [2109471]=10000, - [2109491]=10000, - [2109492]=10000, - [2109493]=10000, - [2109499]=10000, - [2109505]=150, - [2109507]=150, - [2109509]=150, - [2109511]=150, - [2109513]=150, - [2109539]=150, - [2109571]=150, - [2109573]=150, - [2109575]=150, - [2109582]=150, - [2109589]=150, - [2109590]=150, - [2109595]=10000, - [2109596]=10000, - [2109597]=10000, - [2109598]=10000, - [2109601]=150, - [2109603]=150, - [2109605]=150, - [2109607]=150, - [2109609]=150, - [2109635]=150, - [2109667]=150, - [2109669]=150, - [2109671]=150, - [2109678]=150, - [2109685]=150, - [2109686]=150, - [2109691]=10000, - [2109692]=10000, - [2109693]=10000, - [2109694]=10000, - [2109936]=150, - [2109937]=150, - [2109938]=150, - [2109939]=150, - [2109940]=150, - [2109941]=150, - [2109942]=150, - [2109943]=150, - [2109944]=150, - [2109945]=150, - [2109946]=150, - [2109947]=150, - [2109948]=150, - [2109949]=150, - [2109950]=150, - [2109951]=150, - [2162433]=10000, - [2162441]=10000, - [2162443]=200, - [2162444]=10000, - [2162445]=200, - [2162446]=10000, - [2162458]=10000, - [2162459]=10000, - [2162461]=200, - [2162463]=10000, - [2162493]=10000, - [2162525]=10000, - [2162528]=10000, - [2162529]=10000, - [2162531]=10000, - [2162532]=10000, - [2162590]=10000, - [2162591]=10000, - [4194339]=500, - [4194340]=500, - [4194341]=500, - [4194342]=500, - [4194344]=10000, - [4194395]=10000, - [4194400]=10000, - [4194465]=10000, - [4194475]=10000, - [4194495]=10000, - [4202520]=10000, - [4202524]=10000, - [4202668]=10000, - [4204933]=10000, - [4206600]=10000, - [4206602]=10000, - [4206604]=10000, - [4206606]=10000, - [4206608]=10000, - [4206612]=10000, - [4206614]=10000, - [4206616]=10000, - [4206621]=10000, - [4259587]=200, - [4259588]=200, - [4259589]=200, - [4259590]=200, - [4259592]=10000, - [4259643]=10000, - [4259648]=10000, - [4259675]=10000, - [4259679]=10000, - [4259682]=10000, - [6299648]=1, - [6299649]=1, - [6299650]=1, - [6299651]=1, - [6299652]=1, - [6299653]=1, - [6299654]=1, - [6299655]=1, - [6299656]=1, - [6299657]=1, - [6299658]=1, - [6299659]=1, - [6299660]=1, - [6299661]=1, - [6299662]=1, - [6299663]=1, - [6299664]=1, - [6299665]=1, - [6299666]=1, - [6299667]=1, - [6299668]=1, - [6299669]=1, - [6299670]=1, - [6299671]=1, - [6299672]=1, - [6299673]=1, - [6299674]=1, - [6299675]=1, - [6299676]=1, - [6299677]=1, - [6299678]=1, - [6299679]=1, - [6299680]=1, - [6299681]=1, - [6299682]=1, - [6299683]=1, - [6299684]=1, - [6299685]=1, - [6299686]=1, - [6299687]=1, - [6299688]=1, - [6299689]=1, - [6299690]=1, - [6299691]=1, - [6299692]=1, - [6299693]=1, - [6299694]=1, - [6299695]=1, - [6299696]=1, - [6299697]=1, - [6299698]=1, - [6299699]=1, - [6299700]=1, - [6299701]=1, - [6299702]=1, - [6299703]=1, - [6299704]=1, - [6299705]=1, - [6299706]=1, - [6299707]=1, - [6299708]=1, - [6299709]=1, - [6299710]=1, - [6299711]=1, - [6299712]=1, - [6299713]=1, - [6299714]=1, - [6299715]=1, - [6299716]=1, - [6299717]=1, - [6299718]=1, - [6299719]=1, - [6299720]=1, - [6299721]=1, - [6299722]=1, - [6299723]=1, - [6299724]=1, - [6299725]=1, - [6299726]=1, - [6299727]=1, - [6299728]=1, - [6299729]=1, - [6299730]=1, - [6299731]=1, - [6299732]=1, - [6299733]=1, - [6299734]=1, - [6299735]=1, - [6299736]=1, - [6299737]=1, - [6299738]=1, - [6299739]=1, - [6299740]=1, - [6299741]=1, - [6299742]=1, - [6299743]=1, - [6299744]=1, - [6299745]=1, - [6299746]=1, - [6299747]=1, - [6299748]=1, - [6299749]=1, - [6299750]=1, - [6299751]=1, - [6299752]=1, - [6299753]=1, - [6299754]=1, - [6299755]=1, - [6299756]=1, - [6299757]=1, - [6299758]=1, - [6299759]=1, - [6303744]=1, - [6303745]=1, - [6303746]=1, - [6303747]=1, - [6303748]=1, - [6303749]=1, - [6303750]=1, - [6303751]=1, - [6303752]=1, - [6303753]=1, - [6303754]=1, - [6303755]=1, - [6303756]=1, - [6303757]=1, - [6303758]=1, - [6303759]=1, - [6303760]=1, - [6303761]=1, - [6303762]=1, - [6303763]=1, - [6303764]=1, - [6303765]=1, - [6303766]=1, - [6303767]=1, - [6303768]=1, - [6303769]=1, - [6303770]=1, - [6303771]=1, - [6303772]=1, - [6303773]=1, - [6303774]=1, - [6303775]=1, - [6303776]=1, - [6303777]=1, - [6303778]=1, - [6303779]=1, - [6303780]=1, - [6303781]=1, - [6303782]=1, - [6303783]=1, - [6303784]=1, - [6303785]=1, - [6303786]=1, - [6303787]=1, - [6303788]=1, - [6303789]=1, - [6303790]=1, - [6303791]=1, - [6303792]=1, - [6303793]=1, - [6303794]=1, - [6303795]=1, - [6303796]=1, - [6303797]=1, - [6303798]=1, - [6303799]=1, - [6303800]=1, - [6303801]=1, - [6303802]=1, - [6303803]=1, - [6303804]=1, - [6303805]=1, - [6303806]=1, - [6303807]=1, - [6356736]=1, - [6356737]=1, - [6356738]=1, - [6356739]=1, - [6356740]=1, - [6356741]=1, - [6356742]=1, - [6356743]=1, - [6356744]=1, - [6356745]=1, - [6356746]=1, - [6356747]=1, - [6356748]=1, - [6356749]=1, - [6356750]=1, - [6356751]=1, - [6356752]=1, - [6356753]=1, - [6356754]=1, - [6356755]=1, - [6356756]=1, - [6356757]=1, - [6356758]=1, - [6356759]=1, - [6356760]=1, - [6356761]=1, - [6356762]=1, - [6356763]=1, - [6356764]=1, - [6356765]=1, - [6356766]=1, - [6356767]=1, - [6356768]=1, - [6356769]=1, - [6356770]=1, - [6356771]=1, - [6356772]=1, - [6356773]=1, - [6356774]=1, - [6356775]=1, - [6356776]=1, - [6356777]=1, - [6356778]=1, - [6356779]=1, - [6356780]=1, - [6356781]=1, - [6356782]=1, - [6356783]=1, - [6356784]=1, - [6356785]=1, - [6356786]=1, - [6356787]=1, - [6356788]=1, - [6356789]=1, - [6356790]=1, - [6356791]=1, - [6356792]=1, - [6356793]=1, - [6356794]=1, - [6356795]=1, - [6356796]=1, - [6356797]=1, - [6356798]=1, - [6356799]=1, - [6356800]=1, - [6356801]=1, - [6356802]=1, - [6356803]=1, - [6356804]=1, - [6356805]=1, - [6356806]=1, - [6356807]=1, - [6356808]=1, - [6356809]=1, - [6356810]=1, - [6356811]=1, - [6356812]=1, - [6356813]=1, - [6356814]=1, - [6356815]=1, - [6356816]=1, - [6356817]=1, - [6356818]=1, - [6356819]=1, - [6356820]=1, - [6356821]=1, - [6356822]=1, - [6356823]=1, - [6356824]=1, - [6356825]=1, - [6356826]=1, - [6356827]=1, - [6356828]=1, - [6356829]=1, - [6356830]=1, - [6356831]=1, - [6356832]=1, - [6356833]=1, - [6356834]=1, - [6356835]=1, - [6356836]=1, - [6356837]=1, - [6356838]=1, - [6356839]=1, - [6356840]=1, - [6356841]=1, - [6356842]=1, - [6356843]=1, - [6356844]=1, - [6356845]=1, - [6356846]=1, - [6356847]=1, - [6356848]=1, - [6356849]=1, - [6356850]=1, - [6356851]=1, - [6356852]=1, - [6356853]=1, - [6356854]=1, - [6356855]=1, - [6356856]=1, - [6356857]=1, - [6356858]=1, - [6356859]=1, - [6356860]=1, - [6356861]=1, - [6356862]=1, - [6356863]=1, - [6356864]=1, - [6356865]=1, - [6356866]=1, - [6356867]=1, - [6356868]=1, - [6356869]=1, - [6356870]=1, - [6356871]=1, - [6356872]=1, - [6356873]=1, - [6356874]=1, - [6356875]=1, - [6356876]=1, - [6356877]=1, - [6356878]=1, - [6356879]=1, - [6356880]=1, - [6356881]=1, - [6356882]=1, - [6356883]=1, - [6356884]=1, - [6356885]=1, - [6356886]=1, - [6356887]=1, - [6356888]=1, - [6356889]=1, - [6356890]=1, - [6356891]=1, - [6356892]=1, - [6356893]=1, - [6356894]=1, - [6356895]=1, - [6356896]=1, - [6356897]=1, - [6356898]=1, - [6356899]=1, - [6356900]=1, - [6356901]=1, - [6356902]=1, - [6356903]=1, - [6356904]=1, - [6356905]=1, - [6356906]=1, - [6356907]=1, - [6356908]=1, - [6356909]=1, - [6356910]=1, - [6356911]=1, - [6356912]=1, - [6356913]=1, - [6356914]=1, - [6356915]=1, - [6356916]=1, - [6356917]=1, - [6356918]=1, - [6356919]=1, - [6356920]=1, - [6356921]=1, - [6356922]=1, - [6356923]=1, - [6356924]=1, - [6356925]=1, - [6356926]=1, - [6356927]=1, - [6356928]=1, - [6356929]=1, - [6356930]=1, - [6356931]=1, - [6356932]=1, - [6356933]=1, - [6356934]=1, - [6356935]=1, - [6356936]=1, - [6356937]=1, - [6356938]=1, - [6356939]=1, - [6356940]=1, - [6356941]=1, - [6356942]=1, - [6356943]=1, - [6356944]=1, - [6356945]=1, - [6356946]=1, - [6356947]=1, - [6356948]=1, - [6356949]=1, - [6356950]=1, - [6356951]=1, - [6356952]=1, - [6356953]=1, - [6356954]=1, - [6356955]=1, - [6356956]=1, - [6356957]=1, - [6356958]=1, - [6356959]=1, - [6356960]=1, - [6356961]=1, - [6356962]=1, - [6356963]=1, - [6356964]=1, - [6356965]=1, - [6356966]=1, - [6356967]=1, - [6356968]=1, - [6356969]=1, - [6356970]=1, - [6356971]=1, - [6356972]=1, - [6356973]=1, - [6356974]=1, - [6356975]=1, - [8388608]=0, - [8388609]=0, - [8388610]=0, - [8388611]=0, - [8388612]=0, - [8388613]=0, - [8388614]=0, - [8388615]=0, - [8388616]=0, - [8388617]=0, - [8388618]=0, - [8388619]=0, - [8388620]=0, - [8388621]=0, - [8388622]=0, - [8388623]=0, - [8388624]=0, - [8388625]=0, - [8388626]=0, - [8388627]=0, - [8388628]=0, - [8388629]=0, - [8388630]=0, - [8388631]=0, - [8388632]=0, - [8388633]=0, - [8388634]=0, - [8388635]=0, - [8388636]=0, - [8388637]=0, - [8388638]=0, - [8388639]=0, - [8388640]=0, - [8388641]=0, - [8388642]=0, - [8388643]=0, - [8388644]=0, - [8388645]=0, - [8388646]=0, - [8388647]=2, - [8388648]=1, - [8388649]=2, - [8388650]=0, - [8388651]=0, - [8388652]=2, - [8388653]=0, - [8388654]=2, - [8388655]=0, - [8388656]=3, - [8388657]=3, - [8388658]=3, - [8388659]=3, - [8388660]=3, - [8388661]=3, - [8388662]=3, - [8388663]=3, - [8388664]=3, - [8388665]=3, - [8388666]=0, - [8388667]=2, - [8388668]=0, - [8388669]=0, - [8388670]=0, - [8388671]=0, - [8388672]=0, - [8388673]=3, - [8388674]=3, - [8388675]=3, - [8388676]=3, - [8388677]=3, - [8388678]=3, - [8388679]=3, - [8388680]=3, - [8388681]=3, - [8388682]=3, - [8388683]=3, - [8388684]=3, - [8388685]=3, - [8388686]=3, - [8388687]=3, - [8388688]=3, - [8388689]=3, - [8388690]=3, - [8388691]=3, - [8388692]=3, - [8388693]=3, - [8388694]=3, - [8388695]=3, - [8388696]=3, - [8388697]=3, - [8388698]=3, - [8388699]=1, - [8388700]=0, - [8388701]=2, - [8388702]=0, - [8388703]=0, - [8388704]=1, - [8388705]=3, - [8388706]=3, - [8388707]=3, - [8388708]=3, - [8388709]=3, - [8388710]=3, - [8388711]=3, - [8388712]=3, - [8388713]=3, - [8388714]=3, - [8388715]=3, - [8388716]=3, - [8388717]=3, - [8388718]=3, - [8388719]=3, - [8388720]=3, - [8388721]=3, - [8388722]=3, - [8388723]=3, - [8388724]=3, - [8388725]=3, - [8388726]=3, - [8388727]=3, - [8388728]=3, - [8388729]=3, - [8388730]=3, - [8388731]=0, - [8388732]=0, - [8388733]=0, - [8388734]=0, - [8388735]=0, - [8388736]=3, - [8388737]=3, - [8388738]=3, - [8388739]=3, - [8388740]=3, - [8388741]=3, - [8388742]=3, - [8388743]=3, - [8388744]=3, - [8388745]=3, - [8388746]=3, - [8388747]=3, - [8388748]=3, - [8388749]=3, - [8388750]=3, - [8388751]=3, - [8388752]=3, - [8388753]=3, - [8388754]=3, - [8388755]=3, - [8388756]=3, - [8388757]=3, - [8388758]=3, - [8388759]=3, - [8388760]=3, - [8388761]=3, - [8388762]=3, - [8388763]=3, - [8388764]=3, - [8388765]=3, - [8388766]=3, - [8388767]=3, - [8388768]=3, - [8388769]=1, - [8388770]=3, - [8388771]=3, - [8388772]=3, - [8388773]=0, - [8388774]=3, - [8388775]=3, - [8388776]=3, - [8388777]=3, - [8388778]=2, - [8388779]=1, - [8388780]=3, - [8388781]=3, - [8388782]=3, - [8388783]=3, - [8388784]=2, - [8388785]=3, - [8388786]=2, - [8388787]=2, - [8388788]=3, - [8388789]=3, - [8388790]=3, - [8388791]=3, - [8388792]=3, - [8388793]=2, - [8388794]=2, - [8388795]=2, - [8388796]=3, - [8388797]=3, - [8388798]=3, - [8388799]=1, - [8388800]=3, - [8388801]=3, - [8388802]=3, - [8388803]=3, - [8388804]=3, - [8388805]=3, - [8388806]=3, - [8388807]=3, - [8388808]=3, - [8388809]=3, - [8388810]=3, - [8388811]=3, - [8388812]=3, - [8388813]=3, - [8388814]=3, - [8388815]=3, - [8388816]=3, - [8388817]=3, - [8388818]=3, - [8388819]=3, - [8388820]=3, - [8388821]=3, - [8388822]=3, - [8388823]=3, - [8388824]=3, - [8388825]=3, - [8388826]=3, - [8388827]=3, - [8388828]=3, - [8388829]=3, - [8388830]=3, - [8388831]=3, - [8388832]=3, - [8388833]=3, - [8388834]=3, - [8388835]=3, - [8388836]=3, - [8388837]=3, - [8388838]=3, - [8388839]=3, - [8388840]=3, - [8388841]=3, - [8388842]=3, - [8388843]=3, - [8388844]=3, - [8388845]=3, - [8388846]=3, - [8388847]=3, - [8388848]=3, - [8388849]=3, - [8388850]=3, - [8388851]=3, - [8388852]=3, - [8388853]=3, - [8388854]=3, - [8388855]=3, - [8388856]=3, - [8388857]=3, - [8388858]=3, - [8388859]=3, - [8388860]=3, - [8388861]=3, - [8388862]=3, - [8388863]=3, - [8396820]=0, - [8396821]=0, - [8396824]=1, - [8396825]=2, - [8396828]=1, - [8396829]=2, - [8396838]=0, - [8396850]=2, - [8396851]=2, - [8396860]=2, - [8396871]=2, - [8396872]=2, - [8396873]=2, - [8396972]=1, - [8397090]=2, - [8398080]=0, - [8398081]=0, - [8398082]=0, - [8398083]=0, - [8398084]=0, - [8398085]=0, - [8398086]=0, - [8398087]=0, - [8398088]=0, - [8398089]=0, - [8398090]=0, - [8398091]=0, - [8398092]=0, - [8398093]=0, - [8398094]=0, - [8398095]=0, - [8398096]=0, - [8398097]=0, - [8398098]=0, - [8398099]=0, - [8398100]=0, - [8398101]=0, - [8398102]=0, - [8398103]=0, - [8398104]=0, - [8398105]=0, - [8398106]=0, - [8398107]=0, - [8398108]=0, - [8398109]=0, - [8398110]=0, - [8398111]=0, - [8398112]=0, - [8398113]=0, - [8398114]=0, - [8398115]=0, - [8398116]=0, - [8398117]=0, - [8398118]=0, - [8398119]=0, - [8398120]=0, - [8398121]=0, - [8398122]=0, - [8398123]=0, - [8398124]=0, - [8398125]=0, - [8398126]=0, - [8398127]=0, - [8398128]=0, - [8398129]=0, - [8398130]=0, - [8398131]=0, - [8398132]=0, - [8398133]=0, - [8398134]=0, - [8398135]=0, - [8398136]=0, - [8398137]=0, - [8398138]=0, - [8398139]=0, - [8398140]=0, - [8398141]=0, - [8398142]=0, - [8398143]=0, - [8398144]=0, - [8398145]=0, - [8398146]=0, - [8398147]=0, - [8398148]=0, - [8398149]=0, - [8398150]=0, - [8398151]=0, - [8398152]=0, - [8398153]=0, - [8398154]=0, - [8398155]=0, - [8398156]=0, - [8398157]=0, - [8398158]=0, - [8398159]=0, - [8398160]=0, - [8398161]=0, - [8398162]=0, - [8398163]=0, - [8398164]=0, - [8398165]=0, - [8398166]=0, - [8398167]=0, - [8398168]=0, - [8398169]=0, - [8398170]=0, - [8398171]=0, - [8398172]=0, - [8398173]=0, - [8398174]=0, - [8398175]=0, - [8398176]=0, - [8398177]=0, - [8398178]=0, - [8398179]=0, - [8398180]=0, - [8398181]=0, - [8398182]=0, - [8398183]=0, - [8398184]=0, - [8398185]=0, - [8398186]=0, - [8398187]=0, - [8398188]=0, - [8398189]=0, - [8398190]=0, - [8398191]=0, - [8398192]=0, - [8398193]=0, - [8398194]=0, - [8398195]=0, - [8398196]=0, - [8398197]=0, - [8398198]=0, - [8398199]=0, - [8398200]=0, - [8398201]=0, - [8398202]=0, - [8398203]=0, - [8398204]=0, - [8398205]=0, - [8398206]=0, - [8398207]=0, - [8399237]=1, - [8399238]=2, - [8400897]=2, - [8400898]=2, - [8400904]=1, - [8400905]=2, - [8400906]=1, - [8400907]=2, - [8400908]=1, - [8400909]=2, - [8400910]=1, - [8400911]=2, - [8400912]=1, - [8400913]=2, - [8400916]=1, - [8400917]=2, - [8400918]=1, - [8400919]=2, - [8400920]=1, - [8400921]=2, - [8400924]=0, - [8400925]=1, - [8400927]=2, - [8453896]=1, - [8453897]=2, - [8453900]=2, - [8453902]=2, - [8453915]=2, - [8453919]=2, - [8453947]=1, - [8453949]=2, - [8453979]=1, - [8453981]=2, - [8453982]=0, - [8453983]=1, - [8453984]=2, - [8453985]=2, - [8453986]=1, - [8453987]=2, - [8453988]=2, - [8454117]=0, -} diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua index 3ea3d4c184c..abb50ece53b 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua @@ -9,27 +9,24 @@ luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('setwidth'); local ltjw = luatexja.setwidth -local Dnode = node.direct or node - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end +local setfield = node.direct.setfield +local getfield = node.direct.getfield +local getid = node.direct.getid +local getsubtype = node.direct.getsubtype +local getlist = node.direct.getlist -- getlist cannot be used for sub_box nodes. Use instead λp. getfield(p, 'head') -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end - -local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local node_traverse = Dnode.traverse -local node_new = Dnode.new -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local node_remove = Dnode.remove -local node_free = Dnode.free -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute +local getchar = node.direct.getchar + +local to_node = node.direct.tonode +local to_direct = node.direct.todirect + +local node_traverse = node.direct.traverse +local node_new = node.direct.new +local node_next = node.direct.getnext +local node_remove = node.direct.remove +local node_free = node.direct.free +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute local tex_getcount = tex.getcount local attr_jchar_class = luatexbase.attributes['ltj@charclass'] @@ -168,7 +165,6 @@ function (p, sty) return p end -local node_remove = Dnode.remove luatexbase.add_to_callback('mlist_to_hlist', function (n, display_type, penalties) n = to_direct(n); list_dir = ltjd_get_dir_count() diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua index 75494d6428f..d13cff277b4 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-otf.lua @@ -15,30 +15,26 @@ local id_glyph = node.id('glyph') local id_whatsit = node.id('whatsit') local sid_user = node.subtype('user_defined') -local Dnode = node.direct or node +local setfield = node.direct.setfield +local getfield = node.direct.getfield +local getid = node.direct.getid +local getfont = node.direct.getfont +local getchar = node.direct.getchar +local getsubtype = node.direct.getsubtype -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end ---local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end +local to_node = node.direct.tonode +local to_direct = node.direct.todirect -local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local node_new = Dnode.new -local node_remove = Dnode.remove -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local node_free = Dnode.free -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local unset_attr = Dnode.unset_attribute -local node_insert_after = Dnode.insert_after -local node_write = Dnode.write -local node_traverse_id = Dnode.traverse_id +local node_new = node.direct.new +local node_remove = node.direct.remove +local node_next = node.direct.getnext +local node_free = node.direct.free +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local unset_attr = node.direct.unset_attribute +local node_insert_after = node.direct.insert_after +local node_write = node.direct.write +local node_traverse_id = node.direct.traverse_id local attr_curjfnt = luatexbase.attributes['ltj@curjfnt'] diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua index f95ae5f61fa..8712f570ffb 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-pretreat.lua @@ -8,28 +8,25 @@ luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('direction'); local ltjd = luatexja.direction -local Dnode = node.direct or node +local to_node = node.direct.tonode +local to_direct = node.direct.todirect -local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end +local setfield = node.direct.setfield +local getid = node.direct.getid +local getfont = node.direct.getfont +local getchar = node.direct.getchar +local getfield = node.direct.getfield +local getsubtype = node.direct.getsubtype local pairs = pairs local floor = math.floor -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local node_traverse = Dnode.traverse -local node_remove = Dnode.remove -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local node_free = Dnode.free -local node_end_of_math = Dnode.end_of_math +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local node_traverse = node.direct.traverse +local node_remove = node.direct.remove +local node_next = node.direct.getnext +local node_free = node.direct.free +local node_end_of_math = node.direct.end_of_math local tex_getcount = tex.getcount local id_glyph = node.id('glyph') @@ -137,7 +134,7 @@ local function set_box_stack_level(head, mode) node_free(p) end if ltjs.list_dir == dir_tate then - for p in Dnode.traverse_id(id_glyph,to_direct(head)) do + for p in node.direct.traverse_id(id_glyph,to_direct(head)) do if (has_attr(p, attr_icflag) or 0)<=0 and getfield(p, 'lang')==lang_ja then local pc = ltjs_orig_char_table[p] local nf = ltjf_replace_altfont( has_attr(p, attr_curtfnt) or getfont(p) , pc) diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua index da638f5486d..bf57c77208c 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-ruby.lua @@ -11,25 +11,24 @@ local err, warn, info, log = luatexbase.errwarinf(_NAME) luatexja.load_module('stack'); local ltjs = luatexja.stack -local Dnode = node.direct or node -local nullfunc = function(n) return n end -local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc -local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc - -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end - -local node_new = Dnode.new -local node_remove = Dnode.remove -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local node_copy, node_free, node_tail = Dnode.copy, Dnode.free, Dnode.tail -local has_attr, set_attr = Dnode.has_attribute, Dnode.set_attribute -local insert_before, insert_after = Dnode.insert_before, Dnode.insert_after +local to_node = node.direct.tonode +local to_direct = node.direct.todirect + +local setfield = node.direct.setfield +local setglue = luatexja.setglue +local getfield = node.direct.getfield +local getid = node.direct.getid +local getfont = node.direct.getfont +local getlist = node.direct.getlist +local getchar = node.direct.getchar +local getsubtype = node.direct.getsubtype + +local node_new = node.direct.new +local node_remove = node.direct.remove +local node_next = node.direct.getnext +local node_copy, node_free, node_tail = node.direct.copy, node.direct.free, node.direct.tail +local has_attr, set_attr = node.direct.has_attribute, node.direct.set_attribute +local insert_before, insert_after = node.direct.insert_before, node.direct.insert_after local id_hlist = node.id('hlist') local id_vlist = node.id('vlist') @@ -38,7 +37,6 @@ local id_whatsit = node.id('whatsit') local id_glue = node.id('glue') local id_kern = node.id('kern') local id_penalty = node.id('penalty') -local id_glue_spec = node.id('glue_spec') local sid_user = node.subtype('user_defined') local ltjs_get_stack_table = luatexja.stack.get_stack_table local id_pbox_w = 258 -- cluster which consists of a whatsit @@ -74,13 +72,11 @@ local RUBY_POST = luatexja.userid_table.RUBY_POST ---------------------------------------------------------------- -- TeX interface 0 ---------------------------------------------------------------- -if Dnode ~= node then - function cpbox() return node_copy(Dnode.getbox(0)) end -else - function cpbox() return node.copy(tex.box[0]) end +do + local getbox = node.direct.getbox + function cpbox() return node_copy(getbox(0)) end end - ---------------------------------------------------------------- -- 補助関数群 1 ---------------------------------------------------------------- @@ -147,7 +143,7 @@ end -- ルビ文字を格納しているボックスでの設定ではない! local concat do - local node_prev = (Dnode ~= node) and Dnode.getprev or node.prev + local node_prev = node.direct.getprev function concat(f, b) if f then if b then @@ -159,7 +155,7 @@ do setfield(f, 'head', nil); node_free(f) setfield(b, 'head', nil); node_free(b) local g = luatexja.jfmglue.main(h,false) - return Dnode.hpack(g) + return node.direct.hpack(g) else return f end @@ -213,47 +209,29 @@ do -- この 5 種類の空白をのばす if getid(hx) == id_kern then local k = node_new(id_glue) - local ks = node_new(id_glue_spec) - setfield(ks, 'width', getfield(hx, 'kern')) - setfield(ks, 'stretch_order', 2) - setfield(ks, 'stretch', round(middle*65536)) - setfield(ks, 'shrink_order', 0); setfield(ks, 'shrink', 0) - setfield(k, 'subtype', 0); setfield(k, 'spec', ks) + setglue(k, getfield(hx, 'kern'), round(middle*65536), 0, + 2, 0) + setfield(k, 'subtype', 0); h = insert_after(h, hx, k); h = node_remove(h, hx); node_free(hx); hx = k else -- glue - local old_spec = getfield(hx, 'spec') - local ks = node_copy(old_spec) - setfield(ks, 'stretch_order', 2) - setfield(ks, 'stretch', round(middle*65536)) - setfield(ks, 'shrink_order', 0); setfield(ks, 'shrink', 0) - setfield(hx, 'spec', ks) - -- decrease old_spec's reference count - local b = node_new(id_glue) - setfield(b, 'spec', old_spec); node_free(b) + setglue(hx, getfield(hx, 'width'), round(middle*65536), 0, + 2, 0) end end hx = node_next(hx) end -- 先頭の空白を挿入 local k = node_new(id_glue); - local ks = node_new(id_glue_spec) - setfield(ks, 'width', prenw) - setfield(ks, 'stretch_order', 2); setfield(ks, 'stretch', round(pre*65536)) - setfield(ks, 'shrink_order', 0); setfield(ks, 'shrink', 0) - setfield(k, 'subtype', 0); setfield(k, 'spec', ks) + setglue(k, prenw, round(pre*65536), 0, 2, 0) h = insert_before(h, h, k); -- 末尾の空白を挿入 local k = node_new(id_glue); - local ks = node_new(id_glue_spec); - setfield(ks, 'width', postnw) - setfield(ks, 'stretch_order', 2); setfield(ks, 'stretch', round(post*65536)) - setfield(ks, 'shrink_order', 0); setfield(ks, 'shrink', 0) - setfield(k, 'subtype', 0);setfield(k, 'spec', ks) + setglue(k, postnw, round(post*65536), 0, 2, 0) insert_after(h, node_tail(h), k); -- hpack setfield(box, 'head', nil); node_free(box) - box = Dnode.hpack(h, new_width, 'exactly') + box = node.direct.hpack(h, new_width, 'exactly') setfield(box, 'height', hh) setfield(box, 'depth', hd) return box @@ -287,7 +265,7 @@ local function texiface_low(rst, rtlr, rtlp) _, n = insert_after(wv, n, rtlp[i]) end -- w.value: (whatsit) .. r1 .. p1 .. r2 .. p2 - Dnode.write(w); return w,wv + node.direct.write(w); return w,wv end -- rst: table @@ -356,7 +334,7 @@ local function enlarge_parent(r, p, ppre, pmid, ppost, mapre, mapost, intmode) local rwidth = rwidth - pre_intrusion - post_intrusion setfield(r, 'width', rwidth) setfield(p, 'width', rwidth) - local ps = getfield(getlist(p), 'spec') + local ps = getlist(p) setfield(ps, 'width', getfield(ps, 'width') - pre_intrusion) return r, p, post_intrusion end @@ -381,18 +359,18 @@ local function new_ruby_box(r, p, ppre, pmid, ppost, local need_repack = false -- margin が大きくなりすぎた時の処理 if round(rpre*getfield(r, 'glue_set')*65536) > max_margin then - local ps = getfield(getlist(r), 'spec'); need_repack = true + local ps = getlist(r); need_repack = true setfield(ps, 'width', max_margin) setfield(ps, 'stretch', 1) -- 全く伸縮しないのも困る end if round(rpost*getfield(r, 'glue_set')*65536) > max_margin then - local ps = getfield(node_tail(getlist(r)), 'spec'); need_repack = true + local ps = node_tail(getlist(r)); need_repack = true setfield(ps, 'width', max_margin) setfield(ps, 'stretch', 1) -- 全く伸縮しないのも困る end if need_repack then local rt = r - r = Dnode.hpack(getlist(r), getfield(r, 'width'), 'exactly') + r = node.direct.hpack(getlist(r), getfield(r, 'width'), 'exactly') setfield(rt, 'head', nil); node_free(rt); end end @@ -401,7 +379,7 @@ local function new_ruby_box(r, p, ppre, pmid, ppost, setfield(a, 'depth', 0); setfield(k, 'kern', rgap) insert_after(r, r, a); insert_after(r, a, k); insert_after(r, k, p); setfield(p, 'next', nil) - a = Dnode.vpack(r); setfield(a, 'shift', 0) + a = node.direct.vpack(r); setfield(a, 'shift', 0) set_attr(a, attr_ruby, post_intrusion) if rsmash or getfield(a, 'height')<getfield(p, 'height') then local k = node_new(id_kern) @@ -471,7 +449,7 @@ local function pre_low_cal_box(w, cmp) -- w.value の node list 更新. local nt = wv - Dnode.flush_list(node_next(wv)) + node.direct.flush_list(node_next(wv)) for i = 1, 2*cmp+1 do setfield(nt, 'next', kf[i]); nt = kf[i] end if cmp==1 then solve_1(coef) @@ -484,7 +462,7 @@ end local first_whatsit do - local traverse_id = Dnode.traverse_id + local traverse_id = node.direct.traverse_id function first_whatsit(n) -- n 以後で最初の whatsit for h in traverse_id(id_whatsit, n) do return h @@ -497,11 +475,8 @@ local next_cluster_array = {} -- ノード追加 local function pre_low_app_node(head, w, cmp, coef, ht, dp) -- メインの node list 更新 - local nt, ntb = node_new(id_glue), node_new(id_glue_spec) - setfield(ntb, 'width', coef[1][2*cmp+2]) - setfield(ntb, 'stretch_order', 0); setfield(ntb, 'stretch', 0) - setfield(ntb, 'shrink_order', 0); setfield(ntb, 'shrink', 0) - setfield(nt, 'subtype', 0); setfield(nt, 'spec', ntb) + local nt = node_new(id_glue) + setglue(nt, coef[1][2*cmp+2], 0, 0, 0, 0) set_attr(nt, attr_ruby, 1); set_attr(w, attr_ruby, 2) head = insert_before(head, w, nt) nt = w @@ -514,16 +489,12 @@ 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 - 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) + setglue(nt, coef[i*2+1][2*cmp+2], 0, 0, 0, 0) set_attr(nt, attr_ruby, 2*i+2) end tex.setattribute('global', attr_ruby, -0x7FFFFFFF) @@ -634,7 +605,7 @@ local function post_high_break(head) local rs = {} -- rs: sequence of ruby_nodes, local rw = nil -- rw: main whatsit local cmp = -2 -- dummy - for h in Dnode.traverse_id(id_hlist, to_direct(head)) do + for h in node.direct.traverse_id(id_hlist, to_direct(head)) do for i = 1, #rs do rs[i] = nil end local ha = getlist(h) while ha do diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua index e18e3a18aeb..aed10da7d99 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-setwidth.lua @@ -7,26 +7,25 @@ luatexja.load_module('stack'); local ltjs = luatexja.stack luatexja.load_module('jfont'); local ltjf = luatexja.jfont luatexja.load_module('direction'); local ltjd = luatexja.direction -local Dnode = node.direct or node -local setfield = (Dnode ~= node) and Dnode.setfield or function(n, i, c) n[i] = c end -local getfield = (Dnode ~= node) and Dnode.getfield or function(n, i) return n[i] end -local getid = (Dnode ~= node) and Dnode.getid or function(n) return n.id end -local getfont = (Dnode ~= node) and Dnode.getfont or function(n) return n.font end -local getlist = (Dnode ~= node) and Dnode.getlist or function(n) return n.head end -local getchar = (Dnode ~= node) and Dnode.getchar or function(n) return n.char end -local getsubtype = (Dnode ~= node) and Dnode.getsubtype or function(n) return n.subtype end +local setfield = node.direct.setfield +local getfield = node.direct.getfield +local getid = node.direct.getid +local getfont = node.direct.getfont +local getlist = node.direct.getlist +local getchar = node.direct.getchar +local getsubtype = node.direct.getsubtype -local node_traverse_id = Dnode.traverse_id -local node_traverse = Dnode.traverse -local node_new = Dnode.new -local node_copy = Dnode.copy -local node_remove = Dnode.remove -local node_tail = Dnode.tail -local node_next = (Dnode ~= node) and Dnode.getnext or node.next -local has_attr = Dnode.has_attribute -local set_attr = Dnode.set_attribute -local node_insert_before = Dnode.insert_before -local node_insert_after = Dnode.insert_after +local node_traverse_id = node.direct.traverse_id +local node_traverse = node.direct.traverse +local node_new = node.direct.new +local node_copy = node.direct.copy +local node_remove = node.direct.remove +local node_tail = node.direct.tail +local node_next = node.direct.getnext or node.next +local has_attr = node.direct.has_attribute +local set_attr = node.direct.set_attribute +local node_insert_before = node.direct.insert_before +local node_insert_after = node.direct.insert_after local round = tex.round local id_glyph = node.id('glyph') diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua index 72e8b8222f5..b71b6611d3e 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-stack.lua @@ -20,7 +20,7 @@ local sid_user = node.subtype('user_defined') local STCK = luatexja.userid_table.STCK local fastcopy = table.fastcopy local setcount = tex.setcount -local scan_int, scan_keyword = luatexja.token.scan_int, luatexja.token.scan_keyword +local scan_int, scan_keyword = token.scan_int, token.scan_keyword hmode = 0 -- dummy charprop_stack_table={}; diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty index 3bba582fc4b..a179013de4d 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-compat.sty @@ -100,11 +100,11 @@ \def\ucs{\ltj@code@conv{ucs}} \def\ltj@code@conv#1{% - \directlua{luatexja.compat.from_#1(luatexja.token.scan_int())}% + \directlua{luatexja.compat.from_#1(token.scan_int())}% } \def\kansuji{% - \directlua{luatexja.compat.to_kansuji(luatexja.token.scan_int())}% + \directlua{luatexja.compat.to_kansuji(token.scan_int())}% } \define@key[ltj]{japaram}{kansujichar}{\ltj@@set@stack{KSJ}{0}{0x7FFFFFFF}#1 } diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty index 5784b1b3c6e..71d14ce8b0f 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja-core.sty @@ -99,17 +99,13 @@ \expandafter\endinput\fi\relax %% Check LuaTeX version. -\ifnum\luatexversion<74 +\ifnum\luatexversion<85 \@PackageError{luatexja-core} {This LuaTeX engine is too old for this package;\MessageBreak - at least beta-0.74.0 is needed} + at least beta-0.85.0 is needed} {Package loading is aborted now.\MessageBreak} \expandafter\endinput\fi\relax -%! なお、luatexbase-compat の説明に従うと、LuaTeX 拡張プリミティブは -%! plain/LaTeX の両方で \luatex 付の名前(\directlua はそのまま) -%! で使えると考えてよい。 - %% \LuaTeXjaAvailable %! 環境検査にパスした時に定義される. \let\LuaTeXjaAvailable=t % @@ -339,16 +335,16 @@ % yjabaselineshift = <dimen> \define@key[ltj]{japaram}{yalbaselineshift}{% \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@yablshift'], luatexja.token.scan_dimen())}#1\relax} + luatexbase.attributes['ltj@yablshift'], token.scan_dimen())}#1\relax} \define@key[ltj]{japaram}{yjabaselineshift}{% \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@ykblshift'], luatexja.token.scan_dimen())}#1\relax} + luatexbase.attributes['ltj@ykblshift'], token.scan_dimen())}#1\relax} \define@key[ltj]{japaram}{talbaselineshift}{% \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@tablshift'], luatexja.token.scan_dimen())}#1\relax} + luatexbase.attributes['ltj@tablshift'], token.scan_dimen())}#1\relax} \define@key[ltj]{japaram}{tjabaselineshift}{% \directlua{tex.setattribute(luatexja.isglobal, - luatexbase.attributes['ltj@tkblshift'], luatexja.token.scan_dimen())}#1\relax} + luatexbase.attributes['ltj@tkblshift'], token.scan_dimen())}#1\relax} % jaxspmode = {<char_code>, <mode>} % mode: inhibit, preonly, postonly, allow @@ -392,7 +388,7 @@ \newluafunction\ltjsetkanjiskip@inner \newluafunction\ltjsetxkanjiskip@inner \directlua{ - local t, scan_glue = lua.get_functions_table(), luatexja.token.scan_glue + local t, scan_glue = lua.get_functions_table(), token.scan_glue local sss, sti = luatexja.stack.set_stack_skip, luatexja.stack_table_index t[\the\ltjsetkanjiskip@inner] = function() local d = scan_glue(); sss(sti.KSK, d); node.free(d) @@ -406,12 +402,12 @@ \else \protected\def\ltjsetkanjiskip{% % SKIP \directlua{% - local d = luatexja.token.scan_glue() + local d = token.scan_glue() luatexja.stack.set_stack_skip(luatexja.stack_table_index.KSK, d); node.free(d) }} \protected\def\ltjsetxkanjiskip{% % SKIP \directlua{% - local d = luatexja.token.scan_glue() + local d = token.scan_glue() luatexja.stack.set_stack_skip(luatexja.stack_table_index.XSK, d); node.free(d) }} \fi @@ -520,10 +516,10 @@ %%%%%%%% \ltjsetmathletter<number>, \ltjunsetmathletter<number> \protected\def\ltjsetmathletter#1{% - \directlua{luatexja.math.is_math_letters[luatexja.token.scan_int()]=true}#1\relax + \directlua{luatexja.math.is_math_letters[token.scan_int()]=true}#1\relax } \protected\def\ltjunsetmathletter#1{% - \directlua{luatexja.math.is_math_letters[luatexja.token.scan_int()]=false}#1\relax + \directlua{luatexja.math.is_math_letters[token.scan_int()]=false}#1\relax } %%%%%%%% \ltjdeclarealtfont<base_font_cs><alt_font_cs>{100-200,3000-,5000,...} @@ -750,11 +746,11 @@ %%%%%%%% \ltjgetwd<box_num> etc. \def\ltj@@getwd{% - \directlua{luatexja.direction.get_box_dim('width', luatexja.token.scan_int())}} + \directlua{luatexja.direction.get_box_dim('width', token.scan_int())}} \def\ltj@@getht{% - \directlua{luatexja.direction.get_box_dim('height', luatexja.token.scan_int())}} + \directlua{luatexja.direction.get_box_dim('height', token.scan_int())}} \def\ltj@@getdp{% - \directlua{luatexja.direction.get_box_dim('depth', luatexja.token.scan_int())}} + \directlua{luatexja.direction.get_box_dim('depth', token.scan_int())}} \let\ltjgetwd=\ltj@@getwd\let\ltjgetht=\ltj@@getht\let\ltjgetdp=\ltj@@getdp %%%%%%%% \ltjsetwd<box_num>=<dimen> etc. diff --git a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua index 9f3bd36a383..67a9e9b3df3 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/luatexja.lua @@ -20,14 +20,16 @@ function luatexja.load_lua(fn) end end --- check token library -if newtoken then - luatexja.token = newtoken -else - local luatex_version = status.list().luatex_version - if luatex_version >80 then - luatexja.token = token - end +do + local setfield = node.direct.setfield + luatexja.setglue = node.direct.setglue or + function(g,w,st,sh,sto,sho) + setfield(g,'width', w or 0) + setfield(g,'stretch',st or 0) + setfield(g,'shrink', sh or 0) + setfield(g,'stretch_order',sto or 0) + setfield(g,'shrink_order', sho or 0) + end end --- 以下は全ファイルで共有される定数 @@ -292,10 +294,9 @@ end do local start_time_measure, stop_time_measure = ltjb.start_time_measure, ltjb.stop_time_measure - local Dnode = node.direct or node local nullfunc = function (n) return n end - local to_node = (Dnode ~= node) and Dnode.tonode or nullfunc - local to_direct = (Dnode ~= node) and Dnode.todirect or nullfunc + local to_node = node.direct.tonode + local to_direct = node.direct.todirect local ensure_tex_attr = ltjb.ensure_tex_attr -- mode = true iff main_process is called from pre_linebreak_filter @@ -353,7 +354,6 @@ local has_attr = node.has_attribute local id_penalty = node.id('penalty') local id_glyph = node.id('glyph') -local id_glue_spec = node.id('glue_spec') local id_glue = node.id('glue') local id_kern = node.id('kern') local id_hlist = node.id('hlist') @@ -423,7 +423,7 @@ local function debug_show_node_X(p,print_fn, limit) .. ', dir=' .. tostring(node.has_attribute(p, attr_dir)) print_fn(s) elseif pt == 'glue' then - s = base .. ' ' .. print_spec(p.spec) + s = base .. ' ' .. print_spec(p) if get_attr_icflag(p)>icflag_table.KINSOKU and get_attr_icflag(p)<icflag_table.KANJI_SKIP then s = s .. ' (from JFM: priority ' .. get_attr_icflag(p)-icflag_table.FROM_JFM .. ')' diff --git a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty index 2b301d89ad3..f3587288721 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty +++ b/Master/texmf-dist/tex/luatex/luatexja/patches/lltjcore.sty @@ -169,26 +169,6 @@ \unless\ifnum\ltjgetparameter{direction}=3 \@textsuperscript{\normalfont\@thefnmark}% \else\hbox{\yoko \@textsuperscript{\normalfont\@thefnmark}}\fi}} -\long\def\@footnotetext#1{% - \ifcase\ltjgetparameter{direction}% - \or \let\@tempa\dtou - \or\or\let\@tempa\tate - \or \let\@tempa\yoko - \else \let\@tempa\utod - \fi - \insert\footins{\@tempa% - \reset@font\footnotesize - \interlinepenalty\interfootnotelinepenalty - \splittopskip\footnotesep - \splitmaxdepth \dp\strutbox \floatingpenalty \@MM - \hsize\columnwidth \@parboxrestore - \protected@edef\@currentlabel{% - \csname p@footnote\endcsname\@thefnmark - }% - \color@begingroup - \@makefntext{% - \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% - \color@endgroup}} \def\@footnotemark{\leavevmode \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi \unless\ifnum\ltjgetparameter{direction}=3 \@makefnmark |