summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua')
-rw-r--r--Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua47
1 files changed, 28 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
index 52548a76907..5f9e650c5ca 100644
--- a/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
+++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-math.lua
@@ -34,7 +34,7 @@ local id_frac = node.id('fraction')
local id_simple = node.id('noad')
local id_sub_mlist = node.id('sub_mlist')
-local PROCESSED = luatexja.icflag_table.PROCESSED
+local PROCESSED = luatexja.icflag_table.PROCESSED
local ltjf_font_metric_table = ltjf.font_metric_table
local ltjf_find_char_class = ltjf.find_char_class
@@ -89,24 +89,33 @@ local MJSS = luatexja.stack_table_index.MJSS
conv_jchar_to_hbox_A =
function (p, sty)
if not p then return nil
- elseif p.id == id_sub_mlist then
- if p.head then
- p.head = conv_jchar_to_hbox(p.head, sty)
- end
- elseif p.id == id_mchar then
- local fam = has_attr(p, attr_jfam) or -1
- if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then
- local f = ltjs.get_penalty_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack'))
- if f ~= -1 then
- local q = node_new(id_sub_box)
- local r = node_new(id_glyph); r.next = nil
- r.char = p.char; r.font = f; r.subtype = 256
- set_attr(r, attr_ykblshift, 0)
- set_attr(r, attr_icflag, PROCESSED)
- local met = ltjf_font_metric_table[f]
- ltjw.head = r; ltjw.capsule_glyph(r, tex.mathdir , true, met, ltjf_find_char_class(p.char, met));
- q.head = ltjw.head; node_free(p); p=q;
- end
+ else
+ local pid = p.id
+ if pid == id_sub_mlist then
+ if p.head then
+ p.head = conv_jchar_to_hbox(p.head, sty)
+ end
+ elseif pid == id_mchar then
+ local fam = has_attr(p, attr_jfam) or -1
+ if (not is_math_letters[p.char]) and ltjc.is_ucs_in_japanese_char(p) and fam>=0 then
+ local f = ltjs.get_penalty_table(MJT + 0x100 * sty + fam, -1, tex_getcount('ltj@@stack'))
+ if f ~= -1 then
+ local q = node_new(id_sub_box)
+ local r = node_new(id_glyph); r.next = nil
+ r.char = p.char; r.font = f; r.subtype = 256
+ local k = has_attr(r,attr_ykblshift) or 0
+ set_attr(r, attr_ykblshift, 0)
+ -- ltj-setwidth 内で実際の位置補正はおこなうので,補正量を退避
+ ltjw.head = r;
+ local met = ltjf_font_metric_table[f]
+ ltjw.capsule_glyph(r, tex.mathdir , true, met, ltjf_find_char_class(p.char, met));
+ q.head = ltjw.head; node_free(p); p=q;
+ set_attr(q.head, attr_yablshift, k)
+ end
+ end
+ elseif pid == id_sub_box and p.head then
+ -- \hbox で直に与えられた内容は上下位置を補正する必要はない
+ set_attr(p.head, attr_icflag, PROCESSED)
end
end
return p