diff options
author | Hans Hagen <pragma@wxs.nl> | 2012-11-07 23:16:00 +0100 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2012-11-07 23:16:00 +0100 |
commit | 7322c8238e527f50b0cd50b35b231b2734a869ba (patch) | |
tree | 9bfd100e686d7e8e10672ab8e953a9ea67a5394e /tex/generic | |
parent | 1fcc520803951a61b5a08baf6c1cdac8f7111e75 (diff) | |
download | context-7322c8238e527f50b0cd50b35b231b2734a869ba.tar.gz |
beta 2012.11.07 23:16
Diffstat (limited to 'tex/generic')
-rw-r--r-- | tex/generic/context/luatex/luatex-fonts-merged.lua | 61 |
1 files changed, 52 insertions, 9 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 2ddebbed7..0b07ef402 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 11/06/12 09:56:45 +-- merge date : 11/07/12 23:16:09 do -- begin closure to overcome local limits and interference @@ -2662,6 +2662,7 @@ if not modules then modules = { } end modules ['l-io'] = { local io = io local byte, find, gsub, format = string.byte, string.find, string.gsub, string.format local concat = table.concat +local floor = math.floor local type = type if string.find(os.getenv("PATH"),";") then @@ -2670,10 +2671,49 @@ else io.fileseparator, io.pathseparator = "/" , ":" end +local function readall(f) + return f:read("*all") +end + +-- The next one is upto 50% faster on large files and less memory consumption due +-- to less intermediate large allocations. This phenomena was discussed on the +-- luatex dev list. + +local function readall(f) + local size = f:seek("end") + if size == 0 then + return "" + elseif size < 1024*1024 then + f:seek("set",0) + return f:read('*all') + else + local done = f:seek("set",0) + if size < 1024*1024 then + step = 1024 * 1024 + elseif size > 16*1024*1024 then + step = 16*1024*1024 + else + step = floor(size/(1024*1024)) * 1024 * 1024 / 8 + end + local data = { } + while true do + local r = f:read(step) + if not r then + return concat(data) + else + data[#data+1] = r + end + end + end +end + +io.readall = readall + function io.loaddata(filename,textmode) -- return nil if empty local f = io.open(filename,(textmode and 'r') or 'rb') if f then - local data = f:read('*all') + -- local data = f:read('*all') + local data = readall(f) f:close() if #data > 0 then return data @@ -4048,13 +4088,16 @@ function constructors.scale(tfmdata,specification) -- some context specific trickery (this will move to a plugin) -- if hasmath then - if properties.mathitalics then - italickey = "italic_correction" - if trace_defining then - report_defining("math italics disabled for: name '%s', fullname: '%s', filename: '%s'", - name or "noname",fullname or "nofullname",filename or "nofilename") - end - end + -- the latest luatex can deal with it itself so we now disable this + -- mechanism here + -- + -- if properties.mathitalics then + -- italickey = "italic_correction" + -- if trace_defining then + -- report_defining("math italics disabled for: name '%s', fullname: '%s', filename: '%s'", + -- name or "noname",fullname or "nofullname",filename or "nofilename") + -- end + -- end autoitalicamount = false -- new else if properties.textitalics then |