diff options
| author | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-16 09:46:38 +0200 | 
|---|---|---|
| committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-05-16 09:46:38 +0200 | 
| commit | c86cff5425abeb8f7a303af9e18ba61e9455b38e (patch) | |
| tree | 10f668a9c22461a91b384d1e80e07e5575e0859f | |
| parent | deb475b99330b1dc1bcb8fe1c978d0354cea5364 (diff) | |
| download | luaotfload-c86cff5425abeb8f7a303af9e18ba61e9455b38e.tar.gz | |
sync with Context as of 2013-05-16
| -rw-r--r-- | luaotfload-basics-gen.lua | 33 | ||||
| -rw-r--r-- | luaotfload-merged.lua | 30 | 
2 files changed, 51 insertions, 12 deletions
diff --git a/luaotfload-basics-gen.lua b/luaotfload-basics-gen.lua index 61f3910..0561778 100644 --- a/luaotfload-basics-gen.lua +++ b/luaotfload-basics-gen.lua @@ -11,9 +11,14 @@ if context then      os.exit()  end -local dummyfunction = function() end ------ dummyreporter = function(c) return function(...) texio.write_nl(c .. " : " .. string.format(...)) end end -local dummyreporter = function(c) return function(...) texio.write_nl(c .. " : " .. string.formatters(...)) end end +local dummyfunction = function() +end + +local dummyreporter = function(c) +    return function(...) +        (texio.reporter or texio.write_nl)(c .. " : " .. string.formatters(...)) +    end +end  statistics = {      register      = dummyfunction, @@ -140,16 +145,24 @@ end  do +    -- standard context tree setup +      local cachepaths = kpse.expand_path('$TEXMFCACHE') or "" +    -- quite like tex live or so +      if cachepaths == "" then          cachepaths = kpse.expand_path('$TEXMFVAR')      end +    -- this also happened to be used +      if cachepaths == "" then          cachepaths = kpse.expand_path('$VARTEXMF')      end +    -- and this is a last resort +      if cachepaths == "" then          cachepaths = "."      end @@ -157,8 +170,15 @@ do      cachepaths = string.split(cachepaths,os.type == "windows" and ";" or ":")      for i=1,#cachepaths do -        if file.is_writable(cachepaths[i]) then -            writable = file.join(cachepaths[i],"luatex-cache") +        local cachepath = cachepaths[i] +        if not lfs.isdir(cachepath) then +            lfs.mkdirs(cachepath) -- needed for texlive and latex +            if lfs.isdir(cachepath) then +                texio.write(string.format("(created cache path: %s)",cachepath)) +            end +        end +        if file.is_writable(cachepath) then +            writable = file.join(cachepath,"luatex-cache")              lfs.mkdir(writable)              writable = file.join(writable,caches.namespace)              lfs.mkdir(writable) @@ -205,7 +225,6 @@ end  local function makefullname(path,name)      if path and path ~= "" then -        name = "temp-" .. name -- clash prevention          return file.addsuffix(file.join(path,name),"lua"), file.addsuffix(file.join(path,name),usingjit and "lub" or "luc")      end  end @@ -290,7 +309,7 @@ function caches.compile(data,luaname,lucname)          d = table.serialize(data,true) -- slow      end      if d and d ~= "" then -        local f = io.open(lucname,'w') +        local f = io.open(lucname,'wb')          if f then              local s = loadstring(d)              if s then diff --git a/luaotfload-merged.lua b/luaotfload-merged.lua index 14667bd..ffb0016 100644 --- a/luaotfload-merged.lua +++ b/luaotfload-merged.lua @@ -1,6 +1,6 @@  -- merged file : luatex-fonts-merged.lua  -- parent file : luatex-fonts.lua --- merge date  : 05/14/13 23:14:52 +-- merge date  : 05/16/13 00:29:34  do -- begin closure to overcome local limits and interference @@ -1986,7 +1986,7 @@ elseif not lfs.isfile then    end  end  local insert,concat=table.insert,table.concat -local match,find=string.match,string.find +local match,find,gmatch=string.match,string.find,string.gmatch  local lpegmatch=lpeg.match  local getcurrentdir,attributes=lfs.currentdir,lfs.attributes  local checkedsplit=string.checkedsplit @@ -2299,6 +2299,19 @@ function file.strip(name,dir)      return a~="" and a or name    end  end +function lfs.mkdirs(path) +  local full +  for sub in gmatch(path,"([^\\/]+)") do +    if full then +      full=full.."/"..sub +    else +      full=sub +    end +    if not lfs.isdir(full) then +      lfs.mkdir(full) +    end +  end +end  end -- closure @@ -3006,8 +3019,15 @@ do    end    cachepaths=string.split(cachepaths,os.type=="windows" and ";" or ":")    for i=1,#cachepaths do -    if file.is_writable(cachepaths[i]) then -      writable=file.join(cachepaths[i],"luatex-cache") +    local cachepath=cachepaths[i] +    if not lfs.isdir(cachepath) then +      lfs.mkdirs(cachepath)  +      if lfs.isdir(cachepath) then +        texio.write(string.format("(created cache path: %s)",cachepath)) +      end +    end +    if file.is_writable(cachepath) then +      writable=file.join(cachepath,"luatex-cache")        lfs.mkdir(writable)        writable=file.join(writable,caches.namespace)        lfs.mkdir(writable) @@ -6809,7 +6829,7 @@ local function checkmathsize(tfmdata,mathsize)  end  registerotffeature {    name="mathsize", -  description="apply mathsize as specified in the font", +  description="apply mathsize specified in the font",    initializers={      base=checkmathsize,      node=checkmathsize,  | 
