From 631a40d69d7fb4e5beff90039d21da5472dd1020 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Mon, 17 Feb 2020 16:17:51 +0100 Subject: 2020-02-17 12:10:00 --- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-log.mkiv | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/context.mkxl | 2 +- tex/context/base/mkiv/font-cff.lua | 9 +++ tex/context/base/mkiv/lpdf-wid.lua | 13 ++-- tex/context/base/mkiv/status-files.pdf | Bin 26747 -> 26753 bytes tex/context/base/mkiv/status-lua.pdf | Bin 269549 -> 269549 bytes tex/context/base/mkiv/trac-inf.lua | 82 ++++++++++++--------- tex/context/base/mkiv/util-sac.lua | 28 +++---- tex/generic/context/luatex/luatex-fonts-merged.lua | 10 ++- 13 files changed, 90 insertions(+), 64 deletions(-) (limited to 'tex') diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 8570ac7a9..682160a36 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2020.02.11 16:36} +\newcontextversion{2020.02.17 12:06} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index e02bc12dd..bc6869fec 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2020.02.11 16:36} +\edef\contextversion{2020.02.17 12:06} %D For those who want to use this: diff --git a/tex/context/base/mkiv/cont-log.mkiv b/tex/context/base/mkiv/cont-log.mkiv index 1fd0cc4d4..75d87eb81 100644 --- a/tex/context/base/mkiv/cont-log.mkiv +++ b/tex/context/base/mkiv/cont-log.mkiv @@ -52,7 +52,7 @@ \begingroup \setbox\scratchbox\hbox{L}% \scratchdimen\ht\scratchbox - \setbox\scratchbox\hbox{\txx A}% + \setbox\scratchbox\hbox{\doresetattribute{case}\txx A}% L\kern-.55\wd\scratchbox \raise\scratchdimen\hbox{\lower\ht\scratchbox\copy\scratchbox}% \kern-.2\wd\scratchbox\TeX diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index cd700391a..97d5d2071 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2020.02.11 16:36} +\newcontextversion{2020.02.17 12:06} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 30389e598..9cdb78c47 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -45,7 +45,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.02.11 16:36} +\edef\contextversion{2020.02.17 12:06} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl index ef3fddc3d..5cb85c4cd 100644 --- a/tex/context/base/mkiv/context.mkxl +++ b/tex/context/base/mkiv/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2020.02.11 16:36} +\edef\contextversion{2020.02.17 12:06} \edef\contextkind {beta} %D Kind of special: diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua index 5f79ba7a3..72b0a038f 100644 --- a/tex/context/base/mkiv/font-cff.lua +++ b/tex/context/base/mkiv/font-cff.lua @@ -184,6 +184,15 @@ local cffreaders = { readulong, } +directives.register("fonts.streamreader",function() + cffreaders = { + readbyte, + readushort, + readuint, + readulong, + } +end) + -- The header contains information about its own size. local function readheader(f) diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua index 8e0a45a00..106eb98cc 100644 --- a/tex/context/base/mkiv/lpdf-wid.lua +++ b/tex/context/base/mkiv/lpdf-wid.lua @@ -347,13 +347,12 @@ function codeinjections.embedfile(specification) f = pdfflushstreamobject(data,a) specification.data = true -- signal that still data but already flushed else + local attributes = lfs.attributes(foundname) local modification = modificationtime(foundname) - if attributes then - a.Params = { - Size = attributes.size, - ModDate = lpdf.pdftimestamp(modification), - } - end + a.Params = { + Size = attributes.size, + ModDate = lpdf.pdftimestamp(modification), + } f = pdfflushstreamfileobject(foundname,a,compress) end local d = pdfdictionary { @@ -449,7 +448,7 @@ function nodeinjections.attachfile(specification) AP = appearance, OC = analyzelayer(specification.layer), -- F = pdfnull(), -- another rediculous need to satisfy validation - F = (flags | 4) & (1023-1-2-32-256), -- set 3, clear 1,2,6,9; PDF 32000-1, p385 + F = bit32.band(bit32.bor(flags,4),(1023-1-2-32-256)), -- set 3, clear 1,2,6,9; PDF 32000-1, p385 } local width = specification.width or 0 local height = specification.height or 0 diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e5fe90ad2..baed04d32 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index ac49b2139..9e63b48f6 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/trac-inf.lua b/tex/context/base/mkiv/trac-inf.lua index 24ebc5249..40dfe854e 100644 --- a/tex/context/base/mkiv/trac-inf.lua +++ b/tex/context/base/mkiv/trac-inf.lua @@ -45,42 +45,52 @@ end local ticks = clock local seconds = function(n) return n or 0 end --- if FFISUPPORTED and ffi and os.type == "windows" then --- --- local okay, kernel = pcall(ffi.load,"kernel32") --- --- if kernel then --- --- local tonumber = ffi.number or tonumber --- --- ffi.cdef[[ --- int QueryPerformanceFrequency(int64_t *lpFrequency); --- int QueryPerformanceCounter(int64_t *lpPerformanceCount); --- ]] --- --- local target = ffi.new("__int64[1]") --- --- ticks = function() --- if kernel.QueryPerformanceCounter(target) == 1 then --- return tonumber(target[0]) --- else --- return 0 --- end --- end --- --- local target = ffi.new("__int64[1]") --- --- seconds = function(ticks) --- if kernel.QueryPerformanceFrequency(target) == 1 then --- return ticks / tonumber(target[0]) --- else --- return 0 --- end --- end --- --- end --- --- end +if lua.getpreciseticks then + + ticks = lua.getpreciseticks + seconds = lua.getpreciseseconds + +elseif FFISUPPORTED and ffi and os.type == "windows" then + + local okay, kernel = pcall(ffi.load,"kernel32") + + if kernel then + + local tonumber = ffi.number or tonumber + + ffi.cdef[[ + int QueryPerformanceFrequency(int64_t *lpFrequency); + int QueryPerformanceCounter(int64_t *lpPerformanceCount); + ]] + + local target = ffi.new("__int64[1]") + + ticks = function() + if kernel.QueryPerformanceCounter(target) == 1 then + return tonumber(target[0]) + else + return 0 + end + end + + local target = ffi.new("__int64[1]") + + seconds = function(ticks) + if kernel.QueryPerformanceFrequency(target) == 1 then + return ticks / tonumber(target[0]) + else + return 0 + end + end + + end + +else + + -- excessive timing costs some 1-2 percent runtime + +end + local function starttiming(instance,reset) local timer = timers[instance or "notimer"] diff --git a/tex/context/base/mkiv/util-sac.lua b/tex/context/base/mkiv/util-sac.lua index 19dc0eb0f..47c753ab1 100644 --- a/tex/context/base/mkiv/util-sac.lua +++ b/tex/context/base/mkiv/util-sac.lua @@ -263,9 +263,9 @@ function streams.readfixed2(f) f[2] = j + 1 local a, b = byte(f[1],i,j) if a >= 0x80 then - tonumber((a - 0x100) .. "." .. b) + return tonumber((a - 0x100) .. "." .. b) or 0 else - tonumber((a ) .. "." .. b) + return tonumber((a ) .. "." .. b) or 0 end end @@ -275,9 +275,9 @@ function streams.readfixed4(f) f[2] = j + 1 local a, b, c, d = byte(f[1],i,j) if a >= 0x80 then - tonumber((0x100 * a + b - 0x10000) .. "." .. (0x100 * c + d)) + return tonumber((0x100 * a + b - 0x10000) .. "." .. (0x100 * c + d)) or 0 else - tonumber((0x100 * a + b ) .. "." .. (0x100 * c + d)) + return tonumber((0x100 * a + b ) .. "." .. (0x100 * c + d)) or 0 end end @@ -366,16 +366,16 @@ if sio and sio.readcardinal2 then f[2] = i + 4 return readinteger4(f[1],i) end - -- function streams.readfixed2(f) -- needs recent luatex - -- local i = f[2] - -- f[2] = i + 2 - -- return readfixed2(f[1],i) - -- end - -- function streams.readfixed4(f) -- needs recent luatex - -- local i = f[2] - -- f[2] = i + 4 - -- return readfixed4(f[1],i) - -- end + function streams.readfixed2(f) -- needs recent luatex + local i = f[2] + f[2] = i + 2 + return readfixed2(f[1],i) + end + function streams.readfixed4(f) -- needs recent luatex + local i = f[2] + f[2] = i + 4 + return readfixed4(f[1],i) + end function streams.read2dot4(f) local i = f[2] f[2] = i + 2 diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index cc61d0a18..41fbe10fd 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2020-02-11 16:36 +-- merge date : 2020-02-17 12:06 do -- begin closure to overcome local limits and interference @@ -14179,6 +14179,14 @@ local cffreaders={ readuint, readulong, } +directives.register("fonts.streamreader",function() + cffreaders={ + readbyte, + readushort, + readuint, + readulong, + } +end) local function readheader(f) local offset=getposition(f) local major=readbyte(f) -- cgit v1.2.3