diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua | 99 |
1 files changed, 14 insertions, 85 deletions
diff --git a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua index 375527af9e7..82e2808e5a2 100644 --- a/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua +++ b/Master/texmf-dist/tex/luatex/luatexja/ltj-jfont.lua @@ -809,46 +809,32 @@ local prepare_fl_data do local sort = table.sort prepare_fl_data = function (dest, id) - local t = {} + local ascent = id.shared.rawdata.metadata.ascender + local t_vorigin, t_ind_to_uni = {}, {} for i,v in pairs(id.shared.rawdata.descriptions) do - t[v.index] = i + t_ind_to_uni[v.index] = i + if v.tsb then + local j = v.boundingbox[4] + v.tsb + if j~=ascent then t_vorigin[i]=j end + end end - dest = dest or {}; dest.ind_to_uni = t + dest = dest or {} + dest.ind_to_uni = t_ind_to_uni + dest.vorigin = t_vorigin return dest end end -- do - local cache_ver = 18 - local function prepare_extra_data_base(id) if (not id) or (not id.filename) then return end local bname = id.psname or file.nameonly(id.filename) if not font_extra_basename[bname] then - -- if the cache is present, read it - if not lfs then lfs=require"lfs" end - local newtime = lfs.attributes(id.filename,"modification") - local v = "extra_" .. string.lower(bname) - local dat = ltjb.load_cache( - v, - function (t) return (t.version~=cache_ver) or (t.modtime~=newtime) end - ) - -- if the cache is not found or outdated, save the cache - if dat then - font_extra_basename[bname] = dat[1] or {} - else - local dat = nil - dat = prepare_fl_data(dat, id) - dat = list_rotate_glyphs(dat, id) - font_extra_basename[bname] = dat or {} - ltjb.save_cache( v, - { - modtime = newtime, - version = cache_ver, - dat, - }) - end + ltjb.remove_cache("extra_" .. string.lower(bname)) -- remove cache + local dat = prepare_fl_data(dat, id) + dat = list_rotate_glyphs(dat, id) + font_extra_basename[bname] = dat or {} return bname end end @@ -883,63 +869,6 @@ do end end - ------------------------------------------------------------------------- --- calculate vadvance ------------------------------------------------------------------------- -do - local function acc_feature(table_vadv, table_vorg, subtables, ft, already_vert) - for char_num,v in pairs(ft.shared.rawdata.descriptions) do - if v.slookups then - for sn, sv in pairs(v.slookups) do - if subtables[sn] and type(sv)=='table' then - if sv[4]~=0 then - table_vadv[char_num] - = (table_vadv[char_num] or 0) + sv[4] - end - if sv[2]~=0 and not already_vert then - table_vorg[char_num] - = (table_vorg[char_num] or 0) + sv[2] - end - end - end - end - end - end - -luatexbase.add_to_callback( - "luatexja.define_jfont", - function (fmtable, fnum) - local vadv = {}; fmtable.v_advance = vadv - local vorg = {}; fmtable.v_origin = vorg - local ft = font_getfont(fnum) - local subtables = {} - if ft.specification then - for feat_name,v in pairs(ft.specification.features.normal) do - if v==true and ft.resources then - for _,i in pairs(ft.resources.sequences) do - if i.order[1]== feat_name and i.type == 'gpos_single' and type(i.subtables)=='table' then - for _,st in pairs(i.subtables) do - subtables[st] = true - end - end - end - end - end - acc_feature(vadv, vorg, subtables, ft, - ft.specification.features.normal.vrt2 or ft.specification.features.normal.vert) - for i,v in pairs(vadv) do - vadv[i]=vadv[i]/ft.units_per_em*fmtable.size - end - for i,v in pairs(vorg) do - vorg[i]=vorg[i]/ft.units_per_em*fmtable.size - end - end - return fmtable - end, 'ltj.v_advance', 1 -) -end - ------------------------------------------------------------------------ -- make table of vertical glyphs which does not covered by vert feature -- nor UTR#50 |