• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

ソースコードの管理場所


Commit MetaInfo

Revisionae55cbd903cc762cafe79e83ef0175217d1736bc (tree)
Time2014-11-05 18:05:33
AuthorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Log Message

apply "implicit" vert/vrt2 features just before computing character class

Change Summary

Incremental Difference

--- a/src/jfm-ujisv.lua
+++ b/src/jfm-ujisv.lua
@@ -169,7 +169,7 @@ luatexja.jfont.define_jfm {
169169 "AJ1-593", "AJ1-594", "AJ1-595", "AJ1-596", "AJ1-597", "AJ1-598",
170170 },
171171 align = 'left', left = 0.0, down = 0.0,
172- width = 0.5, height = 0.50, depth = 0.50, italic=0.0,
172+ width = 0.5, height = 0.5, depth = 0.5, italic=0.0,
173173 glue = {
174174 [1] = { 0.5 , 0.0, 0.5, 0, 1 },
175175 [2] = {0, 0, 0},
--- a/src/ltj-jfmglue.lua
+++ b/src/ltj-jfmglue.lua
@@ -110,7 +110,7 @@ local slow_find_char_class
110110 do
111111 local start_time_measure = ltjb.start_time_measure
112112 local stop_time_measure = ltjb.stop_time_measure
113- slow_find_char_class = function (c, m, oc)
113+ slow_find_char_class = function (c, m, oc,t )
114114 local cls = ltjf_find_char_class(oc, m)
115115 if oc~=c and cls==0 then
116116 return ltjf_find_char_class(-c, m), oc
@@ -564,6 +564,7 @@ do
564564 local attr_jchar_class = luatexbase.attributes['ltj@charclass']
565565 local attr_autospc = luatexbase.attributes['ltj@autospc']
566566 local attr_autoxspc = luatexbase.attributes['ltj@autoxspc']
567+ local ltjf_get_vert_glyph = ltjf.get_vert_glyph
567568 function set_np_xspc_jachar_yoko(Nx, x)
568569 local m = ltjf_font_metric_table[getfont(x)]
569570 local cls, c = slow_find_char_class(ltjs_orig_char_table[x], m, getchar(x))
@@ -576,12 +577,11 @@ do
576577 Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1)
577578 end
578579 function set_np_xspc_jachar_tate(Nx, x)
579- local m = ltjf_font_metric_table[getfont(x)]
580- local cls, c
581- local c1, c2 = getchar(x), ltjs_orig_char_table[x][1]
582- c = ltjs_orig_char_table[x][2] or c1 or c2
583- cls = ltjf_find_char_class(c, m)
584- if cls==0 then cls = slow_find_char_class(c2, m, c1) end
580+ local c, c_glyph = ltjs_orig_char_table[x], getchar(x)
581+ local xf = getfont(x)
582+ local m = ltjf_font_metric_table[xf]
583+ local cls = slow_find_char_class(c, m, c_glyph)
584+ setfield(x, 'char', ltjf_get_vert_glyph(xf, c_glyph) or c_glyph)
585585 Nx.met = m; Nx.class = cls;
586586 if cls~=0 then set_attr(x, attr_jchar_class, cls) end
587587 Nx.pre = table_current_stack[PRE + c] or 0
--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -750,7 +750,7 @@ end
750750
751751 --
752752 do
753- local cache_ver = 3
753+ local cache_ver = 5
754754 local checksum = file.checksum
755755
756756 local function prepare_extra_data_base(id)
@@ -820,13 +820,19 @@ end
820820 -- calculate vadvance
821821 ------------------------------------------------------------------------
822822 do
823- local function acc_feature(table_vadv, subtables, ft)
823+ local function acc_feature(table_vadv, table_vorg, subtables, ft)
824824 for char_num,v in pairs(ft.shared.rawdata.descriptions) do
825825 if v.slookups then
826826 for sn, sv in pairs(v.slookups) do
827- if subtables[sn] and type(sv)=='table' and sv[4]~=0 then
828- table_vadv[char_num]
829- = (table_vadv[char_num] or 0) + sv[4]
827+ if subtables[sn] and type(sv)=='table' then
828+ if sv[4]~=0 then
829+ table_vadv[char_num]
830+ = (table_vadv[char_num] or 0) + sv[4]
831+ end
832+ if sv[2]~=0 then
833+ table_vorg[char_num]
834+ = (table_vorg[char_num] or 0) + sv[2]
835+ end
830836 end
831837 end
832838 end
@@ -837,11 +843,14 @@ luatexbase.add_to_callback(
837843 "luatexja.define_jfont",
838844 function (fmtable, fnum)
839845 local vadv = {}; fmtable.v_advance = vadv
846+ local vorg = {}; fmtable.v_origin = vorg
840847 local ft = font_getfont(fnum)
841848 local subtables = {}
842849 if ft.specification then
850+ ft.specification.features.normal.vrt2 = true
851+ ft.specification.features.normal.vert = true
843852 for feat_name,v in pairs(ft.specification.features.normal) do
844- if v then
853+ if v==true then
845854 for _,i in pairs(ft.resources.sequences) do
846855 if i.order[1]== feat_name and i.type == 'gpos_single' then
847856 for _,st in pairs(i.subtables) do
@@ -851,10 +860,13 @@ luatexbase.add_to_callback(
851860 end
852861 end
853862 end
854- acc_feature(vadv, subtables, ft)
863+ acc_feature(vadv, vorg, subtables, ft)
855864 for i,v in pairs(vadv) do
856865 vadv[i]=vadv[i]/ft.units_per_em*fmtable.size
857866 end
867+ for i,v in pairs(vorg) do
868+ vorg[i]=vorg[i]/ft.units_per_em*fmtable.size
869+ end
858870 end
859871 return fmtable
860872 end, 1, 'ltj.v_advance'
--- a/src/ltj-pretreat.lua
+++ b/src/ltj-pretreat.lua
@@ -44,7 +44,6 @@ local attr_icflag = luatexbase.attributes['ltj@icflag']
4444
4545 local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct
4646 local ltjs_orig_char_table = ltjs.orig_char_table
47-local ltjf_get_vert_glyph = ltjf.get_vert_glyph
4847 local ltjf_replace_altfont = ltjf.replace_altfont
4948 local attr_orig_char = luatexbase.attributes['ltj@origchar']
5049 local STCK = luatexja.userid_table.STCK
@@ -133,11 +132,7 @@ local function set_box_stack_level(head, mode)
133132 if (has_attr(p, attr_icflag) or 0)<=0 and getfield(p, 'lang')==lang_ja then
134133 local pfn = has_attr(p, attr_curtfnt) or getfont(p)
135134 local pc = ltjs_orig_char_table[p]
136- local pf = ltjf_replace_altfont(pfn, pc)
137- ltjs_orig_char_table[p] = { pc, ltjs_orig_char_table[p] }
138- local xc = ltjf_get_vert_glyph(pf, pc) or pc
139- setfield(p, 'char', xc); setfield(p, 'font', pf);
140- ltjs_orig_char_table[p] = { pc, xc }
135+ setfield(p, 'font', ltjf_replace_altfont(pfn, pc))
141136 end
142137 end
143138 end
--- a/src/ltj-setwidth.lua
+++ b/src/ltj-setwidth.lua
@@ -150,12 +150,13 @@ local function capsule_glyph_tate(p, met, class, head, dir)
150150 local fwidth, pwidth = char_data.width
151151 do
152152 local pf = getfont(p)
153- local pc = getchar(p) -- ltjf_get_vert_glyph(pf, getchar(p))
153+ local pc = getchar(p)
154154 setfield(p, 'char', pc)
155155 pwidth = ltjf_font_extra_info[pf] and ltjf_font_extra_info[pf][pc]
156156 and ltjf_font_extra_info[pf][pc].vwidth
157157 and ltjf_font_extra_info[pf][pc].vwidth * met.size or (ascent+descent)
158- pwidth = pwidth + (met.v_advance and met.v_advance[pc] or 0)
158+ pwidth = pwidth + (met.v_advance[pc] or 0)
159+ ascent = met.v_origin[pc] and ascent - met.v_origin[pc] or ascent
159160 end
160161 fwidth = (fwidth ~= 'prop') and fwidth or pwidth
161162 fshift.down = char_data.down; fshift.left = char_data.left