summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/char-ini.lua2
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/data-con.lua6
-rw-r--r--tex/context/base/mkiv/font-cff.lua72
-rw-r--r--tex/context/base/mkiv/font-mis.lua2
-rw-r--r--tex/context/base/mkiv/font-onr.lua2
-rw-r--r--tex/context/base/mkiv/font-otl.lua2
-rw-r--r--tex/context/base/mkiv/font-shp.lua15
-rw-r--r--tex/context/base/mkiv/good-ini.lua4
-rw-r--r--tex/context/base/mkiv/math-ext.lua4
-rw-r--r--tex/context/base/mkiv/math-ren.lua7
-rw-r--r--tex/context/base/mkiv/math-ttv.lua10
-rw-r--r--tex/context/base/mkiv/math-vfu.lua9
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24610 -> 24598 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin265594 -> 265646 bytes
-rw-r--r--tex/context/base/mkiv/strc-pag.lua4
-rw-r--r--tex/context/base/mkiv/strc-ref.lua10
-rw-r--r--tex/context/base/mkiv/typo-cln.lua2
19 files changed, 83 insertions, 72 deletions
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 8f1bc4fb0..db1b85cc5 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -66,7 +66,7 @@ end
Extending the table.
--ldx]]--
-if context then
+if context and CONTEXTLMTXMODE == 0 then
if not characters.private then
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 1b0808abe..97de2e2d5 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{2023.01.26 18:32}
+\newcontextversion{2023.02.06 17:55}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 19c917ba3..ee8b3bfe0 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -49,7 +49,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2023.01.26 18:32}
+\edef\contextversion{2023.02.06 17:55}
%D Kind of special:
diff --git a/tex/context/base/mkiv/data-con.lua b/tex/context/base/mkiv/data-con.lua
index ec2251b35..51e0ce856 100644
--- a/tex/context/base/mkiv/data-con.lua
+++ b/tex/context/base/mkiv/data-con.lua
@@ -56,7 +56,7 @@ local mt = {
__storage__ = true
}
-function containers.define(category, subcategory, version, enabled)
+function containers.define(category, subcategory, version, enabled, reload)
if category and subcategory then
local c = allocated[category]
if not c then
@@ -70,6 +70,7 @@ function containers.define(category, subcategory, version, enabled)
subcategory = subcategory,
storage = { },
enabled = enabled,
+ reload = reload,
version = version or math.pi, -- after all, this is TeX
trace = false,
-- writable = getwritablepath and getwritablepath (category,subcategory) or { "." },
@@ -97,7 +98,8 @@ end
function containers.read(container,name)
local storage = container.storage
- local stored = storage[name]
+ local reload = container.reload
+ local stored = not reload and storage[name]
if not stored and container.enabled and caches and containers.usecache then
stored = loaddatafromcache(container.readables,name,container.writable)
if stored and stored.cache_version == container.version then
diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua
index f1c377637..ee6b843bc 100644
--- a/tex/context/base/mkiv/font-cff.lua
+++ b/tex/context/base/mkiv/font-cff.lua
@@ -714,7 +714,7 @@ do
local y = 0
local width = false
local lsb = 0
-local result = { }
+ local result = { }
local r = 0
local stems = 0
local globalbias = 0
@@ -1731,15 +1731,13 @@ end
end
for i=108,1131 do
local v = 0xF700 + i - 108
--- t[i] = char(band(rshift(v,8),0xFF),band(v,0xFF))
t[i] = char(extract(v,8,8),extract(v,0,8))
end
for i=1132,2048 do
t[i] = char(28,band(rshift(i,8),0xFF),band(i,0xFF))
end
- -- we could inline some ...
setmetatableindex(encode,function(t,k)
- -- 16.16-bit signed fixed value
+ -- as we're cff2 we write 16.16-bit signed fixed value
local r = round(k)
local v = rawget(t,r)
if v then
@@ -1844,42 +1842,6 @@ end
-- precompiling and reuse is much slower than redoing the calls
- -- local function decode(str)
- -- local a, b, c, d, e = byte(str,1,5)
- -- if a == 28 then
- -- if c then
- -- local n = 0x100 * b + c
- -- if n >= 0x8000 then
- -- return n - 0x10000
- -- else
- -- return n
- -- end
- -- end
- -- elseif a < 32 then
- -- return false
- -- elseif a <= 246 then
- -- return a - 139
- -- elseif a <= 250 then
- -- if b then
- -- return a*256 - 63124 + b
- -- end
- -- elseif a <= 254 then
- -- if b then
- -- return -a*256 + 64148 - b
- -- end
- -- else
- -- if e then
- -- local n = 0x100 * b + c
- -- if n >= 0x8000 then
- -- return n - 0x10000 + (0x100 * d + e)/0xFFFF
- -- else
- -- return n + (0x100 * d + e)/0xFFFF
- -- end
- -- end
- -- end
- -- return false
- -- end
-
process = function(tab)
local i = 1
local n = #tab
@@ -1903,8 +1865,14 @@ end
-- stack[top] = -t*256 + 251*256 - tab[i+1] - 108
stack[top] = -t*256 + 64148 - tab[i+1]
i = i + 2
+ elseif version == "cff" then
+ local n = 0x1000000 * tab[i+1] + 0x10000 * tab[i+2] + 0x100 * tab[i+3] + tab[i+4]
+ if n >= 0x8000000 then
+ n = n - 0xFFFFFFFF - 1
+ end
+ stack[top] = n
+ i = i + 5
else
- -- a 16.16 float (used for italic but pretty unreliable)
local n1 = 0x100 * tab[i+1] + tab[i+2]
local n2 = 0x100 * tab[i+3] + tab[i+4]
if n1 >= 0x8000 then
@@ -2167,7 +2135,7 @@ end
end
end
- local function processshape(tab,index,hack)
+ local function processshape(glyphs,tab,index,hack)
if not tab then
glyphs[index] = {
@@ -2233,9 +2201,10 @@ result = nil
-- report("vdata: %s",stream)
-- end
if glyph then
- glyph.stream = stream
+ glyph.stream = stream
+ glyph.width = width
else
- glyphs[index] = { stream = stream }
+ glyphs[index] = { stream = stream, width = width }
end
elseif glyph then
glyph.segments = keepcurve ~= false and result or nil
@@ -2263,7 +2232,6 @@ result = nil
name = charset and charset[index] or nil,
}
end
-
if trace_charstrings then
report("width : %s",tostring(width))
report("boundingbox: % t",boundingbox)
@@ -2326,7 +2294,8 @@ result = nil
locals = dictionary.subroutines or { }
charset = dictionary.charset
vsindex = dictionary.vsindex or 0
- glyphs = glphs or { }
+
+ local glyphs = glphs or { }
globalbias, localbias = setbias(globals,locals,nobias)
nominalwidth, defaultwidth = setwidths(dictionary.private)
@@ -2334,7 +2303,7 @@ result = nil
if charstrings then
startparsing(fontdata,data,streams)
for index=1,#charstrings do
- processshape(charstrings[index],index-1)
+ processshape(glyphs,charstrings[index],index-1)
end
if justpass and next(seacs) then
-- old type 1 stuff ... seacs
@@ -2350,7 +2319,7 @@ result = nil
-- this is a real ugly hack but we seldom enter this branch (e.g. old lbr)
local jp = justpass
justpass = false
- local x, y = processshape(charstrings[bindex+1],bindex,true)
+ local x, y = processshape(glyphs,charstrings[bindex+1],bindex,true)
justpass = jp
--
local base = bglyph.stream
@@ -2381,7 +2350,8 @@ result = nil
locals = dictionary.subroutines or { }
charset = false
vsindex = dictionary.vsindex or 0
- glyphs = glphs or { }
+
+ local glyphs = glphs or { }
justpass = streams == true
seacs = { }
@@ -2389,9 +2359,9 @@ result = nil
globalbias, localbias = setbias(globals,locals,nobias)
nominalwidth, defaultwidth = setwidths(dictionary.private)
- processshape(tab,index-1)
+ processshape(glyphs,tab,index-1)
- -- return glyphs[index]
+ return glyphs[index]
end
end
diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua
index e00c84e40..42dc0bd3c 100644
--- a/tex/context/base/mkiv/font-mis.lua
+++ b/tex/context/base/mkiv/font-mis.lua
@@ -21,7 +21,7 @@ local readers = otf.readers
if readers then
- otf.version = otf.version or 3.131
+ otf.version = otf.version or 3.132
otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true)
function fonts.helpers.getfeatures(name,save)
diff --git a/tex/context/base/mkiv/font-onr.lua b/tex/context/base/mkiv/font-onr.lua
index c33b09f9e..9e5a012bd 100644
--- a/tex/context/base/mkiv/font-onr.lua
+++ b/tex/context/base/mkiv/font-onr.lua
@@ -211,6 +211,8 @@ do
+ P(1)
)^0 * Carg(1)
+ -- cache this?
+
local function loadpfbvector(filename,shapestoo,streams)
-- for the moment limited to encoding only
diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua
index 7114f5ba2..354ca59a7 100644
--- a/tex/context/base/mkiv/font-otl.lua
+++ b/tex/context/base/mkiv/font-otl.lua
@@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading")
local fonts = fonts
local otf = fonts.handlers.otf
-otf.version = 3.131 -- beware: also sync font-mis.lua and in mtx-fonts
+otf.version = 3.132 -- beware: also sync font-mis.lua and in mtx-fonts
otf.cache = containers.define("fonts", "otl", otf.version, true)
otf.svgcache = containers.define("fonts", "svg", otf.version, true)
otf.pngcache = containers.define("fonts", "png", otf.version, true)
diff --git a/tex/context/base/mkiv/font-shp.lua b/tex/context/base/mkiv/font-shp.lua
index feae0ba1c..843f75eb8 100644
--- a/tex/context/base/mkiv/font-shp.lua
+++ b/tex/context/base/mkiv/font-shp.lua
@@ -150,6 +150,8 @@ end
local readers = otf.readers
local cleanname = otf.readers.helpers.cleanname
+-- todo: shared hash for this but not accessed often
+
local function makehash(filename,sub,instance)
local name = cleanname(file.basename(filename))
if instance then
@@ -234,17 +236,21 @@ local function loadstreams(cache,filename,sub,instance)
if data then
local glyphs = data.glyphs
local streams = { }
+ -- local widths = { }
if glyphs then
for i=0,#glyphs do
local glyph = glyphs[i]
if glyph then
streams[i] = glyph.stream or ""
+ -- widths [i] = glyph.width or 0
else
streams[i] = ""
+ -- widths [i] = 0
end
end
end
data.streams = streams
+ -- data.widths = widths -- maybe more reliable!
data.glyphs = nil
data.size = size
data.format = data.format or (kind == "otf" and "opentype") or "truetype"
@@ -259,8 +265,11 @@ local function loadstreams(cache,filename,sub,instance)
local names, encoding, streams, metadata = pfb.loadvector(filename,false,true)
if streams then
local fontbbox = metadata.fontbbox or { 0, 0, 0, 0 }
+ -- local widths = { }
for i=0,#streams do
- streams[i] = streams[i].stream or "\14"
+ local s = streams[i]
+ streams[i] = s.stream or "\14"
+ -- widths [i] = s.width or 0
end
data = {
filename = filename,
@@ -268,6 +277,7 @@ local function loadstreams(cache,filename,sub,instance)
time = time,
format = "type1",
streams = streams,
+ -- widths = widths,
fontheader = {
fontversion = metadata.version,
units = 1000, -- can this be different?
@@ -346,7 +356,8 @@ local function getstreamhash(fontid)
local fontdata = identifiers[fontid]
if fontdata then
local properties = fontdata.properties
- return makehash(properties.filename,properties.subfont,properties.instance), fontdata
+ local fonthash = makehash(properties.filename,properties.subfont,properties.instance)
+ return fonthash, fontdata
end
end
diff --git a/tex/context/base/mkiv/good-ini.lua b/tex/context/base/mkiv/good-ini.lua
index 22ca12d28..df79adb61 100644
--- a/tex/context/base/mkiv/good-ini.lua
+++ b/tex/context/base/mkiv/good-ini.lua
@@ -150,7 +150,9 @@ end
local function flattenedfeatures(t,tt)
-- first set value dominates
- local tt = tt or { }
+ if not tt then
+ tt = { }
+ end
for i=1,#t do
local ti = t[i]
local ty = type(ti)
diff --git a/tex/context/base/mkiv/math-ext.lua b/tex/context/base/mkiv/math-ext.lua
index 762f1f904..1f78d6ad4 100644
--- a/tex/context/base/mkiv/math-ext.lua
+++ b/tex/context/base/mkiv/math-ext.lua
@@ -27,7 +27,7 @@ local mathplus = { }
-- todo: store them and skip storage if already stored
-- todo: make a char-ctx.lua (or is this already side effect of save in format)
-local function addextra(unicode)
+function extras.add(unicode)
local min = mathematics.extrabase
local max = min + 0xFFF
if unicode >= min and unicode <= max then
@@ -41,8 +41,6 @@ local function addextra(unicode)
end
end
-extras.add = addextra
-
function extras.copy(target,original)
local characters = target.characters
local properties = target.properties
diff --git a/tex/context/base/mkiv/math-ren.lua b/tex/context/base/mkiv/math-ren.lua
index 4628ffe55..cf429cb3a 100644
--- a/tex/context/base/mkiv/math-ren.lua
+++ b/tex/context/base/mkiv/math-ren.lua
@@ -33,6 +33,13 @@ mappings["blackboard-to-bold"] = {
[0x02124] = 0x1D419,
}
+mappings["mikaels-favourites"] = {
+ [0x211D] = 0x1D411,
+ [0x211A] = 0x1D410,
+ [0x2124] = 0x1D419,
+ [0x2115] = 0x1D40D,
+}
+
local function renderset(list) -- order matters
local tag = gsub(list," ","")
local n = sets[tag]
diff --git a/tex/context/base/mkiv/math-ttv.lua b/tex/context/base/mkiv/math-ttv.lua
index 151183212..662211a0d 100644
--- a/tex/context/base/mkiv/math-ttv.lua
+++ b/tex/context/base/mkiv/math-ttv.lua
@@ -61,6 +61,14 @@ mathencodings["large-to-small"] = {
[0x02044] = 0x0E, -- /
}
+mathencodings["large-to-small-private"] = {
+ [0xFE07A] = 0x7A, -- bracehtipdownleft
+ [0xFE07B] = 0x7B, -- bracehtipdownright
+ [0xFE07C] = 0x7C, -- bracehtipupleft
+ [0xFE07D] = 0x7D, -- bracehtipupright
+
+}
+
-- Beware: these are (in cm/lm) below the baseline due to limitations
-- in the tfm format but the engine (combined with the mathclass) takes
-- care of it. If we need them in textmode, we should make them virtual
@@ -429,7 +437,7 @@ mathencodings["tex-sy"] = {
[0x027E9] = 0x69, -- >, rangle
[0x0007C] = 0x6A, -- |, mid, lvert, rvert
[0x02225] = 0x6B, -- parallel
- -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert
+ -- [0x0 ] = 0x00, -- Vert, lVert, rVert, arrowvert, Arrowvert
[0x02195] = 0x6C, -- updownarrow
[0x021D5] = 0x6D, -- Updownarrow
[0x0005C] = 0x6E, -- \, backslash, setminus
diff --git a/tex/context/base/mkiv/math-vfu.lua b/tex/context/base/mkiv/math-vfu.lua
index f282005fc..5fe9738a2 100644
--- a/tex/context/base/mkiv/math-vfu.lua
+++ b/tex/context/base/mkiv/math-vfu.lua
@@ -284,10 +284,9 @@ local function dots(main,characters,id,size,unicode)
}
end
elseif unicode == 0x22EE then
- -- weird height !
characters[unicode] = {
width = w,
- height = h+(1.4)*size,
+ height = h+0.8*size,
depth = 0,
commands = {
push, push, slot, pop, up4size, push, slot, pop, up4size, slot, pop,
@@ -296,7 +295,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F1 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = 0.7*size,
depth = 0,
commands = {
push,
@@ -313,7 +312,7 @@ local function dots(main,characters,id,size,unicode)
elseif unicode == 0x22F0 then
characters[unicode] = {
width = 3*w + 6*size/18,
- height = 1.5*size,
+ height = 0.7*size,
depth = 0,
commands = {
push,
@@ -422,7 +421,7 @@ local function stack(main,characters,id,size,unicode,u1,d12,u2)
local mu = size/18
characters[unicode] = {
width = w1,
- height = h1 + h2 + d12,
+ height = h1 + h2 + d12*mu,
depth = d1,
commands = {
{ "slot", id, u1 },
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 2a59817c4..4395a2a82 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 08eb077f3..96871e62a 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-pag.lua b/tex/context/base/mkiv/strc-pag.lua
index 5cdba5b76..d26f4adcf 100644
--- a/tex/context/base/mkiv/strc-pag.lua
+++ b/tex/context/base/mkiv/strc-pag.lua
@@ -255,7 +255,7 @@ function helpers.analyze(entry,specification)
if not section then
return entry, false, "no section"
end
- local sectiondata = sections.collected[references.section]
+ local sectiondata = references.sectiondata or sections.collected[references.section] -- so we use an already resolved external one
if not sectiondata then
return entry, false, "no section data"
end
@@ -272,7 +272,7 @@ function helpers.analyze(entry,specification)
return entry, sectiondata, "okay"
end
-function helpers.prefix(data,prefixspec,nosuffix)
+function helpers.prefix(data,prefixspec,nosuffix) -- not only page
if data then
local _, prefixdata, status = helpers.analyze(data,prefixspec)
if prefixdata then
diff --git a/tex/context/base/mkiv/strc-ref.lua b/tex/context/base/mkiv/strc-ref.lua
index 87fea6b68..8d081c923 100644
--- a/tex/context/base/mkiv/strc-ref.lua
+++ b/tex/context/base/mkiv/strc-ref.lua
@@ -1039,6 +1039,7 @@ local function loadexternalreferences(name,utilitydata)
local external = struc.references.collected -- direct references
local lists = struc.lists.collected -- indirect references (derived)
local pages = struc.pages.collected -- pagenumber data
+ local sections = struc.sections.collected
-- a bit weird one, as we don't have the externals in the collected
for prefix, set in next, external do
if prefix == "" then
@@ -1074,6 +1075,15 @@ local function loadexternalreferences(name,utilitydata)
if prefix == "" then
prefix = name -- this can clash!
end
+ local section = references.section
+ if section then
+ -- we have to make sure that the right section is used, see helpers.prefix
+ if sections then
+ references.sectiondata = sections[section]
+ else
+ -- warning
+ end
+ end
local target = external[prefix]
if not target then
target = { }
diff --git a/tex/context/base/mkiv/typo-cln.lua b/tex/context/base/mkiv/typo-cln.lua
index b9b0e7d6c..469859162 100644
--- a/tex/context/base/mkiv/typo-cln.lua
+++ b/tex/context/base/mkiv/typo-cln.lua
@@ -10,6 +10,8 @@ if not modules then modules = { } end modules ['typo-cln'] = {
-- this case Dream Theaters' Octavium). Of course extensions will take
-- more time.
+-- This feature is probably never used so we can get rid of it.
+
local tonumber = tonumber
local utfbyte = utf.byte