summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-05-07 01:01:21 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-05-07 01:01:21 +0200
commit57c3891a6b93b57f91ea77c9bbecffacbcc0da28 (patch)
tree410b95f8a809ab33ffba6ac69bac7c466b4d514d /tex/context/base
parent762562da00d0ec1d50e6d3c2a701156ab42e6d71 (diff)
downloadcontext-57c3891a6b93b57f91ea77c9bbecffacbcc0da28.tar.gz
2017-05-06 23:13:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkiv/char-ini.lua18
-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/font-lib.mkvi1
-rw-r--r--tex/context/base/mkiv/font-ocl.lua32
-rw-r--r--tex/context/base/mkiv/font-otr.lua4
-rw-r--r--tex/context/base/mkiv/font-ttf.lua160
-rw-r--r--tex/context/base/mkiv/m-oldotf.mkiv1
-rw-r--r--tex/context/base/mkiv/spac-grd.mkiv16
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25667 -> 25664 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin424881 -> 424881 bytes
13 files changed, 157 insertions, 83 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 0a74d9611..d75587f56 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{2017.04.27 01:00}
+\newcontextversion{2017.05.06 23: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 e6dc51a82..dfbd7e33a 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{2017.04.27 01:00}
+\edef\contextversion{2017.05.06 23:06}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/char-ini.lua b/tex/context/base/mkiv/char-ini.lua
index 4f2b7a4d5..f673a6a86 100644
--- a/tex/context/base/mkiv/char-ini.lua
+++ b/tex/context/base/mkiv/char-ini.lua
@@ -1496,8 +1496,8 @@ do
local p_special = p_family + p_couple + p_kiss
--- print(lpeg.match(p_special,"family man woman girl"))
--- print(lpeg.match(p_special,"family man dark skin tone woman girl girl"))
+ -- print(lpeg.match(p_special,"family man woman girl"))
+ -- print(lpeg.match(p_special,"family man dark skin tone woman girl girl"))
-- local p_special = P { "all",
-- all = Cs (V("family") + V("couple") + V("kiss")),
@@ -1509,11 +1509,11 @@ do
-- rest = (space * skin)^0/"" * ((space^1/zwj) + P(-1)),
-- }
- -- maybe characters.emoji.toutf
-
local emoji = { }
characters.emoji = emoji
+local cache = setmetatable({ }, { __mode = "k" } )
+
function emoji.resolve(name)
if not hash then
data, hash = load()
@@ -1522,25 +1522,35 @@ do
if h then
return h
end
+local h = cache[name]
+if h then
+ return h
+elseif h == false then
+ return
+end
-- expand shortcuts
local name = lpegmatch(pattern_0,name) or name
-- expand some 25K variants
local h = lpegmatch(p_special,name)
if h then
+cache[name] = h
return h
end
-- simplify
local s = lpegmatch(pattern_1,name)
local h = hash[s]
if h then
+cache[name] = h
return h
end
-- simplify
local s = lpegmatch(pattern_2,name)
local h = hash[s]
if h then
+cache[name] = h
return h
end
+cache[name] = false
end
function emoji.known()
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 9e4ac8149..c539cac7e 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2017.04.27 01:00}
+\newcontextversion{2017.05.06 23: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 51e0ae893..bc713993f 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.04.27 01:00}
+\edef\contextversion{2017.05.06 23:06}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-lib.mkvi b/tex/context/base/mkiv/font-lib.mkvi
index e37da2545..d9cae503b 100644
--- a/tex/context/base/mkiv/font-lib.mkvi
+++ b/tex/context/base/mkiv/font-lib.mkvi
@@ -87,7 +87,6 @@
\registerctxluafile{font-vf} {1.001}
\registerctxluafile{font-enh}{1.001}
-%registerctxluafile{font-gds}{1.001}
\registerctxluafile{good-ini}{1.001}
\registerctxluafile{good-gen}{1.001}
\registerctxluafile{good-ctx}{1.001}
diff --git a/tex/context/base/mkiv/font-ocl.lua b/tex/context/base/mkiv/font-ocl.lua
index 5ab90084b..c166f5ce4 100644
--- a/tex/context/base/mkiv/font-ocl.lua
+++ b/tex/context/base/mkiv/font-ocl.lua
@@ -11,6 +11,7 @@ if not modules then modules = { } end modules ['font-ocl'] = {
local tostring, next, format = tostring, next, string.format
local round, max = math.round, math.round
local sortedkeys, sortedhash = table.sortedkeys, table.sortedhash
+local setmetatableindex = table.setmetatableindex
local formatters = string.formatters
local tounicode = fonts.mappings.tounicode
@@ -47,7 +48,7 @@ end
local sharedpalettes = { }
-local hash = table.setmetatableindex(function(t,k)
+local hash = setmetatableindex(function(t,k)
local v = { "special", k }
t[k] = v
return v
@@ -130,7 +131,7 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
--
local converted = resources.converted
if not converted then
- converted = table.setmetatableindex(convert)
+ converted = setmetatableindex(convert)
resources.converted = converted
end
local colorvalues = sharedpalettes[value] or converted[palettes[tonumber(value) or 1] or palettes[1]] or { }
@@ -147,7 +148,7 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
tfmdata.fonts = {
{ id = 0 }
}
- local widths = table.setmetatableindex(function(t,k)
+ local widths = setmetatableindex(function(t,k)
local v = { "right", -k }
t[k] = v
return v
@@ -155,24 +156,32 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
--
local getactualtext = otf.getactualtext
local default = colorvalues[#colorvalues]
- local endactual = nil
+ local b, e = getactualtext(tounicode(0xFFFD))
local start = { "special", "pdf:page:q" }
local stop = { "special", "pdf:raw:Q" }
+ local actualb = { "special", "pdf:page:" .. b } -- saves tables
+ local actuale = { "special", "pdf:page:" .. e } -- saves tables
+ --
+ local cache = setmetatableindex(function(t,k)
+ local v = { "char", k }
+ t[k] = v
+ return v
+ end)
--
for unicode, character in next, characters do
local description = descriptions[unicode]
if description then
local colorlist = description.colors
if colorlist then
- local b, e = getactualtext(tounicode(characters[unicode].unicode or 0xFFFD))
+ local u = description.unicode or characters[unicode].unicode
local w = character.width or 0
local s = #colorlist
- local goback = w ~= 0 and widths[w] or nil
+ local goback = w ~= 0 and widths[w] or nil -- needs checking: are widths the same
local t = {
start,
- { "special", "pdf:raw:" .. b }
+ not u and actualb or { "special", "pdf:raw:" .. getactualtext(tounicode(u)) }
}
- local n = #t
+ local n = 2
local l = nil
for i=1,s do
local entry = colorlist[i]
@@ -181,15 +190,12 @@ local function initializecolr(tfmdata,kind,value) -- hm, always value
n = n + 1 t[n] = v
l = v
end
- n = n + 1 t[n] = { "char", entry.slot }
+ n = n + 1 t[n] = cache[entry.slot]
if s > 1 and i < s and goback then
n = n + 1 t[n] = goback
end
end
- if not endactual then
- endactual = { "special", "pdf:page:" .. e } -- saves tables
- end
- n = n + 1 t[n] = endactual
+ n = n + 1 t[n] = actuale
n = n + 1 t[n] = stop
character.commands = t
end
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 4c29d05f6..977be70a6 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -2039,7 +2039,7 @@ local function readtable(tag,f,fontdata,specification,...)
end
end
-local variablefonts_supported = context and true or false
+local variablefonts_supported = (context and true) or (logs and logs.application and true) or false
local function readdata(f,offset,specification)
@@ -2100,6 +2100,8 @@ local function readdata(f,offset,specification)
else
report("user instance: %s, bad factors",instance)
end
+ else
+ report("unknown instance")
end
end
diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua
index b44f5d7bd..290a3dfe8 100644
--- a/tex/context/base/mkiv/font-ttf.lua
+++ b/tex/context/base/mkiv/font-ttf.lua
@@ -555,7 +555,7 @@ local function repackpoints(glyphs,shapes)
-- we merged them
else
local contours = shape.contours
- local nofcontours = #contours
+ local nofcontours = contours and #contours or 0
local boundingbox = glyph.boundingbox or noboundingbox
r = r + 1 result[r] = toshort(nofcontours)
r = r + 1 result[r] = toshort(boundingbox[1]) -- xmin
@@ -696,7 +696,7 @@ local function readglyph(f,nofcontours) -- read deltas here, saves space
else
x = x + readshort(f)
end
- points[i] = { x, y, bittest(flag,0x01) }
+ points[i] = { x, 0, bittest(flag,0x01) }
end
local y = 0
for i=1,nofpoints do
@@ -924,6 +924,9 @@ local function readtuplerecord(f,nofaxis)
return record
end
+-- (1) the first is a real point the rest deltas
+-- (2) points can be present more than once (multiple deltas then)
+
local function readpoints(f)
local count = readbyte(f)
if count == 0 then
@@ -937,7 +940,7 @@ local function readpoints(f)
end
local points = { }
local p = 0
- local n = 1
+ local n = 1 -- indices
while p < count do
local control = readbyte(f)
local runreader = bittest(control,0x80) and readushort or readbyte
@@ -955,22 +958,24 @@ end
local function readdeltas(f,nofpoints)
local deltas = { }
local p = 0
- local n = 0
- local z = false
+ local z = 0
while nofpoints > 0 do
local control = readbyte(f)
+if not control then
+ break
+end
local allzero = bittest(control,0x80)
- local runreader = bittest(control,0x40) and readshort or readinteger
local runlength = band(control,0x3F) + 1
if allzero then
- z = runlength
+ z = z + runlength
else
- if z then
+ local runreader = bittest(control,0x40) and readshort or readinteger
+ if z > 0 then
for i=1,z do
p = p + 1
deltas[p] = 0
end
- z = false
+ z = 0
end
for i=1,runlength do
p = p + 1
@@ -980,12 +985,12 @@ local function readdeltas(f,nofpoints)
nofpoints = nofpoints - runlength
end
-- saves space
- -- if z then
- -- for i=1,z do
- -- p = p + 1
- -- deltas[p] = 0
- -- end
- -- end
+-- if z > 0 then
+-- for i=1,z do
+-- p = p + 1
+-- deltas[p] = 0
+-- end
+-- end
if p > 0 then
-- forget about trailing zeros
return deltas
@@ -994,7 +999,42 @@ local function readdeltas(f,nofpoints)
end
end
+local function readdeltas(f,nofpoints)
+ local deltas = { }
+ local p = 0
+ while nofpoints > 0 do
+ local control = readbyte(f)
+ if control then
+ local allzero = bittest(control,0x80)
+ local runlength = band(control,0x3F) + 1
+ if allzero then
+ for i=1,runlength do
+ p = p + 1
+ deltas[p] = 0
+ end
+ else
+ local runreader = bittest(control,0x40) and readshort or readinteger
+ for i=1,runlength do
+ p = p + 1
+ deltas[p] = runreader(f)
+ end
+ end
+ nofpoints = nofpoints - runlength
+ else
+ -- it happens
+ break
+ end
+ end
+ -- saves space
+ if p > 0 then
+ return deltas
+ else
+ -- forget about all zeros
+ end
+end
+
function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
+ -- this is one of the messiest tables
local instance = specification.instance
if not instance then
return
@@ -1008,7 +1048,7 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
local version = readulong(f) -- 1.0
local nofaxis = readushort(f)
local noftuples = readushort(f)
- local tupleoffset = readulong(f) -- shared
+ local tupleoffset = tableoffset + readulong(f)
local nofglyphs = readushort(f)
local flags = readushort(f)
local dataoffset = tableoffset + readulong(f)
@@ -1027,89 +1067,89 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
end
end
--
- setposition(f,tableoffset+tupleoffset)
- for i=1,noftuples do
- tuples[i] = readtuplerecord(f,nofaxis) -- used ?
+ if noftuples > 0 then
+ setposition(f,tupleoffset)
+ for i=1,noftuples do
+ tuples[i] = readtuplerecord(f,nofaxis)
+ end
end
local lastoffset = false
for i=1,nofglyphs do -- hm one more cf spec
- local shape = shapedata[i-1] -- todo 0
- if shape then
- local startoffset = dataoffset + data[i]
- if startoffset == lastoffset then
- -- in the font that i used for testing there were the same offsets so
- -- we can assume that this indicates a zero entry
+ local startoffset = dataoffset + data[i]
+ if startoffset == lastoffset then
+ -- no deltas
+ else
+ local shape = shapedata[i-1] -- todo 0
+ if not shape then
+ -- no shape
else
- -- todo: args_are_xy_values mess .. i have to be really bored
- -- and motivated to deal with it
-
lastoffset = startoffset
setposition(f,startoffset)
local flags = readushort(f)
local count = band(flags,0x0FFF)
- local points = bittest(flags,0x8000)
local offset = startoffset + readushort(f) -- to serialized
local deltas = { }
- local nofpoints = 0
- local allpoints = (shape.nofpoints or 0) + 1
- if points then
+ local allpoints = (shape.nofpoints or 0) -- + 1
+ local shared = false
+ local nofshared = 0
+ if bittest(flags,0x8000) then -- has shared points
-- go to the packed stream (get them once)
local current = getposition(f)
setposition(f,offset)
- points, nofpoints = readpoints(f)
+ shared, nofshared = readpoints(f)
offset = getposition(f)
setposition(f,current)
-- and back to the table
- else
- points, nofpoints = nil, 0
end
- for i=1,count do
- local currentstart = getposition(f)
+ for j=1,count do
local size = readushort(f) -- check
local flags = readushort(f)
local index = band(flags,0x0FFF)
local haspeak = bittest(flags,0x8000)
local intermediate = bittest(flags,0x4000)
- local private = bittest(flags,0x1000)
+ local private = bittest(flags,0x2000)
local peak = nil
local start = nil
local stop = nil
local xvalues = nil
local yvalues = nil
- local points = points -- we default to shared
- local nofpoints = nofpoints -- we default to shared
- local advance = 4
- if peak then
+ local points = shared -- we default to shared
+ local nofpoints = nofshared -- we default to shared
+ -- local advance = 4
+ if haspeak then
peak = readtuplerecord(f,nofaxis)
- advance = advance + 2*nofaxis
+ -- advance = advance + 2*nofaxis
else
if index+1 > #tuples then
print("error, bad index",index)
end
peak = tuples[index+1] -- hm, needs checking, only peak?
end
--- what start otherwise ?
if intermediate then
start = readtuplerecord(f,nofaxis)
stop = readtuplerecord(f,nofaxis)
- advance = advance + 4*nofaxis
+ -- advance = advance + 4*nofaxis
end
-- get the deltas
if size > 0 then
+ local current = getposition(f)
-- goto the packed stream
setposition(f,offset)
if private then
points, nofpoints = readpoints(f)
- elseif nofpoints == 0 then
- nofpoints = allpoints
+ end -- else
+ if nofpoints == 0 then
+ nofpoints = allpoints + 4
end
if nofpoints > 0 then
+ -- a nice test is to do only one
xvalues = readdeltas(f,nofpoints)
yvalues = readdeltas(f,nofpoints)
end
- offset = getposition(f)
+ -- resync offset
+ offset = offset + size
-- back to the table
- setposition(f,currentstart+advance)
+ setposition(f,current)
end
if not xvalues and not yvalues then
points = nil
@@ -1117,9 +1157,11 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
local s = 1
for i=1,nofaxis do
local f = factors[i]
- local start = start and start[i] or 0
local peak = peak and peak [i] or 0
- local stop = stop and stop [i] or 0
+ -- local start = start and start[i] or 0
+ -- local stop = stop and stop [i] or 0
+ local start = start and start[i] or (peak < 0 and peak or 0)
+ local stop = stop and stop [i] or (peak > 0 and peak or 0)
-- do we really need these tests ... can't we assume sane values
if start > peak or peak > stop then
-- * 1
@@ -1150,8 +1192,24 @@ function readers.gvar(f,fontdata,specification,glyphdata,shapedata)
end
end
if shape.type == "glyph" then
+-- if fontdata.glyphs[i-1].name == "X" then
+-- if deltas then
+-- for i=1,#deltas do
+-- local d = deltas[i]
+-- local x = d.xvalues
+-- local y = d.yvalues
+-- if x and y then
+-- for i=1,#x do
+-- print(i-1,x[i],y[i])
+-- end
+-- end
+-- end
+-- end
+-- end
applyaxis(glyphdata[i],shape,shape.points,deltas)
else
+ -- todo: args_are_xy_values mess .. i have to be really bored
+ -- and motivated to deal with it
shape.deltas = deltas
end
end
diff --git a/tex/context/base/mkiv/m-oldotf.mkiv b/tex/context/base/mkiv/m-oldotf.mkiv
index 313f9f484..f860df712 100644
--- a/tex/context/base/mkiv/m-oldotf.mkiv
+++ b/tex/context/base/mkiv/m-oldotf.mkiv
@@ -28,7 +28,6 @@
"font-one",
"font-map",
"font-fbk",
- "font-gds",
}
local report = logs.reporter("oldotf")
local findfile = resolvers.findfile
diff --git a/tex/context/base/mkiv/spac-grd.mkiv b/tex/context/base/mkiv/spac-grd.mkiv
index 4864cd646..899b6e890 100644
--- a/tex/context/base/mkiv/spac-grd.mkiv
+++ b/tex/context/base/mkiv/spac-grd.mkiv
@@ -314,14 +314,14 @@
\fi
\endgroup}
-\unexpanded\def\spac_fake_next_line_old
- {\par
- \begingroup
- \reseteverypar
- \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}% just a tracer
- \vskip-\parskip
- \vskip-\struttotal
- \endgroup}
+% \unexpanded\def\spac_fake_next_line_old
+% {\par
+% \begingroup
+% \reseteverypar
+% \dontleavehmode\hpack to \zeropoint{\page_sides_anchor\hss\strut}% just a tracer
+% \vskip-\parskip
+% \vskip-\struttotal
+% \endgroup}
%let\fakenextstrutline\spac_fake_next_line_old
\let\fakenextstrutline\spac_fake_next_line_new
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index c923f8a0f..0440c4cd8 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 1f3c85b74..db8b36d2f 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ