ソースコードの管理場所
Revisión | ae55cbd903cc762cafe79e83ef0175217d1736bc (tree) |
---|---|
Tiempo | 2014-11-05 18:05:33 |
Autor | Hironori Kitagawa <h_kitagawa2001@yaho...> |
Commiter | Hironori Kitagawa |
apply "implicit" vert/vrt2 features just before computing character class
@@ -169,7 +169,7 @@ luatexja.jfont.define_jfm { | ||
169 | 169 | "AJ1-593", "AJ1-594", "AJ1-595", "AJ1-596", "AJ1-597", "AJ1-598", |
170 | 170 | }, |
171 | 171 | 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, | |
173 | 173 | glue = { |
174 | 174 | [1] = { 0.5 , 0.0, 0.5, 0, 1 }, |
175 | 175 | [2] = {0, 0, 0}, |
@@ -110,7 +110,7 @@ local slow_find_char_class | ||
110 | 110 | do |
111 | 111 | local start_time_measure = ltjb.start_time_measure |
112 | 112 | 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 ) | |
114 | 114 | local cls = ltjf_find_char_class(oc, m) |
115 | 115 | if oc~=c and cls==0 then |
116 | 116 | return ltjf_find_char_class(-c, m), oc |
@@ -564,6 +564,7 @@ do | ||
564 | 564 | local attr_jchar_class = luatexbase.attributes['ltj@charclass'] |
565 | 565 | local attr_autospc = luatexbase.attributes['ltj@autospc'] |
566 | 566 | local attr_autoxspc = luatexbase.attributes['ltj@autoxspc'] |
567 | + local ltjf_get_vert_glyph = ltjf.get_vert_glyph | |
567 | 568 | function set_np_xspc_jachar_yoko(Nx, x) |
568 | 569 | local m = ltjf_font_metric_table[getfont(x)] |
569 | 570 | local cls, c = slow_find_char_class(ltjs_orig_char_table[x], m, getchar(x)) |
@@ -576,12 +577,11 @@ do | ||
576 | 577 | Nx.auto_kspc, Nx.auto_xspc = (has_attr(x, attr_autospc)==1), (has_attr(x, attr_autoxspc)==1) |
577 | 578 | end |
578 | 579 | 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) | |
585 | 585 | Nx.met = m; Nx.class = cls; |
586 | 586 | if cls~=0 then set_attr(x, attr_jchar_class, cls) end |
587 | 587 | Nx.pre = table_current_stack[PRE + c] or 0 |
@@ -750,7 +750,7 @@ end | ||
750 | 750 | |
751 | 751 | -- |
752 | 752 | do |
753 | - local cache_ver = 3 | |
753 | + local cache_ver = 5 | |
754 | 754 | local checksum = file.checksum |
755 | 755 | |
756 | 756 | local function prepare_extra_data_base(id) |
@@ -820,13 +820,19 @@ end | ||
820 | 820 | -- calculate vadvance |
821 | 821 | ------------------------------------------------------------------------ |
822 | 822 | do |
823 | - local function acc_feature(table_vadv, subtables, ft) | |
823 | + local function acc_feature(table_vadv, table_vorg, subtables, ft) | |
824 | 824 | for char_num,v in pairs(ft.shared.rawdata.descriptions) do |
825 | 825 | if v.slookups then |
826 | 826 | 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 | |
830 | 836 | end |
831 | 837 | end |
832 | 838 | end |
@@ -837,11 +843,14 @@ luatexbase.add_to_callback( | ||
837 | 843 | "luatexja.define_jfont", |
838 | 844 | function (fmtable, fnum) |
839 | 845 | local vadv = {}; fmtable.v_advance = vadv |
846 | + local vorg = {}; fmtable.v_origin = vorg | |
840 | 847 | local ft = font_getfont(fnum) |
841 | 848 | local subtables = {} |
842 | 849 | if ft.specification then |
850 | + ft.specification.features.normal.vrt2 = true | |
851 | + ft.specification.features.normal.vert = true | |
843 | 852 | for feat_name,v in pairs(ft.specification.features.normal) do |
844 | - if v then | |
853 | + if v==true then | |
845 | 854 | for _,i in pairs(ft.resources.sequences) do |
846 | 855 | if i.order[1]== feat_name and i.type == 'gpos_single' then |
847 | 856 | for _,st in pairs(i.subtables) do |
@@ -851,10 +860,13 @@ luatexbase.add_to_callback( | ||
851 | 860 | end |
852 | 861 | end |
853 | 862 | end |
854 | - acc_feature(vadv, subtables, ft) | |
863 | + acc_feature(vadv, vorg, subtables, ft) | |
855 | 864 | for i,v in pairs(vadv) do |
856 | 865 | vadv[i]=vadv[i]/ft.units_per_em*fmtable.size |
857 | 866 | end |
867 | + for i,v in pairs(vorg) do | |
868 | + vorg[i]=vorg[i]/ft.units_per_em*fmtable.size | |
869 | + end | |
858 | 870 | end |
859 | 871 | return fmtable |
860 | 872 | end, 1, 'ltj.v_advance' |
@@ -44,7 +44,6 @@ local attr_icflag = luatexbase.attributes['ltj@icflag'] | ||
44 | 44 | |
45 | 45 | local is_ucs_in_japanese_char = ltjc.is_ucs_in_japanese_char_direct |
46 | 46 | local ltjs_orig_char_table = ltjs.orig_char_table |
47 | -local ltjf_get_vert_glyph = ltjf.get_vert_glyph | |
48 | 47 | local ltjf_replace_altfont = ltjf.replace_altfont |
49 | 48 | local attr_orig_char = luatexbase.attributes['ltj@origchar'] |
50 | 49 | local STCK = luatexja.userid_table.STCK |
@@ -133,11 +132,7 @@ local function set_box_stack_level(head, mode) | ||
133 | 132 | if (has_attr(p, attr_icflag) or 0)<=0 and getfield(p, 'lang')==lang_ja then |
134 | 133 | local pfn = has_attr(p, attr_curtfnt) or getfont(p) |
135 | 134 | 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)) | |
141 | 136 | end |
142 | 137 | end |
143 | 138 | end |
@@ -150,12 +150,13 @@ local function capsule_glyph_tate(p, met, class, head, dir) | ||
150 | 150 | local fwidth, pwidth = char_data.width |
151 | 151 | do |
152 | 152 | local pf = getfont(p) |
153 | - local pc = getchar(p) -- ltjf_get_vert_glyph(pf, getchar(p)) | |
153 | + local pc = getchar(p) | |
154 | 154 | setfield(p, 'char', pc) |
155 | 155 | pwidth = ltjf_font_extra_info[pf] and ltjf_font_extra_info[pf][pc] |
156 | 156 | and ltjf_font_extra_info[pf][pc].vwidth |
157 | 157 | 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 | |
159 | 160 | end |
160 | 161 | fwidth = (fwidth ~= 'prop') and fwidth or pwidth |
161 | 162 | fshift.down = char_data.down; fshift.left = char_data.left |