• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: コミット

ソースコードの管理場所


コミットメタ情報

リビジョンaca076c4191ab6a60e0771d0791f69ddc748aaf4 (tree)
日時2019-07-25 07:39:28
作者Hironori Kitagawa <h_kitagawa2001@yaho...>
コミッターHironori Kitagawa

ログメッセージ

stopped to use cache file for fonts

変更サマリ

差分

--- a/src/ltj-base.lua
+++ b/src/ltj-base.lua
@@ -257,7 +257,7 @@ do
257257 if lfs.isdir(testpath) then savepath = testpath; break end
258258 end
259259
260- save_cache_luc = function (filename, t, serialized)
260+ local function save_cache_luc(filename, t, serialized)
261261 local fullpath = savepath .. '/' .. filename .. luc_suffix
262262 local s = serialized or serialize(t, 'return', false)
263263 if s then
@@ -271,7 +271,7 @@ do
271271 end
272272 end
273273
274- save_cache = function (filename, t)
274+ local function save_cache(filename, t)
275275 local fullpath = savepath .. '/' .. filename .. '.lua'
276276 local s = serialize(t, 'return', false)
277277 if s then
@@ -285,7 +285,7 @@ do
285285 end
286286 end
287287
288- local function load_cache_a (filename, outdate)
288+ local function load_cache_a(filename, outdate)
289289 local result
290290 for _,v in pairs(path) do
291291 local fn = join(v, cache_dir, filename)
@@ -302,7 +302,7 @@ do
302302 end
303303 end
304304
305- load_cache = function (filename, outdate)
305+ local function load_cache(filename, outdate)
306306 local r = load_cache_a(filename .. luc_suffix, outdate)
307307 if r then
308308 return r
@@ -313,6 +313,17 @@ do
313313 end
314314 end
315315
316+ local function remove_file_if_exist(name)
317+ if os.rename(name,name) then os.remove(name) end
318+ end
319+ local function remove_cache (filename)
320+ local fullpath_wo_ext = savepath .. '/' .. filename .. '.lu'
321+ remove_file_if_exist(fullpath_wo_ext .. 'a')
322+ remove_file_if_exist(fullpath_wo_ext .. 'b')
323+ remove_file_if_exist(fullpath_wo_ext .. 'c')
324+ end
325+
326+ ltjb.remove_cache = remove_cache
316327 ltjb.load_cache = load_cache
317328 ltjb.save_cache_luc = save_cache_luc
318329 ltjb.save_cache = save_cache
--- a/src/ltj-jfont.lua
+++ b/src/ltj-jfont.lua
@@ -827,35 +827,14 @@ end
827827
828828 --
829829 do
830- local cache_ver = 19
831-
832830 local function prepare_extra_data_base(id)
833831 if (not id) or (not id.filename) then return end
834832 local bname = id.psname or file.nameonly(id.filename)
835833 if not font_extra_basename[bname] then
836- -- if the cache is present, read it
837- if not lfs then lfs=require"lfs" end
838- local newtime = lfs.attributes(id.filename,"modification")
839- local v = "extra_" .. string.lower(bname)
840- local dat = ltjb.load_cache(
841- v,
842- function (t) return (t.version~=cache_ver) or (t.modtime~=newtime) end
843- )
844- -- if the cache is not found or outdated, save the cache
845- if dat then
846- font_extra_basename[bname] = dat[1] or {}
847- else
848- local dat = nil
849- dat = prepare_fl_data(dat, id)
850- dat = list_rotate_glyphs(dat, id)
851- font_extra_basename[bname] = dat or {}
852- ltjb.save_cache( v,
853- {
854- modtime = newtime,
855- version = cache_ver,
856- dat,
857- })
858- end
834+ ltjb.remove_cache("extra_" .. string.lower(bname)) -- remove cache
835+ local dat = prepare_fl_data(dat, id)
836+ dat = list_rotate_glyphs(dat, id)
837+ font_extra_basename[bname] = dat or {}
859838 return bname
860839 end
861840 end
旧リポジトリブラウザで表示