X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=src%2Fltj-jfont.lua;h=82e2808e5a2638daf3fedd5b7d9e47c2f275f076;hb=f078ac2f7998a102c7ec765e725f2269eed9f872;hp=b3d0fded891601c69584907047c7a74a617b0320;hpb=d63cda7a13521d938fd1e770fb2d45d06f85c8e3;p=luatex-ja%2Fluatexja.git diff --git a/src/ltj-jfont.lua b/src/ltj-jfont.lua index b3d0fde..82e2808 100644 --- a/src/ltj-jfont.lua +++ b/src/ltj-jfont.lua @@ -812,11 +812,11 @@ do 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_ind_to_uni[v.index] = i - if v.tsb then - local j = v.boundingbox[4] + v.tsb - if j~=ascent then print(i,j);t_vorigin[i]=j end - end + 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_ind_to_uni @@ -827,35 +827,14 @@ end -- do - local cache_ver = 19 - 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 @@ -890,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