summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-11-08 00:40:14 +0200
committerMarius <mariausol@gmail.com>2012-11-08 00:40:14 +0200
commit1d0171ce126552c90869eab4fe4f0679bf459ce6 (patch)
treeb65005d242667867377c0396fce8e0ecc123546a /tex/generic
parenta348d7ad3b4077c1ce1cf65d7f2ab21487aad3b3 (diff)
downloadcontext-1d0171ce126552c90869eab4fe4f0679bf459ce6.tar.gz
beta 2012.11.07 23:16
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua61
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