summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-08-03 11:46:01 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-08-03 11:46:01 +0200
commitab253433729006addd4336870face2facce5f894 (patch)
tree2118e77b8acf88b9bd05724bd130d4b06bfb913d /tex/context/base
parentfe1ea06fcb9c42c23beaf4211ae3b0a2de60895e (diff)
downloadcontext-ab253433729006addd4336870face2facce5f894.tar.gz
2017-08-03 11:08: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/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-dsp.lua2
-rw-r--r--tex/context/base/mkiv/font-ots.lua328
-rw-r--r--tex/context/base/mkiv/font-oup.lua47
-rw-r--r--tex/context/base/mkiv/node-nut.lua4
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin25786 -> 25796 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin426318 -> 426318 bytes
10 files changed, 84 insertions, 305 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index ba0e30220..422431de5 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.08.02 23:00}
+\newcontextversion{2017.08.03 11:02}
%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 1658e1e7d..d17fff45a 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.08.02 23:00}
+\edef\contextversion{2017.08.03 11:02}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 392f1e1fe..ea19bb659 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.08.02 23:00}
+\newcontextversion{2017.08.03 11:02}
%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 02ce376f2..a1cc5c7b0 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -41,7 +41,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2017.08.02 23:00}
+\edef\contextversion{2017.08.03 11:02}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index 9dcff6b2e..6741add90 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -1595,7 +1595,7 @@ function gposhandlers.cursive(f,fontdata,lookupid,lookupoffset,offset,glyphs,nof
exit ~= 0 and (tableoffset + exit ) or nil,
}
end
- -- slot 1 will become hash after loading an dit must be unique because we
+ -- slot 1 will become hash after loading and it must be unique because we
-- pack the tables (packed we turn the cc-* into a zero)
local cc = (fontdata.temporary.cursivecount or 0) + 1
fontdata.temporary.cursivecount = cc
diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua
index e5641f5c5..6af5aa405 100644
--- a/tex/context/base/mkiv/font-ots.lua
+++ b/tex/context/base/mkiv/font-ots.lua
@@ -855,6 +855,13 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,step,i,in
return head, start, false
end
+-- elseif krn and step.format == "pair"
+-- and (not krn[1] or type(krn[1]) == "boolean")
+-- and (not krn[2] or type(krn[2]) == "boolean")
+-- and marks[nextchar] then --KE
+-- prev = snext --KE
+-- snext = getnext(snext) --KE
+
function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,injection)
local snext = getnext(start)
if not snext then
@@ -874,7 +881,7 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje
if marks[nextchar] and sequence.flags[1] then
prev = snext
snext = getnext(snext)
--- elseif sequence.markclass and sequence.markclass[nextchar] then -- skipsome
+-- if sequence.skipsome and sequence.skipsome[nextchar] then
-- prev = snext
-- snext = getnext(snext)
else
@@ -4050,278 +4057,6 @@ do
directives.register("otf.fastdisc",function(v) fastdisc = v end)
- -- we keep this as reference because the optimization below is sort of nasty
-
- -- function otf.featuresprocessor(head,font,attr,direction,n)
- --
- -- local sequences = sequencelists[font] -- temp hack
- --
- -- if not sequencelists then
- -- return head, false
- -- end
- --
- -- nesting = nesting + 1
- --
- -- if nesting == 1 then
- -- currentfont = font
- -- tfmdata = fontdata[font]
- -- descriptions = tfmdata.descriptions -- only needed in gref so we could pass node there instead
- -- characters = tfmdata.characters -- but this branch is not entered that often anyway
- -- local resources = tfmdata.resources
- -- marks = resources.marks
- -- classes = resources.classes
- -- threshold,
- -- factor = getthreshold(font)
- -- checkmarks = tfmdata.properties.checkmarks
- --
- -- elseif currentfont ~= font then
- --
- -- report_warning("nested call with a different font, level %s, quitting",nesting)
- -- nesting = nesting - 1
- -- return head, false
- --
- -- end
- --
- -- -- some 10% faster when no dynamics but hardly measureable on real runs .. but: it only
- -- -- works when we have no other dynamics as otherwise the zero run will be applied to the
- -- -- whole stream for which we then need to pass another variable which we won't
- --
- -- -- if attr == 0 then
- -- -- attr = false
- -- -- end
- --
- -- head = tonut(head)
- --
- -- if trace_steps then
- -- checkstep(head)
- -- end
- --
- -- local initialrl = direction == "TRT" and -1 or 0
- --
- -- local done = false
- -- local datasets = otf.dataset(tfmdata,font,attr)
- -- local dirstack = { } -- could move outside function but we can have local runs
- -- sweephead = { }
- --
- -- -- Keeping track of the headnode is needed for devanagari. (I generalized it a bit
- -- -- so that multiple cases are also covered.) We could prepend a temp node.
- --
- -- -- We don't goto the next node when a disc node is created so that we can then treat
- -- -- the pre, post and replace. It's a bit of a hack but works out ok for most cases.
- --
- -- local discs = fastdisc and n and n > 1 and setmetatableindex(function(t,k)
- -- local v = usesfont(k,font)
- -- t[k] = v
- -- return v
- -- end)
- --
- -- for s=1,#datasets do
- -- local dataset = datasets[s]
- -- ----- featurevalue = dataset[1] -- todo: pass to function instead of using a global
- -- local attribute = dataset[2]
- -- local sequence = dataset[3] -- sequences[s] -- also dataset[5]
- -- local rlparmode = initialrl
- -- local topstack = 0
- -- local typ = sequence.type
- -- local gpossing = typ == "gpos_single" or typ == "gpos_pair" -- store in dataset
- -- local handler = handlers[typ]
- -- local steps = sequence.steps
- -- local nofsteps = sequence.nofsteps
- -- if not steps then
- -- -- this permits injection, watch the different arguments
- -- local h, d, ok = handler(head,head,dataset,sequence,nil,nil,nil,0,font,attr)
- -- if ok then
- -- done = true
- -- if h then
- -- head = h
- -- end
- -- end
- -- elseif typ == "gsub_reversecontextchain" then
- -- -- This might need a check: if we have #before or #after > 0 then we might need to reverse
- -- -- the before and after lists in the loader. But first I need to see a font that uses multiple
- -- -- matches.
- -- local start = find_node_tail(head)
- -- local rlmode = 0 -- how important is this .. do we need to check for dir?
- -- while start do
- -- local char = ischar(start,font)
- -- if char then
- -- local a -- happens often so no assignment is faster
- -- if attr then
- -- a = getattr(start,0)
- -- end
- -- if not a or (a == attr) then
- -- for i=1,nofsteps do
- -- local step = steps[i]
- -- local lookupcache = step.coverage
- -- local lookupmatch = lookupcache[char]
- -- if lookupmatch then
- -- -- todo: disc?
- -- local ok
- -- head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i)
- -- if ok then
- -- done = true
- -- break
- -- end
- -- end
- -- end
- -- if start then
- -- start = getprev(start)
- -- end
- -- else
- -- start = getprev(start)
- -- end
- -- else
- -- start = getprev(start)
- -- end
- -- end
- -- else
- -- local start = head
- -- local rlmode = initialrl
- -- if nofsteps == 1 then -- happens often
- -- local step = steps[1]
- -- local lookupcache = step.coverage
- -- while start do
- -- local char, id = ischar(start,font)
- -- if char then
- -- local a -- happens often so no assignment is faster
- -- if attr then
- -- if getattr(start,0) == attr and (not attribute or getprop(start,a_state) == attribute) then
- -- a = true
- -- end
- -- elseif not attribute or getprop(start,a_state) == attribute then
- -- a = true
- -- end
- -- if a then
- -- local lookupmatch = lookupcache[char]
- -- if lookupmatch then
- -- local ok
- -- head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,1)
- -- if ok then
- -- done = true
- -- end
- -- end
- -- if start then
- -- start = getnext(start)
- -- end
- -- else
- -- start = getnext(start)
- -- end
- -- elseif char == false then
- -- -- whatever glyph
- -- start = getnext(start)
- -- elseif id == glue_code then
- -- -- happens often
- -- start = getnext(start)
- -- elseif id == disc_code then
- -- if not discs or discs[start] == true then
- -- local ok
- -- if gpossing then
- -- start, ok = kernrun(start,k_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,handler)
- -- elseif typ == "gsub_ligature" then
- -- start, ok = testrun(start,t_run_single,c_run_single,font,attr,lookupcache,step,dataset,sequence,rlmode,handler)
- -- else
- -- start, ok = comprun(start,c_run_single, font,attr,lookupcache,step,dataset,sequence,rlmode,handler)
- -- end
- -- if ok then
- -- done = true
- -- end
- -- else
- -- start = getnext(start)
- -- end
- -- elseif id == math_code then
- -- start = getnext(end_of_math(start))
- -- elseif id == dir_code then
- -- start, topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
- -- elseif id == localpar_code then
- -- start, rlparmode, rlmode = pardirstate(start)
- -- else
- -- start = getnext(start)
- -- end
- -- end
- --
- -- else
- -- while start do
- -- local char, id = ischar(start,font)
- -- if char then
- -- local a -- happens often so no assignment is faster
- -- if attr then
- -- if getattr(start,0) == attr and (not attribute or getprop(start,a_state) == attribute) then
- -- a = true
- -- end
- -- elseif not attribute or getprop(start,a_state) == attribute then
- -- a = true
- -- end
- -- if a then
- -- for i=1,nofsteps do
- -- local step = steps[i]
- -- local lookupcache = step.coverage
- -- local lookupmatch = lookupcache[char]
- -- if lookupmatch then
- -- -- we could move all code inline but that makes things even more unreadable
- -- local ok
- -- head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i)
- -- if ok then
- -- done = true
- -- break
- -- elseif not start then
- -- -- don't ask why ... shouldn't happen
- -- break
- -- end
- -- end
- -- end
- -- if start then
- -- start = getnext(start)
- -- end
- -- else
- -- start = getnext(start)
- -- end
- -- elseif char == false then
- -- -- whatever glyph
- -- start = getnext(start)
- -- elseif id == glue_code then
- -- -- happens often
- -- start = getnext(start)
- -- elseif id == disc_code then
- -- if not discs or discs[start] == true then
- -- local ok
- -- if gpossing then
- -- start, ok = kernrun(start,k_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,handler)
- -- elseif typ == "gsub_ligature" then
- -- start, ok = testrun(start,t_run_multiple,c_run_multiple,font,attr,steps,nofsteps,dataset,sequence,rlmode,handler)
- -- else
- -- start, ok = comprun(start,c_run_multiple, font,attr,steps,nofsteps,dataset,sequence,rlmode,handler)
- -- end
- -- if ok then
- -- done = true
- -- end
- -- else
- -- start = getnext(start)
- -- end
- -- elseif id == math_code then
- -- start = getnext(end_of_math(start))
- -- elseif id == dir_code then
- -- start, topstack, rlmode = txtdirstate(start,dirstack,topstack,rlparmode)
- -- elseif id == localpar_code then
- -- start, rlparmode, rlmode = pardirstate(start)
- -- else
- -- start = getnext(start)
- -- end
- -- end
- -- end
- -- end
- --
- -- if trace_steps then -- ?
- -- registerstep(head)
- -- end
- --
- -- end
- --
- -- nesting = nesting - 1
- -- head = tonode(head)
- --
- -- return head, done
- -- end
-
-- using a merged combined hash as first test saves some 30% on ebgaramond and
-- about 15% on arabtype .. then moving the a test also saves a bit (even when
-- often a is not set at all so that one is a bit debatable
@@ -4404,7 +4139,6 @@ do
for s=1,#datasets do
local dataset = datasets[s]
- ----- featurevalue = dataset[1] -- todo: pass to function instead of using a global
local attribute = dataset[2]
local sequence = dataset[3] -- sequences[s] -- also dataset[5]
local rlparmode = initialrl
@@ -4482,7 +4216,7 @@ do
while start do
local char, id = ischar(start,font)
if char then
- if skipsome and skipsome[char] then
+ if skipsome and skipsome[char] then -- we never needed it here but let's try
start = getnext(start)
else
local lookupmatch = lookupcache[char]
@@ -4547,7 +4281,7 @@ do
if char then
local m = merged[char]
if m then
- if skipsome and skipsome[char] then
+ if skipsome and skipsome[char] then -- we never needed it here but let's try
start = getnext(start)
else
local a -- happens often so no assignment is faster
@@ -4685,27 +4419,31 @@ do
position = position + 1
local m = merged[char]
if m then
- for i=m[1],m[2] do
- local step = steps[i]
- local lookupcache = step.coverage
- local lookupmatch = lookupcache[char]
- if lookupmatch then
- local ok
- head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i)
- if ok then
- -- if matches then
- -- matches[position] = i
- -- else
- -- matches = { [position] = i }
- -- end
- break
- elseif not start then
- break
+ if skipsome and skipsome[char] then -- we never needed it here but let's try
+ start = getnext(start)
+ else
+ for i=m[1],m[2] do
+ local step = steps[i]
+ local lookupcache = step.coverage
+ local lookupmatch = lookupcache[char]
+ if lookupmatch then
+ local ok
+ head, start, ok = handler(head,start,dataset,sequence,lookupmatch,rlmode,step,i)
+ if ok then
+ -- if matches then
+ -- matches[position] = i
+ -- else
+ -- matches = { [position] = i }
+ -- end
+ break
+ elseif not start then
+ break
+ end
end
end
- end
- if start then
- start = getnext(start)
+ if start then
+ start = getnext(start)
+ end
end
else
start = getnext(start)
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 3b86cde72..dab746125 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -2145,7 +2145,7 @@ local function mergesteps_1(lookup,strict)
return nofsteps - 1
end
-local function mergesteps_2(lookup,strict) -- pairs
+local function mergesteps_2(lookup) -- pairs
-- this can be tricky as we can have a match on a mark with no marks skip flag
-- in which case with multiple steps a hit can prevent a next step while in the
-- merged case we can hit differently (a messy font then anyway)
@@ -2262,6 +2262,43 @@ local function mergesteps_4(lookup) -- ligatures
return nofsteps - 1
end
+-- so we assume only one cursive entry and exit and even then the first one seems
+-- to win anyway: no exit or entry quite the lookup match and then we take the
+-- next step; this means that we can as well merge them
+
+local function mergesteps_5(lookup) -- cursive
+ local steps = lookup.steps
+ local nofsteps = lookup.nofsteps
+ local first = steps[1]
+ report("merging %a steps of %a lookup %a",nofsteps,lookup.type,lookup.name)
+ local target = first.coverage
+ local hash = nil
+ for k, v in next, target do
+ hash = v[1]
+ break
+ end
+ for i=2,nofsteps do
+ for k, v in next, steps[i].coverage do
+ local tk = target[k]
+ if tk then
+ if not tk[2] then
+ tk[2] = v[2]
+ end
+ if not tk[3] then
+ tk[3] = v[3]
+ end
+ else
+ target[k] = v
+ v[1] = hash
+ end
+ end
+ end
+ lookup.nofsteps = 1
+ lookup.merged = true
+ lookup.steps = { first }
+ return nofsteps - 1
+end
+
local function checkkerns(lookup)
local steps = lookup.steps
local nofsteps = lookup.nofsteps
@@ -2432,14 +2469,14 @@ function readers.compact(data)
end
elseif kind == "gpos_pair" then
if merge_pairs then
- merged = merged + mergesteps_2(lookup,true)
+ merged = merged + mergesteps_2(lookup)
end
if compact_pairs then
kerned = kerned + checkpairs(lookup)
end
elseif kind == "gpos_cursive" then
if merge_cursives then
- merged = merged + mergesteps_2(lookup)
+ merged = merged + mergesteps_5(lookup)
end
elseif kind == "gpos_mark2mark" or kind == "gpos_mark2base" or kind == "gpos_mark2ligature" then
if merge_marks then
@@ -2513,7 +2550,11 @@ local function checkflags(sequence,resources)
t[k] = v or false
return v
end)
+ else
+ sequence.skipsome = false
end
+ else
+ sequence.skipsome = false
end
end
end
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 651717c68..cbfd43f14 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -956,13 +956,13 @@ if LUATEXFUNCTIONALITY < 6384 then
return
getfield(n,"glue_set"),
getfield(n,"glue_order"),
- getfield(h,"glue_sign")
+ getfield(n,"glue_sign")
end
function nuts.setboxglue(n,glue_set,glue_order,glue_sign)
setfield(n,"glue_set", glue_set or 0)
setfield(n,"glue_order",glue_order or 0)
- setfield(h,"glue_sign", glue_sign or 0)
+ setfield(n,"glue_sign", glue_sign or 0)
end
end
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 68c55f340..0e42f2f01 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 033f44b3d..7545fe7af 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ