From: Hironori Kitagawa Date: Thu, 3 Aug 2017 20:38:59 +0000 (+0900) Subject: vert vs vrt2 X-Git-Tag: 20170904.0~10^2~15 X-Git-Url: http://git.osdn.net/view?p=luatex-ja%2Fluatexja.git;a=commitdiff_plain;h=e65feac0d40521faffca44effa0eb300571014e8 vert vs vrt2 --- diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index c7f8593..84cbd30 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -42,7 +42,7 @@ luatexbase.create_callback("luatexja.load_jfm", "data", function (ft, jn) return local jfm_file_name, jfm_var, jfm_ksp local defjfm_res -local jfm_dir, is_def_jfont, is_vert_enabled +local jfm_dir, is_def_jfont, is_vert_enabled, auto_enable_vrt2 local function norm_val(a) if (not a) or (a==0.) then @@ -300,6 +300,7 @@ do -- EXT local identifiers = fonts.hashes.identifiers + local provides_feature = luaotfload.aux.provides_feature function jfontdefY() local j = load_jfont_metric(jfm_dir) local fn = font.id(cstemp) @@ -328,6 +329,14 @@ do chars_cbcache = {}, vert_activated = is_vert_enabled, } + if auto_enable_vrt2 then + local t = identifiers[fn] + local lang, scr = t.properties.language, t.properties.script + local vrt2_exist = provides_feature( + fn, t.properties.script, t.properties.language, 'vrt2' + ) + t.shared.features[vrt2_exist and 'vrt2' or 'vert'] = true + end fmtable = luatexbase.call_callback("luatexja.define_jfont", fmtable, fn) font_metric_table[fn]=fmtable @@ -359,7 +368,7 @@ do -- normalize position of 'jfm=' and 'jfmvar=' keys local function extract_metric(name) local is_braced = name:match('^{(.*)}$') - name= is_braced or name + name= is_braced or name jfm_file_name = ''; jfm_var = ''; jfm_ksp = true local tmp, index = name:sub(1, 5), 1 if tmp == 'file:' or tmp == 'name:' or tmp == 'psft:' then @@ -403,11 +412,9 @@ do end if jfm_dir == 'tate' then is_vert_enabled = (not name:match('[:;]%-vert')) and (not name:match('[:;]%-vrt2')) - if not name:match('vert') and not name:match('vrt2') then - name = name .. ';+vert;+vrt2' - end + auto_enable_vrt2 = (not name:match('vert') and not name:match('vrt2')) else - is_vert_enabled = nil + is_vert_enabled, auto_enable_vrt2 = nil, nil end return is_braced and ('{' .. name .. '}') or name end diff --git a/test/test51a-vert_vrt2.pdf b/test/test51a-vert_vrt2.pdf new file mode 100644 index 0000000..d1d1820 Binary files /dev/null and b/test/test51a-vert_vrt2.pdf differ diff --git a/test/test51a-vert_vrt2.tex b/test/test51a-vert_vrt2.tex new file mode 100644 index 0000000..d4a6d2e --- /dev/null +++ b/test/test51a-vert_vrt2.tex @@ -0,0 +1,26 @@ +\input luatexja.sty +\def\FN{KozMinPr6N-Regular} + +\leavevmode +\tfont\VN=\FN:-vert;jfm=ujisv +\tfont\VT=\FN:+vert;jfm=ujisv +\tfont\VU=\FN:+vrt2;jfm=ujisv +\tfont\VB=\FN:+vert;+vrt2;jfm=ujisv +\tfont\VD=\FN:jfm=ujisv +\tentt +\ltjsetparameter{jacharrange={+8}} +\def\TEST{\tate 上⇦⇧⇩⇨⬅⬆⬇➡下¶\ltjjachar"253B\ltjjachar"0165,} +\hbox{\TEST} +\hbox{\VD\TEST ~~~~~default} +\hbox{\VB\TEST +vert +vrt2} +\hbox{\VN\TEST -vert -vrt2} +\hbox{\VT\TEST +vert -vrt2} +\hbox{\VU\TEST -vert +vrt2} + +\par + +\catcode`\@=11 +\expandafter\@gobble\TEST + +\bye +