summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl/font-ots.lmt
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl/font-ots.lmt')
-rw-r--r--tex/context/base/mkxl/font-ots.lmt71
1 files changed, 55 insertions, 16 deletions
diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt
index dcafac025..f83fd8776 100644
--- a/tex/context/base/mkxl/font-ots.lmt
+++ b/tex/context/base/mkxl/font-ots.lmt
@@ -162,6 +162,8 @@ local trace_testruns = false registertracker("otf.testruns", function
local forcediscretionaries = false
local forcepairadvance = false -- for testing
+local repeatlastmultiple = context and true
+
directives.register("otf.forcediscretionaries",function(v)
forcediscretionaries = v
end)
@@ -650,11 +652,12 @@ end
local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what to do with skiphash matches here
local nofmultiples = #multiple
if nofmultiples > 0 then
+ local first = start
resetinjection(start)
setchar(start,multiple[1])
if nofmultiples > 1 then
- local sn = getnext(start)
- for k=2,nofmultiples do
+ -- local sn = getnext(start)
+ for i=2,nofmultiples do
-- untested:
--
-- while ignoremarks and marks[getchar(sn)] then
@@ -662,20 +665,56 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) -- what t
-- end
local n = copynode(start) -- ignore components
resetinjection(n)
- setchar(n,multiple[k])
+ setchar(n,multiple[i])
insertnodeafter(head,start,n)
start = n
end
- if what == true then
- -- we're ok
- elseif what > 1 then
- local m = multiple[nofmultiples]
- for i=2,what do
- local n = copynode(start) -- ignore components
- resetinjection(n)
- setchar(n,m)
- insertnodeafter(head,start,n)
- start = n
+ end
+ if what ~= true then
+ -- This is just some experimental code; we might introduce gsub_extensible
+ -- some day instead. Beware: when we have a feature that mixes alternates and
+ -- multiples we need to make sure we don't handle the alternate string values
+ -- here.
+ local kind = type(what)
+ local m, f, l
+ if kind == "string" then
+ local what, n = string.match(what,"^repeat(.-)[:=](%d+)$")
+ if what == "middle" then
+ m = tonumber(n)
+ elseif what == "first" then
+ f = tonumber(n)
+ elseif what == "last" then
+ l = tonumber(n)
+ end
+ elseif kind == "table" then
+ -- won't happen because currently we don't split these values
+ m = what.middle
+ f = what.first
+ l = what.last
+ end
+ if f or m or l then
+ if m and m > 1 and nofmultiples == 3 then
+ local middle = getnext(first)
+ for i=2,m do
+ local n = copynode(middle) -- ignore components
+ resetinjection(n)
+ insertnodeafter(head,first,n)
+ end
+ end
+ if f and f > 1 then
+ for i=2,f do
+ local n = copynode(first) -- ignore components
+ resetinjection(n)
+ insertnodeafter(head,first,n)
+ end
+ end
+ if l and l > 1 then
+ for i=2,l do
+ local n = copynode(start) -- ignore components
+ resetinjection(n)
+ insertnodeafter(head,start,n)
+ start = n
+ end
end
end
end
@@ -1085,7 +1124,7 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode,
end
return head, start, true
elseif trace_bugs then
- -- onetimemessage(currentfont,basechar,"no base anchors",report_fonts)
+ -- onetimemessage(currentfont,basechar,"no base anchors")
logwarning("%s: mark %s is not anchored to %s",pref(dataset,sequence),gref(markchar),gref(basechar))
end
elseif trace_bugs then
@@ -1152,7 +1191,7 @@ function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlm
end
elseif trace_bugs then
-- logwarning("%s: char %s is missing in font",pref(dataset,sequence),gref(basechar))
- onetimemessage(currentfont,basechar,"no base anchors",report_fonts)
+ onetimemessage(currentfont,basechar,"no base anchors")
end
elseif trace_bugs then
logwarning("%s: prev node is no char, case %i",pref(dataset,sequence),1)
@@ -1900,7 +1939,7 @@ function chainprocs.gpos_cursive(head,start,stop,dataset,sequence,currentlookup,
end
end
elseif trace_bugs then
- onetimemessage(currentfont,startchar,"no entry anchors",report_fonts)
+ onetimemessage(currentfont,startchar,"no entry anchors")
end
break
end