From 46958c57fc2c9b941e4638a7472e0fa2917334d2 Mon Sep 17 00:00:00 2001 From: Hironori Kitagawa Date: Tue, 7 Oct 2014 13:41:15 +0900 Subject: [PATCH] Backported commits 36ad2f96 and 98cb5558 --- src/ltj-jfont.lua | 3 ++- src/ltj-pretreat.lua | 7 ++++--- src/luatexja-core.sty | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index 45bf490..ff0788d 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -553,6 +553,7 @@ end ------------------------------------------------------------------------ local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct +local font = font -- EXT: italic correction function append_italic() local p = to_direct(tex.nest[tex.nest.ptr].tail) @@ -566,7 +567,7 @@ function append_italic() local j = font_metric_table[f] setfield(g, 'kern', j.char_type[find_char_class(getchar(p), j)].italic) else - local h = font_getfont(f) + local h = font_getfont(f) or font.fonts[f] if h then setfield(g, 'kern', h.characters[getchar(p)].italic) else diff --git a/src/ltj-pretreat.lua b/src/ltj-pretreat.lua index 14cec98..5cdb140 100644 --- a/src/ltj-pretreat.lua +++ b/src/ltj-pretreat.lua @@ -42,6 +42,7 @@ local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct local ltjf_replace_altfont = ltjf.replace_altfont local attr_orig_char = luatexbase.attributes['ltj@origchar'] local STCK = luatexja.userid_table.STCK +local lang_ja = token.create('ltj@japanese')[2] ------------------------------------------------------------------------ -- MAIN PROCESS STEP 1: replace fonts @@ -56,7 +57,8 @@ do local pc = getchar(p) local pf = ltjf_replace_altfont(has_attr(p, attr_curjfnt) or getfont(p), pc) setfield(p, 'font', pf); set_attr(p, attr_curjfnt, pf) - setfield(p, 'subtype', floor(getsubtype(p)*0.5)*2) + setfield(p, 'lang', lang_ja) + -- setfield(p, 'subtype', floor(getsubtype(p)*0.5)*2) set_attr(p, attr_orig_char, pc) end return p @@ -74,8 +76,7 @@ do wt, head = {}, p while p do local pfunc = suppress_hyphenate_ja_aux[getid(p)] - if pfunc then p = pfunc(p) end - p = node_next(p) + p = node_next(pfunc and pfunc(p) or p) end head = to_node(head) lang.hyphenate(head) diff --git a/src/luatexja-core.sty b/src/luatexja-core.sty index b4fd007..75b011c 100644 --- a/src/luatexja-core.sty +++ b/src/luatexja-core.sty @@ -143,6 +143,7 @@ \newluatexattribute\ltj@yablshift % attribute for \yabaselineshift \newluatexattribute\ltj@ykblshift % attribute for \ykbaselineshift \newluatexattribute\jfam % index for current jfam +\newlanguage\ltj@@japanese \ltj@icflag=0 \ltj@origchar=0 \ltj@charclass=0 -- 2.11.0