summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-01-23 15:40:18 +0200
committerMarius <mariausol@gmail.com>2013-01-23 15:40:18 +0200
commit2621e54b0510df700d50bfca4b1606ae6a2a569e (patch)
tree09e119320ecdd017d207319e8ecc96ed7338ae33 /tex/generic
parent8114597629901975313c670cf46e374e8052cd52 (diff)
downloadcontext-2621e54b0510df700d50bfca4b1606ae6a2a569e.tar.gz
beta 2013.01.23 14:04
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua219
1 files changed, 98 insertions, 121 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 7b2b0a282..5cb8bcf49 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 : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 01/22/13 18:33:20
+-- merge date : 01/23/13 14:04:19
do -- begin closure to overcome local limits and interference
@@ -5793,7 +5793,7 @@ local otf = fonts.handlers.otf
otf.glists = { "gsub", "gpos" }
-otf.version = 2.740 -- beware: also sync font-mis.lua
+otf.version = 2.741 -- beware: also sync font-mis.lua
otf.cache = containers.define("fonts", "otf", otf.version, true)
local fontdata = fonts.hashes.identifiers
@@ -6982,7 +6982,7 @@ actions["reorganize lookups"] = function(data,filename,raw) -- we could check fo
for i=1,#current do
current[i] = current_class[current[i]] or { }
if lookups and not lookups[i] then
- lookups[i] = false -- e.g. we can have two lookups and one replacement
+ lookups[i] = "" -- (was: false) e.g. we can have two lookups and one replacement
end
end
rule.current = t_hashed(current,t_h_cache)
@@ -8493,6 +8493,7 @@ if not modules then modules = { } end modules ['node-inj'] = {
-- that can be of help. Some optimizations can go away when we have faster machines.
local next = next
+local utfchar = utf.char
local trace_injections = false trackers.register("nodes.injections", function(v) trace_injections = v end)
@@ -8626,7 +8627,8 @@ local function trace(head)
local md = n[a_markdone]
local cb = n[a_cursbase]
local cc = n[a_curscurs]
- report_injections("char U+%05X, font=%s",n.char,n.font)
+ local char = n.char
+ report_injections("char U+%05X, font %s, glyph %s",char,n.font,utfchar(char))
if kp then
local k = kerns[kp]
if k[3] then
@@ -9585,8 +9587,7 @@ local onetimemessage = fonts.loggers.onetimemessage
otf.defaultnodealternate = "none" -- first last
--- we share some vars here, after all, we have no nested lookups and
--- less code
+-- we share some vars here, after all, we have no nested lookups and less code
local tfmdata = false
local characters = false
@@ -9814,12 +9815,12 @@ local function toligature(kind,lookupname,start,stop,char,markflag,discfound) --
return base
end
-function handlers.gsub_single(start,kind,lookupname,replacement)
+function handlers.gsub_single(head,start,kind,lookupname,replacement)
if trace_singles then
logprocess("%s: replacing %s by single %s",pref(kind,lookupname),gref(start.char),gref(replacement))
end
start.char = replacement
- return start, true
+ return head, start, true
end
local function get_alternative_glyph(start,alternatives,value)
@@ -9859,7 +9860,7 @@ local function get_alternative_glyph(start,alternatives,value)
return choice
end
-local function multiple_glyphs(start,multiple) -- marks ?
+local function multiple_glyphs(head,start,multiple) -- marks ?
local nofmultiples = #multiple
if nofmultiples > 0 then
start.char = multiple[1]
@@ -9877,16 +9878,16 @@ local function multiple_glyphs(start,multiple) -- marks ?
start = n
end
end
- return start, true
+ return head, start, true
else
if trace_multiples then
logprocess("no multiple for %s",gref(start.char))
end
- return start, false
+ return head, start, false
end
end
-function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence)
+function handlers.gsub_alternate(head,start,kind,lookupname,alternative,sequence)
local value = featurevalue == true and tfmdata.shared.features[kind] or featurevalue
local choice = get_alternative_glyph(start,alternative,value)
if choice then
@@ -9899,17 +9900,17 @@ function handlers.gsub_alternate(start,kind,lookupname,alternative,sequence)
logwarning("%s: no variant %s for %s",pref(kind,lookupname),tostring(value),gref(start.char))
end
end
- return start, true
+ return head, start, true
end
-function handlers.gsub_multiple(start,kind,lookupname,multiple)
+function handlers.gsub_multiple(head,start,kind,lookupname,multiple)
if trace_multiples then
logprocess("%s: replacing %s by multiple %s",pref(kind,lookupname),gref(start.char),gref(multiple))
end
- return multiple_glyphs(start,multiple)
+ return multiple_glyphs(head,start,multiple)
end
-function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence)
+function handlers.gsub_ligature(head,start,kind,lookupname,ligature,sequence)
local s, stop, discfound = start.next, nil, false
local startchar = start.char
if marks[startchar] then
@@ -9938,7 +9939,7 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence)
else
start = markstoligature(kind,lookupname,start,stop,lig)
end
- return start, true
+ return head, start, true
else
-- ok, goto next lookup
end
@@ -9982,13 +9983,13 @@ function handlers.gsub_ligature(start,kind,lookupname,ligature,sequence)
else
start = toligature(kind,lookupname,start,stop,lig,skipmark,discfound)
end
- return start, true
+ return head, start, true
else
-- ok, goto next lookup
end
end
end
- return start, false
+ return head, start, false
end
--[[ldx--
@@ -9996,7 +9997,7 @@ end
we need to explicitly test for basechar, baselig and basemark entries.</p>
--ldx]]--
-function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
+function handlers.gpos_mark2base(head,start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [start=mark]
@@ -10014,7 +10015,7 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
if trace_bugs then
logwarning("%s: no base for mark %s",pref(kind,lookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
end
end
@@ -10035,7 +10036,7 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%s,%s)",
pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy)
end
- return start, true
+ return head, start, true
end
end
end
@@ -10053,10 +10054,10 @@ function handlers.gpos_mark2base(start,kind,lookupname,markanchors,sequence)
elseif trace_bugs then
logwarning("%s: mark %s is no mark",pref(kind,lookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
-function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
+function handlers.gpos_mark2ligature(head,start,kind,lookupname,markanchors,sequence)
-- check chainpos variant
local markchar = start.char
if marks[markchar] then
@@ -10075,7 +10076,7 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
if trace_bugs then
logwarning("%s: no base for mark %s",pref(kind,lookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
end
end
@@ -10098,7 +10099,7 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
logprocess("%s, anchor %s, index %s, bound %s: anchoring mark %s to baselig %s at index %s => (%s,%s)",
pref(kind,lookupname),anchor,index,bound,gref(markchar),gref(basechar),index,dx,dy)
end
- return start, true
+ return head, start, true
end
end
end
@@ -10118,10 +10119,10 @@ function handlers.gpos_mark2ligature(start,kind,lookupname,markanchors,sequence)
elseif trace_bugs then
logwarning("%s: mark %s is no mark",pref(kind,lookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
-function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence)
+function handlers.gpos_mark2mark(head,start,kind,lookupname,markanchors,sequence)
local markchar = start.char
if marks[markchar] then
local base = start.prev -- [glyph] [basemark] [start=mark]
@@ -10154,7 +10155,7 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence)
logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%s,%s)",
pref(kind,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy)
end
- return start,true
+ return head, start, true
end
end
end
@@ -10173,10 +10174,10 @@ function handlers.gpos_mark2mark(start,kind,lookupname,markanchors,sequence)
elseif trace_bugs then
logwarning("%s: mark %s is no mark",pref(kind,lookupname),gref(markchar))
end
- return start,false
+ return head, start, false
end
-function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to be checked
+function handlers.gpos_cursive(head,start,kind,lookupname,exitanchors,sequence) -- to be checked
local alreadydone = cursonce and start[a_cursbase]
if not alreadydone then
local done = false
@@ -10223,30 +10224,30 @@ function handlers.gpos_cursive(start,kind,lookupname,exitanchors,sequence) -- to
end
end
end
- return start, done
+ return head, start, done
else
if trace_cursive and trace_details then
logprocess("%s, cursive %s is already done",pref(kind,lookupname),gref(start.char),alreadydone)
end
- return start, false
+ return head, start, false
end
end
-function handlers.gpos_single(start,kind,lookupname,kerns,sequence)
+function handlers.gpos_single(head,start,kind,lookupname,kerns,sequence)
local startchar = start.char
local dx, dy, w, h = setpair(start,tfmdata.parameters.factor,rlmode,sequence.flags[4],kerns,characters[startchar])
if trace_kerns then
logprocess("%s: shifting single %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),dx,dy,w,h)
end
- return start, false
+ return head, start, false
end
-function handlers.gpos_pair(start,kind,lookupname,kerns,sequence)
+function handlers.gpos_pair(head,start,kind,lookupname,kerns,sequence)
-- todo: kerns in disc nodes: pre, post, replace -> loop over disc too
-- todo: kerns in components of ligatures
local snext = start.next
if not snext then
- return start, false
+ return head, start, false
else
local prev, done = start, false
local factor = tfmdata.parameters.factor
@@ -10302,7 +10303,7 @@ function handlers.gpos_pair(start,kind,lookupname,kerns,sequence)
break
end
end
- return start, done
+ return head, start, done
end
end
@@ -10335,21 +10336,21 @@ local logwarning = report_chain
-- We could share functions but that would lead to extra function calls with many
-- arguments, redundant tests and confusing messages.
-function chainprocs.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname)
+function chainprocs.chainsub(head,start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname)
logwarning("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname))
- return start, false
+ return head, start, false
end
-function chainmores.chainsub(start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname,n)
+function chainmores.chainsub(head,start,stop,kind,chainname,currentcontext,lookuphash,lookuplist,chainlookupname,n)
logprocess("%s: a direct call to chainsub cannot happen",cref(kind,chainname,chainlookupname))
- return start, false
+ return head, start, false
end
-- The reversesub is a special case, which is why we need to store the replacements
-- in a bit weird way. There is no lookup and the replacement comes from the lookup
-- itself. It is meant mostly for dealing with Urdu.
-function chainprocs.reversesub(start,stop,kind,chainname,currentcontext,lookuphash,replacements)
+function chainprocs.reversesub(head,start,stop,kind,chainname,currentcontext,lookuphash,replacements)
local char = start.char
local replacement = replacements[char]
if replacement then
@@ -10357,9 +10358,9 @@ function chainprocs.reversesub(start,stop,kind,chainname,currentcontext,lookupha
logprocess("%s: single reverse replacement of %s by %s",cref(kind,chainname),gref(char),gref(replacement))
end
start.char = replacement
- return start, true
+ return head, start, true
else
- return start, false
+ return head, start, false
end
end
@@ -10387,10 +10388,10 @@ local function delete_till_stop(start,stop,ignoremarks) -- keeps start
repeat -- start x x m x x stop => start m
local next = start.next
if not marks[next.char] then
-local components = next.components
-if components then -- probably not needed
- flush_node_list(components)
-end
+ local components = next.components
+ if components then -- probably not needed
+ flush_node_list(components)
+ end
delete_node(start,next)
end
n = n + 1
@@ -10398,10 +10399,10 @@ end
else -- start x x x stop => start
repeat
local next = start.next
-local components = next.components
-if components then -- probably not needed
- flush_node_list(components)
-end
+ local components = next.components
+ if components then -- probably not needed
+ flush_node_list(components)
+ end
delete_node(start,next)
n = n + 1
until next == stop
@@ -10414,7 +10415,7 @@ end
match.</p>
--ldx]]--
-function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex)
+function chainprocs.gsub_single(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex)
-- todo: marks ?
local current = start
local subtables = currentlookup.subtables
@@ -10432,7 +10433,7 @@ function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuph
end
else
replacement = replacement[currentchar]
- if not replacement then
+ if not replacement or replacement == "" then
if trace_bugs then
logwarning("%s: no single for %s",cref(kind,chainname,chainlookupname,lookupname,chainindex),gref(currentchar))
end
@@ -10443,14 +10444,14 @@ function chainprocs.gsub_single(start,stop,kind,chainname,currentcontext,lookuph
current.char = replacement
end
end
- return start, true
+ return head, start, true
elseif current == stop then
break
else
current = current.next
end
end
- return start, false
+ return head, start, false
end
chainmores.gsub_single = chainprocs.gsub_single
@@ -10460,7 +10461,7 @@ chainmores.gsub_single = chainprocs.gsub_single
the match.</p>
--ldx]]--
-function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gsub_multiple(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
delete_till_stop(start,stop) -- we could pass ignoremarks as #3 ..
local startchar = start.char
local subtables = currentlookup.subtables
@@ -10472,7 +10473,7 @@ function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,looku
end
else
replacements = replacements[startchar]
- if not replacements then
+ if not replacements or replacement == "" then
if trace_bugs then
logwarning("%s: no multiple for %s",cref(kind,chainname,chainlookupname,lookupname),gref(startchar))
end
@@ -10480,17 +10481,12 @@ function chainprocs.gsub_multiple(start,stop,kind,chainname,currentcontext,looku
if trace_multiples then
logprocess("%s: replacing %s by multiple characters %s",cref(kind,chainname,chainlookupname,lookupname),gref(startchar),gref(replacements))
end
- return multiple_glyphs(start,replacements)
+ return multiple_glyphs(head,start,replacements)
end
end
- return start, false
+ return head, start, false
end
--- function chainmores.gsub_multiple(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n)
--- logprocess("%s: gsub_multiple not yet supported",cref(kind,chainname,chainlookupname))
--- return start, false
--- end
-
chainmores.gsub_multiple = chainprocs.gsub_multiple
--[[ldx--
@@ -10505,7 +10501,7 @@ chainmores.gsub_multiple = chainprocs.gsub_multiple
-- marks come last anyway
-- are there cases where we need to delete the mark
-function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gsub_alternate(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
local current = start
local subtables = currentlookup.subtables
local value = featurevalue == true and tfmdata.shared.features[kind] or featurevalue
@@ -10536,21 +10532,16 @@ function chainprocs.gsub_alternate(start,stop,kind,chainname,currentcontext,look
logwarning("%s: no alternative for %s",cref(kind,chainname,chainlookupname,lookupname),gref(currentchar))
end
end
- return start, true
+ return head, start, true
elseif current == stop then
break
else
current = current.next
end
end
- return start, false
+ return head, start, false
end
--- function chainmores.gsub_alternate(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,n)
--- logprocess("%s: gsub_alternate not yet supported",cref(kind,chainname,chainlookupname))
--- return start, false
--- end
-
chainmores.gsub_alternate = chainprocs.gsub_alternate
--[[ldx--
@@ -10559,7 +10550,7 @@ this function (move code inline and handle the marks by a separate function). We
assume rather stupid ligatures (no complex disc nodes).</p>
--ldx]]--
-function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex)
+function chainprocs.gsub_ligature(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex)
local startchar = start.char
local subtables = currentlookup.subtables
local lookupname = subtables[1]
@@ -10617,7 +10608,7 @@ function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,looku
end
end
start = toligature(kind,lookupname,start,stop,l2,currentlookup.flags[1],discfound)
- return start, true, nofreplacements
+ return head, start, true, nofreplacements
elseif trace_bugs then
if start == stop then
logwarning("%s: replacing character %s by ligature fails",cref(kind,chainname,chainlookupname,lookupname,chainindex),gref(startchar))
@@ -10627,12 +10618,12 @@ function chainprocs.gsub_ligature(start,stop,kind,chainname,currentcontext,looku
end
end
end
- return start, false, 0
+ return head, start, false, 0
end
chainmores.gsub_ligature = chainprocs.gsub_ligature
-function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gpos_mark2base(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
local markchar = start.char
if marks[markchar] then
local subtables = currentlookup.subtables
@@ -10657,7 +10648,7 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,look
if trace_bugs then
logwarning("%s: no base for mark %s",pref(kind,lookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
end
end
@@ -10675,7 +10666,7 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,look
logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%s,%s)",
cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy)
end
- return start, true
+ return head, start, true
end
end
end
@@ -10693,10 +10684,10 @@ function chainprocs.gpos_mark2base(start,stop,kind,chainname,currentcontext,look
elseif trace_bugs then
logwarning("%s: mark %s is no mark",cref(kind,chainname,chainlookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
-function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gpos_mark2ligature(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
local markchar = start.char
if marks[markchar] then
local subtables = currentlookup.subtables
@@ -10721,7 +10712,7 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,
if trace_bugs then
logwarning("%s: no base for mark %s",cref(kind,chainname,chainlookupname,lookupname),markchar)
end
- return start, false
+ return head, start, false
end
end
end
@@ -10743,7 +10734,7 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,
logprocess("%s, anchor %s, bound %s: anchoring mark %s to baselig %s at index %s => (%s,%s)",
cref(kind,chainname,chainlookupname,lookupname),anchor,a or bound,gref(markchar),gref(basechar),index,dx,dy)
end
- return start, true
+ return head, start, true
end
end
end
@@ -10762,10 +10753,10 @@ function chainprocs.gpos_mark2ligature(start,stop,kind,chainname,currentcontext,
elseif trace_bugs then
logwarning("%s: mark %s is no mark",cref(kind,chainname,chainlookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
-function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gpos_mark2mark(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
local markchar = start.char
if marks[markchar] then
--~ local alreadydone = markonce and start[a_markmark]
@@ -10806,7 +10797,7 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,look
logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%s,%s)",
cref(kind,chainname,chainlookupname,lookupname),anchor,bound,gref(markchar),gref(basechar),dx,dy)
end
- return start, true
+ return head, start, true
end
end
end
@@ -10827,12 +10818,10 @@ function chainprocs.gpos_mark2mark(start,stop,kind,chainname,currentcontext,look
elseif trace_bugs then
logwarning("%s: mark %s is no mark",cref(kind,chainname,chainlookupname),gref(markchar))
end
- return start, false
+ return head, start, false
end
--- ! ! ! untested ! ! !
-
-function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
+function chainprocs.gpos_cursive(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname)
local alreadydone = cursonce and start[a_cursbase]
if not alreadydone then
local startchar = start.char
@@ -10886,18 +10875,18 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,lookup
end
end
end
- return start, done
+ return head, start, done
else
if trace_cursive and trace_details then
logprocess("%s, cursive %s is already done",pref(kind,lookupname),gref(start.char),alreadydone)
end
- return start, false
+ return head, start, false
end
end
- return start, false
+ return head, start, false
end
-function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence)
+function chainprocs.gpos_single(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence)
-- untested .. needs checking for the new model
local startchar = start.char
local subtables = currentlookup.subtables
@@ -10912,12 +10901,12 @@ function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,lookuph
end
end
end
- return start, false
+ return head, start, false
end
-- when machines become faster i will make a shared function
-function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence)
+function chainprocs.gpos_pair(head,start,stop,kind,chainname,currentcontext,lookuphash,currentlookup,chainlookupname,chainindex,sequence)
-- logwarning("%s: gpos_pair not yet supported",cref(kind,chainname,chainlookupname))
local snext = start.next
if snext then
@@ -10981,11 +10970,11 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,lookuphas
break
end
end
- return start, done
+ return head, start, done
end
end
end
- return start, false
+ return head, start, false
end
-- what pointer to return, spec says stop
@@ -11004,7 +10993,7 @@ local function show_skip(kind,chainname,char,ck,class)
end
end
-local function normal_handle_contextchain(start,kind,chainname,contexts,sequence,lookuphash)
+local function normal_handle_contextchain(head,start,kind,chainname,contexts,sequence,lookuphash)
-- local rule, lookuptype, sequence, f, l, lookups = ck[1], ck[2] ,ck[3], ck[4], ck[5], ck[6]
local flags = sequence.flags
local done = false
@@ -11230,7 +11219,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if chainlookup then
local cp = chainprocs[chainlookup.type]
if cp then
- start, done = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,nil,sequence)
+ head, start, done = cp(head,start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,nil,sequence)
else
logprocess("%s: %s is not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type)
end
@@ -11261,7 +11250,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
local cp = chainlookup and chainmores[chainlookup.type]
if cp then
local ok, n
- start, ok, n = cp(start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,i,sequence)
+ head, start, ok, n = cp(head,start,last,kind,chainname,ck,lookuphash,chainlookup,chainlookupname,i,sequence)
-- messy since last can be changed !
if ok then
done = true
@@ -11281,7 +11270,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
else
local replacements = ck[7]
if replacements then
- start, done = chainprocs.reversesub(start,last,kind,chainname,ck,lookuphash,replacements) -- sequence
+ head, start, done = chainprocs.reversesub(head,start,last,kind,chainname,ck,lookuphash,replacements) -- sequence
else
done = true -- can be meant to be skipped
if trace_contexts then
@@ -11291,7 +11280,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
end
end
end
- return start, done
+ return head, start, done
end
-- Because we want to keep this elsewhere (an because speed is less an issue) we
@@ -11304,7 +11293,7 @@ local verbose_handle_contextchain = function(font,...)
end
otf.chainhandlers = {
- normal = normal_handle_contextchain,
+ normal = normal_handle_contextchain,
verbose = verbose_handle_contextchain,
}
@@ -11511,12 +11500,8 @@ local function featuresprocessor(head,font,attr)
if lookupcache then
local lookupmatch = lookupcache[start.char]
if lookupmatch then
- local headnode = start == head
- start, success = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
+ head, start, success = handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
if success then
- if headnode then
- head = start
- end
break
end
end
@@ -11560,14 +11545,10 @@ local function featuresprocessor(head,font,attr)
local lookupmatch = lookupcache[start.char]
if lookupmatch then
-- sequence kan weg
- local headnode = start == head
local ok
- start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1)
+ head, start, ok = handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,1)
if ok then
success = true
- if headnode then
- head = start
- end
end
end
if start then start = start.next end
@@ -11637,14 +11618,10 @@ local function featuresprocessor(head,font,attr)
local lookupmatch = lookupcache[start.char]
if lookupmatch then
-- we could move all code inline but that makes things even more unreadable
- local headnode = start == head
local ok
- start, ok = handler(start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
+ head, start, ok = handler(head,start,dataset[4],lookupname,lookupmatch,sequence,lookuphash,i)
if ok then
success = true
- if headnode then
- head = start
- end
break
end
end
@@ -11971,7 +11948,7 @@ registerotffeature {
}
}
--- this will change but is needed for an experiment:
+-- This can be used for extra handlers, but should be used with care!
otf.handlers = handlers