summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/font-dsp.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2020-02-16 10:59:14 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2020-02-16 10:59:14 +0100
commit8e11d447440b44990432ac838953a8cde4ef914f (patch)
treef30b2ff2d8a10f1aff50e1522d968618a97f067c /tex/context/base/mkiv/font-dsp.lua
parent43fc66771a0c9d27cc0b7fe7a69392ea313bd0ca (diff)
downloadcontext-8e11d447440b44990432ac838953a8cde4ef914f.tar.gz
2020-02-11 16:39:00
Diffstat (limited to 'tex/context/base/mkiv/font-dsp.lua')
-rw-r--r--tex/context/base/mkiv/font-dsp.lua57
1 files changed, 44 insertions, 13 deletions
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index 7777f9c6a..3058be37b 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -3237,7 +3237,8 @@ function readers.sbix(f,fontdata,specification)
return b.ppem < a.ppem
end
end)
- local glyphs = { }
+ local glyphs = { }
+ local delayed = CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 or fonts.handlers.typethree
for i=1,nofstrikes do
local strike = strikes[i]
local strikeppem = strike.ppem
@@ -3254,13 +3255,28 @@ function readers.sbix(f,fontdata,specification)
local datasize = nextoffset - glyphoffset
if datasize > 0 then
setposition(f,strikeoffset + glyphoffset)
+ local x = readshort(f)
+ local y = readshort(f)
+ local tag = readtag(f) -- or just skip, we never needed it till now
+ local size = datasize - 8
+ local data = nil
+ local offset = nil
+ if delayed then
+ offset = getposition(f)
+ data = nil
+ else
+ data = readstring(f,size)
+ size = nil
+ end
shapes[i] = {
- x = readshort(f),
- y = readshort(f),
- tag = readtag(f), -- maybe for tracing
- data = readstring(f,datasize-8),
- ppem = strikeppem, -- not used, for tracing
- ppi = strikeppi, -- not used, for tracing
+ x = x,
+ y = y,
+ o = offset,
+ s = size,
+ data = data,
+ -- tag = tag, -- maybe for tracing
+ -- ppem = strikeppem, -- not used, for tracing
+ -- ppi = strikeppi, -- not used, for tracing
}
done = done + 1
if done == nofglyphs then
@@ -3462,32 +3478,48 @@ do
local default = { width = 0, height = 0 }
local glyphs = fontdata.glyphs
+ local delayed = CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 or fonts.handlers.typethree
for index, subtable in sortedhash(shapes) do
if type(subtable) == "table" then
local data = nil
+ local size = nil
local metrics = default
local format = subtable.format
local offset = subtable.offsets[index]
setposition(f,offset)
if format == 17 then
metrics = getsmallmetrics(f)
- data = readstring(f,readulong(f))
+ size = true
elseif format == 18 then
metrics = getbigmetrics(f)
- data = readstring(f,readulong(f))
+ size = true
elseif format == 19 then
metrics = subtable.metrics
- data = readstring(f,readulong(f))
+ size = true
else
-- forget about it
end
+ if size then
+ size = readulong(f)
+ if delayed then
+ offset = getposition(f)
+ data = nil
+ else
+ offset = nil
+ data = readstring(f,size)
+ size = nil
+ end
+ else
+ offset = nil
+ end
local x = metrics.width
local y = metrics.height
shapes[index] = {
- -- maybe some metrics
x = x,
y = y,
+ o = offset,
+ s = size,
data = data,
}
-- I'll look into this in more details when needed
@@ -3498,12 +3530,11 @@ do
local height = width * y/x
glyph.boundingbox = { 0, 0, width, height }
end
-
else
shapes[index] = {
x = 0,
y = 0,
- data = "",
+ data = "", -- or just nil
}
end
end