OSDN Git Service

Fix #39431: support notdef=... (introduced in luaotfload v2.98)
[luatex-ja/luatexja.git] / src / ltj-jfont.lua
index b3d0fde..82e2808 100644 (file)
@@ -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