From c6715fb7e284831f7172cbac1df945f63c0abbed Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Fri, 28 Jul 2017 23:04:36 +0200 Subject: 2017-07-28 22:56:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 845153 -> 845153 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 843045 -> 843045 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 848082 -> 848083 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 841724 -> 841724 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 843463 -> 843463 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 840156 -> 840158 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 840226 -> 840226 bytes scripts/context/lua/mtx-fonts.lua | 2 +- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/font-dsp.lua | 21 +- tex/context/base/mkiv/font-mis.lua | 2 +- tex/context/base/mkiv/font-otc.lua | 8 +- tex/context/base/mkiv/font-otj.lua | 148 ++++++---- tex/context/base/mkiv/font-otl.lua | 2 +- tex/context/base/mkiv/font-oto.lua | 5 +- tex/context/base/mkiv/font-ots.lua | 159 +++++----- tex/context/base/mkiv/font-oup.lua | 74 +++-- tex/context/base/mkiv/status-files.pdf | Bin 25737 -> 25743 bytes tex/context/base/mkiv/status-lua.pdf | Bin 426329 -> 426318 bytes tex/context/interface/mkiv/i-context.pdf | Bin 848082 -> 848083 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 60775 -> 60775 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 322 +++++++++++++-------- 25 files changed, 426 insertions(+), 325 deletions(-) diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 049663729..37c7a68fb 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 3f73b99d5..5da0c198c 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index d17766ff4..909024974 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index 96d700203..dad17cbcf 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 1420f239a..82212f1ca 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index dd8c3332f..7b65a0afb 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 66a2ea026..55a3ade53 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/scripts/context/lua/mtx-fonts.lua b/scripts/context/lua/mtx-fonts.lua index a24c044e3..dda3294ed 100644 --- a/scripts/context/lua/mtx-fonts.lua +++ b/scripts/context/lua/mtx-fonts.lua @@ -16,7 +16,7 @@ local lower = string.lower local concat = table.concat local write_nl = texio.write_nl -local otlversion = 3.032 +local otlversion = 3.100 local helpinfo = [[ diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 880455076..6b7505b9d 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.07.28 14:24} +\newcontextversion{2017.07.28 22:51} %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 95fcbcf12..1a3a8d816 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.07.28 14:24} +\edef\contextversion{2017.07.28 22:51} %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 d61494b97..ce26b17dc 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.07.28 14:24} +\newcontextversion{2017.07.28 22:51} %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 993294a98..03c954ab9 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.07.28 14:24} +\edef\contextversion{2017.07.28 22:51} \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 afeeacb3f..9dcff6b2e 100644 --- a/tex/context/base/mkiv/font-dsp.lua +++ b/tex/context/base/mkiv/font-dsp.lua @@ -1468,7 +1468,7 @@ function gposhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofg coverage[index] = value end return { - format = "pair", + format = "single", coverage = coverage, } elseif subtype == 2 then @@ -1484,7 +1484,7 @@ function gposhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofg coverage[index] = values[newindex+1] end return { - format = "pair", + format = "single", coverage = coverage, } else @@ -1509,7 +1509,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly local sets = readarray(f) sets = readpairsets(f,tableoffset,sets,format1,format2,mainoffset,getdelta) coverage = readcoverage(f,tableoffset + coverage) - -- local allzero = 0 for index, newindex in next, coverage do local set = sets[newindex+1] local hash = { } @@ -1519,10 +1518,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly local other = value[1] local first = value[2] local second = value[3] - -- if first == true and second == true then - -- -- upto the next lookup for this combination - -- allzero = allzero + 1 - -- end if first or second then hash[other] = { first, second or nil } -- needs checking else @@ -1532,9 +1527,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly end coverage[index] = hash end - -- if allzero > 0 then - -- report("%s allzero pairs in %a positioning lookup %a subtype %a",allzero,"pair",lookupid,subtype) - -- end return { format = "pair", coverage = coverage, @@ -1552,7 +1544,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly classdef1 = readclassdef(f,tableoffset+classdef1,coverage) classdef2 = readclassdef(f,tableoffset+classdef2,nofglyphs) local usedcoverage = { } - -- local allzero = 0 for g1, c1 in next, classdef1 do if coverage[g1] then local l1 = classlist[c1] @@ -1563,10 +1554,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly if offsets then local first = offsets[1] local second = offsets[2] - -- if first == true and second == true then - -- -- upto the next lookup for this combination - -- allzero = allzero + 1 - -- end if first or second then hash[paired] = { first, second or nil } else @@ -1578,9 +1565,6 @@ function gposhandlers.pair(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofgly end end end - -- if allzero > 0 then - -- report("%s allzero pairs in %a positioning lookup %a subtype %a",allzero,"pair",lookupid,subtype) - -- end return { format = "pair", coverage = usedcoverage, @@ -2498,7 +2482,6 @@ do }, nofsteps = 1, type = "gpos_pair", - -- type = "gpos_single", -- maybe better flags = { false, false, false, false }, order = { name }, features = { [name] = feature }, diff --git a/tex/context/base/mkiv/font-mis.lua b/tex/context/base/mkiv/font-mis.lua index 3325264fc..401abbffa 100644 --- a/tex/context/base/mkiv/font-mis.lua +++ b/tex/context/base/mkiv/font-mis.lua @@ -21,7 +21,7 @@ local readers = otf.readers if readers then - otf.version = otf.version or 3.032 + otf.version = otf.version or 3.100 otf.cache = otf.cache or containers.define("fonts", "otl", otf.version, true) function fonts.helpers.getfeatures(name,save) diff --git a/tex/context/base/mkiv/font-otc.lua b/tex/context/base/mkiv/font-otc.lua index 4cc352669..97a7ad72b 100644 --- a/tex/context/base/mkiv/font-otc.lua +++ b/tex/context/base/mkiv/font-otc.lua @@ -626,8 +626,8 @@ local function addfeature(data,feature,specifications) coverage = prepare_alternate(list,featuretype,nocheck) elseif featuretype == "multiple" then coverage = prepare_multiple(list,featuretype,nocheck) - elseif featuretype == "kern" then - format = "kern" + elseif featuretype == "kern" or featuretype == "move" then + format = featuretype coverage = prepare_kern(list,featuretype) elseif featuretype == "pair" then format = "pair" @@ -669,9 +669,9 @@ local function addfeature(data,feature,specifications) elseif featuretype == "multiple" then category = "gsub" coverage = prepare_multiple(list,featuretype,nocheck) - elseif featuretype == "kern" then + elseif featuretype == "kern" or featuretype == "move" then category = "gpos" - format = "kern" + format = featuretype coverage = prepare_kern(list,featuretype) elseif featuretype == "pair" then category = "gpos" diff --git a/tex/context/base/mkiv/font-otj.lua b/tex/context/base/mkiv/font-otj.lua index a6e60a3f5..e11fbd4bd 100644 --- a/tex/context/base/mkiv/font-otj.lua +++ b/tex/context/base/mkiv/font-otj.lua @@ -112,55 +112,26 @@ end end function injections.installnewkern() end -- obsolete -local nofregisteredkerns = 0 -local nofregisteredpairs = 0 -local nofregisteredmarks = 0 -local nofregisteredcursives = 0 -local keepregisteredcounts = false +local nofregisteredkerns = 0 +local nofregisteredpositions = 0 +local nofregisteredmarks = 0 +local nofregisteredcursives = 0 +local keepregisteredcounts = false function injections.keepcounts() keepregisteredcounts = true end function injections.resetcounts() - nofregisteredkerns = 0 - nofregisteredpairs = 0 - nofregisteredmarks = 0 - nofregisteredcursives = 0 - keepregisteredcounts = false + nofregisteredkerns = 0 + nofregisteredpositions = 0 + nofregisteredmarks = 0 + nofregisteredcursives = 0 + keepregisteredcounts = false end -- We need to make sure that a possible metatable will not kick in unexpectedly. --- function injections.reset(n) --- local p = rawget(properties,n) --- if p and rawget(p,"injections") then --- p.injections = nil --- end --- end - --- function injections.copy(target,source) --- local sp = rawget(properties,source) --- if sp then --- local tp = rawget(properties,target) --- local si = rawget(sp,"injections") --- if si then --- si = fastcopy(si) --- if tp then --- tp.injections = si --- else --- properties[target] = { --- injections = si, --- } --- end --- else --- if tp then --- tp.injections = nil --- end --- end --- end --- end - function injections.reset(n) local p = rawget(properties,n) if p then @@ -291,7 +262,7 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne return dx, dy, nofregisteredcursives end -function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) -- r2lflag not used +function injections.setposition(current,factor,rlmode,r2lflag,spec,injection) -- r2lflag not used local x = factor*spec[1] local y = factor*spec[2] local w = factor*spec[3] @@ -301,7 +272,7 @@ function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) -- r2l local leftkern = x -- both kerns are set in a pair kern compared local rightkern = w - x -- to normal kerns where we set only leftkern if leftkern ~= 0 or rightkern ~= 0 or yoffset ~= 0 then - nofregisteredpairs = nofregisteredpairs + 1 + nofregisteredpositions = nofregisteredpositions + 1 if rlmode and rlmode < 0 then leftkern, rightkern = rightkern, leftkern end @@ -348,15 +319,15 @@ function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) -- r2l }, } end - return x, y, w, h, nofregisteredpairs + return x, y, w, h, nofregisteredpositions end end return x, y, w, h -- no bound end --- This needs checking for rl < 0 but it is unlikely that a r2l script uses kernclasses between --- glyphs so we're probably safe (KE has a problematic font where marks interfere with rl < 0 in --- the previous case) +-- The next one is used for simple kerns coming from a truetype kern table. The r2l +-- variant variant needs checking but it is unlikely that a r2l script uses thsi +-- feature. function injections.setkern(current,factor,rlmode,x,injection) local dx = factor * x @@ -367,27 +338,78 @@ function injections.setkern(current,factor,rlmode,x,injection) injection = "injections" end if rlmode and rlmode < 0 then - -- for kai to check: this branch is new + -- was right kern but why ... we need to check this (kai) + if p then + local i = rawget(p,injection) + if i then + i.leftkern = dx + (i.leftkern or 0) + else + p[injection] = { + leftkern = dx, + } + end + else + properties[current] = { + [injection] = { + leftkern = dx, + }, + } + end + else + if p then + local i = rawget(p,injection) + if i then + i.leftkern = dx + (i.leftkern or 0) + else + p[injection] = { + leftkern = dx, + } + end + else + properties[current] = { + [injection] = { + leftkern = dx, + }, + } + end + end + return dx, nofregisteredkerns + else + return 0, 0 + end +end + +-- This one is an optimization of pairs where we have only a "w" entry. This one is +-- potentially different from the previous one wrt r2l. It needs checking. The +-- optimization relates to smaller tma files. + +function injections.setmove(current,factor,rlmode,x,injection) + local dx = factor * x + if dx ~= 0 then + nofregisteredkerns = nofregisteredkerns + 1 + local p = rawget(properties,current) + if not injection then + injection = "injections" + end + if rlmode and rlmode < 0 then if p then - -- local i = rawget(p,injection) local i = rawget(p,injection) if i then - i.rightkern = dx + (i.rightkern or 0) + i.leftkern = dx + (i.leftkern or 0) else p[injection] = { - rightkern = dx, + leftkern = dx, } end else properties[current] = { [injection] = { - rightkern = dx, + leftkern = dx, }, } end else if p then - -- local i = rawget(p,injection) local i = rawget(p,injection) if i then i.leftkern = dx + (i.leftkern or 0) @@ -524,8 +546,8 @@ end local function trace(head,where) report_injections() - report_injections("begin run %s: %s kerns, %s pairs, %s marks and %s cursives registered", - where or "",nofregisteredkerns,nofregisteredpairs,nofregisteredmarks,nofregisteredcursives) + report_injections("begin run %s: %s kerns, %s positions, %s marks and %s cursives registered", + where or "",nofregisteredkerns,nofregisteredpositions,nofregisteredmarks,nofregisteredcursives) local n = head while n do local id = getid(n) @@ -738,10 +760,10 @@ local function inject_kerns_only(head,where) return tonode(head), true end -local function inject_pairs_only(head,where) +local function inject_positions_only(head,where) head = tonut(head) if trace_injections then - trace(head,"pairs") + trace(head,"positions") end local current = head local prev = nil @@ -966,7 +988,7 @@ local function inject_pairs_only(head,where) if keepregisteredcounts then keepregisteredcounts = false else - nofregisteredpairs = 0 + nofregisteredpositions = 0 end if trace_injections then show_result(head) @@ -1431,10 +1453,10 @@ end if keepregisteredcounts then keepregisteredcounts = false else - nofregisteredkerns = 0 - nofregisteredpairs = 0 - nofregisteredmarks = 0 - nofregisteredcursives = 0 + nofregisteredkerns = 0 + nofregisteredpositions = 0 + nofregisteredmarks = 0 + nofregisteredcursives = 0 end if trace_injections then show_result(head) @@ -1625,11 +1647,11 @@ function injections.handler(head,where) report_injections("injection variant %a","everything") end return inject_everything(head,where) - elseif nofregisteredpairs > 0 then + elseif nofregisteredpositions > 0 then if trace_injections then - report_injections("injection variant %a","pairs") + report_injections("injection variant %a","positions") end - return inject_pairs_only(head,where) + return inject_positions_only(head,where) elseif nofregisteredkerns > 0 then if trace_injections then report_injections("injection variant %a","kerns") diff --git a/tex/context/base/mkiv/font-otl.lua b/tex/context/base/mkiv/font-otl.lua index 9a3bcb9a9..210611989 100644 --- a/tex/context/base/mkiv/font-otl.lua +++ b/tex/context/base/mkiv/font-otl.lua @@ -52,7 +52,7 @@ local report_otf = logs.reporter("fonts","otf loading") local fonts = fonts local otf = fonts.handlers.otf -otf.version = 3.032 -- beware: also sync font-mis.lua and in mtx-fonts +otf.version = 3.100 -- beware: also sync font-mis.lua and in mtx-fonts otf.cache = containers.define("fonts", "otl", otf.version, true) otf.svgcache = containers.define("fonts", "svg", otf.version, true) otf.sbixcache = containers.define("fonts", "sbix", otf.version, true) diff --git a/tex/context/base/mkiv/font-oto.lua b/tex/context/base/mkiv/font-oto.lua index 031bab419..8faad27e1 100644 --- a/tex/context/base/mkiv/font-oto.lua +++ b/tex/context/base/mkiv/font-oto.lua @@ -338,8 +338,9 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist local format = sequence.format if kind == "gpos_pair" then for i=1,#steps do - local step = steps[i] - if step.format == "kern" then + local step = steps[i] + local format = step.format + if format == "kern" or format == "move" then for unicode, data in next, steps[i].coverage do local character = characters[unicode] local kerns = character.kerns diff --git a/tex/context/base/mkiv/font-ots.lua b/tex/context/base/mkiv/font-ots.lua index 05ad91be2..1c0a6c063 100644 --- a/tex/context/base/mkiv/font-ots.lua +++ b/tex/context/base/mkiv/font-ots.lua @@ -245,7 +245,8 @@ local injections = nodes.injections local setmark = injections.setmark local setcursive = injections.setcursive local setkern = injections.setkern -local setpair = injections.setpair +local setmove = injections.setmove +local setposition = injections.setposition local resetinjection = injections.reset local copyinjection = injections.copy local setligaindex = injections.setligaindex @@ -840,17 +841,16 @@ end function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,step,i,injection) local startchar = getchar(start) --- if step.format == "pair" then - if step.format == "pair" or type(kerns) == "table" then - local dx, dy, w, h = setpair(start,factor,rlmode,sequence.flags[4],kerns,injection) + local format = step.format + if format == "single" or type(kerns) == "table" then -- the table check can go + local dx, dy, w, h = setposition(start,factor,rlmode,sequence.flags[4],kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p)",pref(dataset,sequence),gref(startchar),dx,dy,w,h) + logprocess("%s: shifting single %s by %s xy (%p,%p) and wh (%p,%p)",pref(dataset,sequence),gref(startchar),format,dx,dy,w,h) end else - -- needs checking .. maybe no kerns format for single - local k = setkern(start,factor,rlmode,kerns,injection) + local k = (format == "move" and setmove or setkern)(start,factor,rlmode,kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by %p",pref(dataset,sequence),gref(startchar),k) + logprocess("%s: shifting single %s by %s %p",pref(dataset,sequence),gref(startchar),format,k) end end return head, start, false @@ -872,39 +872,42 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje snext = getnext(snext) elseif not krn then break - elseif step.format == "pair" then - local a, b = krn[1], krn[2] - if a == true then - -- zero - elseif a then -- #a > 0 - local x, y, w, h = setpair(start,factor,rlmode,sequence.flags[4],a,injection) - if trace_kerns then - local startchar = getchar(start) - logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + else + local format = step.format + if format == "pair" then + local a, b = krn[1], krn[2] + if a == true then + -- zero + elseif a then -- #a > 0 + local x, y, w, h = setposition(start,factor,rlmode,sequence.flags[4],a,injection) + if trace_kerns then + local startchar = getchar(start) + logprocess("%s: shifting first of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + end end - end - if b == true then - -- zero - start = snext -- cf spec - elseif b then -- #b > 0 - local x, y, w, h = setpair(snext,factor,rlmode,sequence.flags[4],b,injection) + if b == true then + -- zero + start = snext -- cf spec + elseif b then -- #b > 0 + local x, y, w, h = setposition(snext,factor,rlmode,sequence.flags[4],b,injection) + if trace_kerns then + local startchar = getchar(snext) + logprocess("%s: shifting second of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + end + start = snext -- cf spec + elseif forcepairadvance then + start = snext -- for testing, not cf spec + end + return head, start, true + elseif krn ~= 0 then + local k = (format == "move" and setmove or setkern)(snext,factor,rlmode,krn,injection) if trace_kerns then - local startchar = getchar(snext) - logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + logprocess("%s: inserting %s %p between %s and %s as %s",pref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar),injection or "injections") end - start = snext -- cf spec - elseif forcepairadvance then - start = snext -- for testing, not cf spec - end - return head, start, true - elseif krn ~= 0 then - local k = setkern(snext,factor,rlmode,krn,injection) - if trace_kerns then - logprocess("%s: inserting kern %p between %s and %s as %s",pref(dataset,sequence),k,gref(getchar(prev)),gref(nextchar),injection or "injections") + return head, start, true + else -- can't happen + break end - return head, start, true - else -- can't happen - break end else break @@ -1428,15 +1431,18 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r local kerns = step.coverage[startchar] if not kerns then -- skip - elseif step.format == "pair" then - local dx, dy, w, h = setpair(start,factor,rlmode,sequence.flags[4],kerns) -- currentlookup.flags ? - if trace_kerns then - logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),dx,dy,w,h) - end - else -- needs checking .. maybe no kerns format for single - local k = setkern(start,factor,rlmode,kerns,injection) - if trace_kerns then - logprocess("%s: shifting single %s by %p",cref(dataset,sequence),gref(startchar),k) + else + local format = step.format + if format == "single" then + local dx, dy, w, h = setposition(start,factor,rlmode,sequence.flags[4],kerns) -- currentlookup.flags ? + if trace_kerns then + logprocess("%s: shifting single %s by %s (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),format,dx,dy,w,h) + end + else -- needs checking .. maybe no kerns format for single + local k = (format == "move" and setmove or setkern)(start,factor,rlmode,kerns,injection) + if trace_kerns then + logprocess("%s: shifting single %s by %s %p",cref(dataset,sequence),gref(startchar),format,k) + end end end end @@ -1470,39 +1476,42 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm snext = getnext(snext) elseif not krn then break - elseif step.format == "pair" then - local a, b = krn[1], krn[2] - if a == true then - -- zero - elseif a then - local x, y, w, h = setpair(start,factor,rlmode,sequence.flags[4],a,"injections") -- currentlookups flags? - if trace_kerns then - local startchar = getchar(start) - logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + else + local format = step.format + if format == "pair" then + local a, b = krn[1], krn[2] + if a == true then + -- zero + elseif a then + local x, y, w, h = setposition(start,factor,rlmode,sequence.flags[4],a,"injections") -- currentlookups flags? + if trace_kerns then + local startchar = getchar(start) + logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + end end - end - if b == true then - -- zero - start = snext -- cf spec - elseif b then -- #b > 0 - local x, y, w, h = setpair(snext,factor,rlmode,sequence.flags[4],b,"injections") + if b == true then + -- zero + start = snext -- cf spec + elseif b then -- #b > 0 + local x, y, w, h = setposition(snext,factor,rlmode,sequence.flags[4],b,"injections") + if trace_kerns then + local startchar = getchar(start) + logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + end + start = snext -- cf spec + elseif forcepairadvance then + start = snext -- for testing, not cf spec + end + return head, start, true + elseif krn ~= 0 then + local k = (format == "move" and setmove or setkern)(snext,factor,rlmode,krn) if trace_kerns then - local startchar = getchar(start) - logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + logprocess("%s: inserting %s %p between %s and %s",cref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar)) end - start = snext -- cf spec - elseif forcepairadvance then - start = snext -- for testing, not cf spec - end - return head, start, true - elseif krn ~= 0 then - local k = setkern(snext,factor,rlmode,krn) - if trace_kerns then - logprocess("%s: inserting kern %s between %s and %s",cref(dataset,sequence),k,gref(getchar(prev)),gref(nextchar)) + return head, start, true + else + break end - return head, start, true - else - break end end end diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua index 5ad7c1c6f..5cc6a17dc 100644 --- a/tex/context/base/mkiv/font-oup.lua +++ b/tex/context/base/mkiv/font-oup.lua @@ -1356,30 +1356,30 @@ function readers.pack(data) if kind == "gpos_pair" then local c = step.coverage if c then - if step.format == "kern" then - for g1, d1 in next, c do - c[g1] = pack_normal(d1) - end - else + if step.format == "pair" then for g1, d1 in next, c do for g2, d2 in next, d1 do local f = d2[1] if f and f ~= true then d2[1] = pack_indexed(f) end local s = d2[2] if s and s ~= true then d2[2] = pack_indexed(s) end end end + else + for g1, d1 in next, c do + c[g1] = pack_normal(d1) + end end end elseif kind == "gpos_single" then local c = step.coverage if c then - if step.format == "kern" then - step.coverage = pack_normal(c) - else + if step.format == "single" then for g1, d1 in next, c do if d1 and d1 ~= true then c[g1] = pack_indexed(d1) end end + else + step.coverage = pack_normal(c) end end elseif kind == "gpos_cursive" then @@ -1562,7 +1562,7 @@ function readers.pack(data) if kind == "gpos_pair" then local c = step.coverage if c then - if step.format ~= "kern" then + if step.format == "pair" then for g1, d1 in next, c do for g2, d2 in next, d1 do d1[g2] = pack_normal(d2) @@ -1647,7 +1647,7 @@ function readers.pack(data) if kind == "gpos_pair" then local c = step.coverage if c then - if step.format ~= "kern" then + if step.format == "pair" then for g1, d1 in next, c do c[g1] = pack_normal(d1) end @@ -1776,14 +1776,7 @@ function readers.unpack(data) if kind == "gpos_pair" then local c = step.coverage if c then - if step.format == "kern" then - for g1, d1 in next, c do - local tv = tables[d1] - if tv then - c[g1] = tv - end - end - else + if step.format == "pair" then for g1, d1 in next, c do local tv = tables[d1] if tv then @@ -1800,23 +1793,30 @@ function readers.unpack(data) local s = tables[d2[2]] if s then d2[2] = s end end end + else + for g1, d1 in next, c do + local tv = tables[d1] + if tv then + c[g1] = tv + end + end end end elseif kind == "gpos_single" then local c = step.coverage if c then - if step.format == "kern" then - local tv = tables[c] - if tv then - step.coverage = tv - end - else + if step.format == "single" then for g1, d1 in next, c do local tv = tables[d1] if tv then c[g1] = tv end end + else + local tv = tables[c] + if tv then + step.coverage = tv + end end end elseif kind == "gpos_cursive" then @@ -2286,7 +2286,7 @@ local function checkkerns(lookup) end end step.coverage = c - step.format = "kern" + step.format = "move" kerned = kerned + 1 end end @@ -2351,7 +2351,7 @@ local function checkpairs(lookup) end coverage[g1] = d end - step.format = "kern" + step.format = "move" kerned = kerned + 1 end end @@ -2359,6 +2359,12 @@ local function checkpairs(lookup) return kerned end +local compact_pairs = true +local compact_singles = true + +directives.register("otf.compact.pairs", function(v) compact_pairs = v end) +directives.register("otf.compact.singles", function(v) compact_singles = v end) + function readers.compact(data) if not data or data.compacted then return @@ -2385,10 +2391,14 @@ function readers.compact(data) merged = merged + mergesteps_4(lookup) elseif kind == "gpos_single" then merged = merged + mergesteps_1(lookup,true) - kerned = kerned + checkkerns(lookup) + if compact_singles then + kerned = kerned + checkkerns(lookup) + end elseif kind == "gpos_pair" then merged = merged + mergesteps_2(lookup,true) - kerned = kerned + checkpairs(lookup) + if compact_pairs then + kerned = kerned + checkpairs(lookup) + end elseif kind == "gpos_cursive" then merged = merged + mergesteps_2(lookup) elseif kind == "gpos_mark2mark" or kind == "gpos_mark2base" or kind == "gpos_mark2ligature" then @@ -2399,9 +2409,13 @@ function readers.compact(data) end elseif nofsteps == 1 then if kind == "gpos_single" then - kerned = kerned + checkkerns(lookup) + if compact_singles then + kerned = kerned + checkkerns(lookup) + end elseif kind == "gpos_pair" then - kerned = kerned + checkpairs(lookup) + if compact_pairs then + kerned = kerned + checkpairs(lookup) + end end end end diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index 6f0818b2f..f0f17a95f 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index 9660f03aa..2cc639bf2 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index d17766ff4..909024974 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 793b99c47..357e1bf22 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index c7657853b..0445af9cf 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 : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 07/28/17 14:24:44 +-- merge date : 07/28/17 22:51:33 do -- begin closure to overcome local limits and interference @@ -15515,7 +15515,7 @@ function gposhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofg coverage[index]=value end return { - format="pair", + format="single", coverage=coverage, } elseif subtype==2 then @@ -15531,7 +15531,7 @@ function gposhandlers.single(f,fontdata,lookupid,lookupoffset,offset,glyphs,nofg coverage[index]=values[newindex+1] end return { - format="pair", + format="single", coverage=coverage, } else @@ -18493,30 +18493,30 @@ function readers.pack(data) if kind=="gpos_pair" then local c=step.coverage if c then - if step.format=="kern" then - for g1,d1 in next,c do - c[g1]=pack_normal(d1) - end - else + if step.format=="pair" then for g1,d1 in next,c do for g2,d2 in next,d1 do local f=d2[1] if f and f~=true then d2[1]=pack_indexed(f) end local s=d2[2] if s and s~=true then d2[2]=pack_indexed(s) end end end + else + for g1,d1 in next,c do + c[g1]=pack_normal(d1) + end end end elseif kind=="gpos_single" then local c=step.coverage if c then - if step.format=="kern" then - step.coverage=pack_normal(c) - else + if step.format=="single" then for g1,d1 in next,c do if d1 and d1~=true then c[g1]=pack_indexed(d1) end end + else + step.coverage=pack_normal(c) end end elseif kind=="gpos_cursive" then @@ -18676,7 +18676,7 @@ function readers.pack(data) if kind=="gpos_pair" then local c=step.coverage if c then - if step.format~="kern" then + if step.format=="pair" then for g1,d1 in next,c do for g2,d2 in next,d1 do d1[g2]=pack_normal(d2) @@ -18748,7 +18748,7 @@ function readers.pack(data) if kind=="gpos_pair" then local c=step.coverage if c then - if step.format~="kern" then + if step.format=="pair" then for g1,d1 in next,c do c[g1]=pack_normal(d1) end @@ -18848,14 +18848,7 @@ function readers.unpack(data) if kind=="gpos_pair" then local c=step.coverage if c then - if step.format=="kern" then - for g1,d1 in next,c do - local tv=tables[d1] - if tv then - c[g1]=tv - end - end - else + if step.format=="pair" then for g1,d1 in next,c do local tv=tables[d1] if tv then @@ -18872,23 +18865,30 @@ function readers.unpack(data) local s=tables[d2[2]] if s then d2[2]=s end end end + else + for g1,d1 in next,c do + local tv=tables[d1] + if tv then + c[g1]=tv + end + end end end elseif kind=="gpos_single" then local c=step.coverage if c then - if step.format=="kern" then - local tv=tables[c] - if tv then - step.coverage=tv - end - else + if step.format=="single" then for g1,d1 in next,c do local tv=tables[d1] if tv then c[g1]=tv end end + else + local tv=tables[c] + if tv then + step.coverage=tv + end end end elseif kind=="gpos_cursive" then @@ -19287,7 +19287,7 @@ local function checkkerns(lookup) end end step.coverage=c - step.format="kern" + step.format="move" kerned=kerned+1 end end @@ -19332,13 +19332,17 @@ local function checkpairs(lookup) end coverage[g1]=d end - step.format="kern" + step.format="move" kerned=kerned+1 end end end return kerned end +local compact_pairs=true +local compact_singles=true +directives.register("otf.compact.pairs",function(v) compact_pairs=v end) +directives.register("otf.compact.singles",function(v) compact_singles=v end) function readers.compact(data) if not data or data.compacted then return @@ -19365,10 +19369,14 @@ function readers.compact(data) merged=merged+mergesteps_4(lookup) elseif kind=="gpos_single" then merged=merged+mergesteps_1(lookup,true) - kerned=kerned+checkkerns(lookup) + if compact_singles then + kerned=kerned+checkkerns(lookup) + end elseif kind=="gpos_pair" then merged=merged+mergesteps_2(lookup,true) - kerned=kerned+checkpairs(lookup) + if compact_pairs then + kerned=kerned+checkpairs(lookup) + end elseif kind=="gpos_cursive" then merged=merged+mergesteps_2(lookup) elseif kind=="gpos_mark2mark" or kind=="gpos_mark2base" or kind=="gpos_mark2ligature" then @@ -19379,9 +19387,13 @@ function readers.compact(data) end elseif nofsteps==1 then if kind=="gpos_single" then - kerned=kerned+checkkerns(lookup) + if compact_singles then + kerned=kerned+checkkerns(lookup) + end elseif kind=="gpos_pair" then - kerned=kerned+checkpairs(lookup) + if compact_pairs then + kerned=kerned+checkpairs(lookup) + end end end end @@ -19613,7 +19625,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_de local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.032 +otf.version=3.100 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.sbixcache=containers.define("fonts","sbix",otf.version,true) @@ -20514,7 +20526,8 @@ local function preparepositionings(tfmdata,feature,value,validlookups,lookuplist if kind=="gpos_pair" then for i=1,#steps do local step=steps[i] - if step.format=="kern" then + local format=step.format + if format=="kern" or format=="move" then for unicode,data in next,steps[i].coverage do local character=characters[unicode] local kerns=character.kerns @@ -20755,7 +20768,7 @@ do if not fontkern then end end function injections.installnewkern() end local nofregisteredkerns=0 -local nofregisteredpairs=0 +local nofregisteredpositions=0 local nofregisteredmarks=0 local nofregisteredcursives=0 local keepregisteredcounts=false @@ -20764,7 +20777,7 @@ function injections.keepcounts() end function injections.resetcounts() nofregisteredkerns=0 - nofregisteredpairs=0 + nofregisteredpositions=0 nofregisteredmarks=0 nofregisteredcursives=0 keepregisteredcounts=false @@ -20887,7 +20900,7 @@ function injections.setcursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmne end return dx,dy,nofregisteredcursives end -function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) +function injections.setposition(current,factor,rlmode,r2lflag,spec,injection) local x=factor*spec[1] local y=factor*spec[2] local w=factor*spec[3] @@ -20897,7 +20910,7 @@ function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) local leftkern=x local rightkern=w-x if leftkern~=0 or rightkern~=0 or yoffset~=0 then - nofregisteredpairs=nofregisteredpairs+1 + nofregisteredpositions=nofregisteredpositions+1 if rlmode and rlmode<0 then leftkern,rightkern=rightkern,leftkern end @@ -20943,7 +20956,7 @@ function injections.setpair(current,factor,rlmode,r2lflag,spec,injection) }, } end - return x,y,w,h,nofregisteredpairs + return x,y,w,h,nofregisteredpositions end end return x,y,w,h @@ -20960,16 +20973,64 @@ function injections.setkern(current,factor,rlmode,x,injection) if p then local i=rawget(p,injection) if i then - i.rightkern=dx+(i.rightkern or 0) + i.leftkern=dx+(i.leftkern or 0) else p[injection]={ - rightkern=dx, + leftkern=dx, } end else properties[current]={ [injection]={ - rightkern=dx, + leftkern=dx, + }, + } + end + else + if p then + local i=rawget(p,injection) + if i then + i.leftkern=dx+(i.leftkern or 0) + else + p[injection]={ + leftkern=dx, + } + end + else + properties[current]={ + [injection]={ + leftkern=dx, + }, + } + end + end + return dx,nofregisteredkerns + else + return 0,0 + end +end +function injections.setmove(current,factor,rlmode,x,injection) + local dx=factor*x + if dx~=0 then + nofregisteredkerns=nofregisteredkerns+1 + local p=rawget(properties,current) + if not injection then + injection="injections" + end + if rlmode and rlmode<0 then + if p then + local i=rawget(p,injection) + if i then + i.leftkern=dx+(i.leftkern or 0) + else + p[injection]={ + leftkern=dx, + } + end + else + properties[current]={ + [injection]={ + leftkern=dx, }, } end @@ -21101,8 +21162,8 @@ local function showsub(n,what,where) end local function trace(head,where) report_injections() - report_injections("begin run %s: %s kerns, %s pairs, %s marks and %s cursives registered", - where or "",nofregisteredkerns,nofregisteredpairs,nofregisteredmarks,nofregisteredcursives) + report_injections("begin run %s: %s kerns, %s positions, %s marks and %s cursives registered", + where or "",nofregisteredkerns,nofregisteredpositions,nofregisteredmarks,nofregisteredcursives) local n=head while n do local id=getid(n) @@ -21285,10 +21346,10 @@ local function inject_kerns_only(head,where) end return tonode(head),true end -local function inject_pairs_only(head,where) +local function inject_positions_only(head,where) head=tonut(head) if trace_injections then - trace(head,"pairs") + trace(head,"positions") end local current=head local prev=nil @@ -21493,7 +21554,7 @@ local function inject_pairs_only(head,where) if keepregisteredcounts then keepregisteredcounts=false else - nofregisteredpairs=0 + nofregisteredpositions=0 end if trace_injections then show_result(head) @@ -21893,7 +21954,7 @@ end keepregisteredcounts=false else nofregisteredkerns=0 - nofregisteredpairs=0 + nofregisteredpositions=0 nofregisteredmarks=0 nofregisteredcursives=0 end @@ -22035,11 +22096,11 @@ function injections.handler(head,where) report_injections("injection variant %a","everything") end return inject_everything(head,where) - elseif nofregisteredpairs>0 then + elseif nofregisteredpositions>0 then if trace_injections then - report_injections("injection variant %a","pairs") + report_injections("injection variant %a","positions") end - return inject_pairs_only(head,where) + return inject_positions_only(head,where) elseif nofregisteredkerns>0 then if trace_injections then report_injections("injection variant %a","kerns") @@ -22554,7 +22615,8 @@ local injections=nodes.injections local setmark=injections.setmark local setcursive=injections.setcursive local setkern=injections.setkern -local setpair=injections.setpair +local setmove=injections.setmove +local setposition=injections.setposition local resetinjection=injections.reset local copyinjection=injections.copy local setligaindex=injections.setligaindex @@ -23054,15 +23116,16 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature) end function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,step,i,injection) local startchar=getchar(start) - if step.format=="pair" or type(kerns)=="table" then - local dx,dy,w,h=setpair(start,factor,rlmode,sequence.flags[4],kerns,injection) + local format=step.format + if format=="single" or type(kerns)=="table" then + local dx,dy,w,h=setposition(start,factor,rlmode,sequence.flags[4],kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p)",pref(dataset,sequence),gref(startchar),dx,dy,w,h) + logprocess("%s: shifting single %s by %s xy (%p,%p) and wh (%p,%p)",pref(dataset,sequence),gref(startchar),format,dx,dy,w,h) end else - local k=setkern(start,factor,rlmode,kerns,injection) + local k=(format=="move" and setmove or setkern)(start,factor,rlmode,kerns,injection) if trace_kerns then - logprocess("%s: shifting single %s by %p",pref(dataset,sequence),gref(startchar),k) + logprocess("%s: shifting single %s by %s %p",pref(dataset,sequence),gref(startchar),format,k) end end return head,start,false @@ -23082,37 +23145,40 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,step,i,inje snext=getnext(snext) elseif not krn then break - elseif step.format=="pair" then - local a,b=krn[1],krn[2] - if a==true then - elseif a then - local x,y,w,h=setpair(start,factor,rlmode,sequence.flags[4],a,injection) - if trace_kerns then - local startchar=getchar(start) - logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + else + local format=step.format + if format=="pair" then + local a,b=krn[1],krn[2] + if a==true then + elseif a then + local x,y,w,h=setposition(start,factor,rlmode,sequence.flags[4],a,injection) + if trace_kerns then + local startchar=getchar(start) + logprocess("%s: shifting first of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + end end - end - if b==true then - start=snext - elseif b then - local x,y,w,h=setpair(snext,factor,rlmode,sequence.flags[4],b,injection) + if b==true then + start=snext + elseif b then + local x,y,w,h=setposition(snext,factor,rlmode,sequence.flags[4],b,injection) + if trace_kerns then + local startchar=getchar(snext) + logprocess("%s: shifting second of pair %s and %s by xy (%p,%p) and wh (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + end + start=snext + elseif forcepairadvance then + start=snext + end + return head,start,true + elseif krn~=0 then + local k=(format=="move" and setmove or setkern)(snext,factor,rlmode,krn,injection) if trace_kerns then - local startchar=getchar(snext) - logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p) as %s",pref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h,injection or "injections") + logprocess("%s: inserting %s %p between %s and %s as %s",pref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar),injection or "injections") end - start=snext - elseif forcepairadvance then - start=snext - end - return head,start,true - elseif krn~=0 then - local k=setkern(snext,factor,rlmode,krn,injection) - if trace_kerns then - logprocess("%s: inserting kern %p between %s and %s as %s",pref(dataset,sequence),k,gref(getchar(prev)),gref(nextchar),injection or "injections") + return head,start,true + else + break end - return head,start,true - else - break end else break @@ -23540,15 +23606,18 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r local step=steps[1] local kerns=step.coverage[startchar] if not kerns then - elseif step.format=="pair" then - local dx,dy,w,h=setpair(start,factor,rlmode,sequence.flags[4],kerns) - if trace_kerns then - logprocess("%s: shifting single %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),dx,dy,w,h) - end - else - local k=setkern(start,factor,rlmode,kerns,injection) - if trace_kerns then - logprocess("%s: shifting single %s by %p",cref(dataset,sequence),gref(startchar),k) + else + local format=step.format + if format=="single" then + local dx,dy,w,h=setposition(start,factor,rlmode,sequence.flags[4],kerns) + if trace_kerns then + logprocess("%s: shifting single %s by %s (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),format,dx,dy,w,h) + end + else + local k=(format=="move" and setmove or setkern)(start,factor,rlmode,kerns,injection) + if trace_kerns then + logprocess("%s: shifting single %s by %s %p",cref(dataset,sequence),gref(startchar),format,k) + end end end end @@ -23581,37 +23650,40 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm snext=getnext(snext) elseif not krn then break - elseif step.format=="pair" then - local a,b=krn[1],krn[2] - if a==true then - elseif a then - local x,y,w,h=setpair(start,factor,rlmode,sequence.flags[4],a,"injections") - if trace_kerns then - local startchar=getchar(start) - logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + else + local format=step.format + if format=="pair" then + local a,b=krn[1],krn[2] + if a==true then + elseif a then + local x,y,w,h=setposition(start,factor,rlmode,sequence.flags[4],a,"injections") + if trace_kerns then + local startchar=getchar(start) + logprocess("%s: shifting first of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + end end - end - if b==true then - start=snext - elseif b then - local x,y,w,h=setpair(snext,factor,rlmode,sequence.flags[4],b,"injections") + if b==true then + start=snext + elseif b then + local x,y,w,h=setposition(snext,factor,rlmode,sequence.flags[4],b,"injections") + if trace_kerns then + local startchar=getchar(start) + logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + end + start=snext + elseif forcepairadvance then + start=snext + end + return head,start,true + elseif krn~=0 then + local k=(format=="move" and setmove or setkern)(snext,factor,rlmode,krn) if trace_kerns then - local startchar=getchar(start) - logprocess("%s: shifting second of pair %s and %s by (%p,%p) and correction (%p,%p)",cref(dataset,sequence),gref(startchar),gref(nextchar),x,y,w,h) + logprocess("%s: inserting %s %p between %s and %s",cref(dataset,sequence),format,k,gref(getchar(prev)),gref(nextchar)) end - start=snext - elseif forcepairadvance then - start=snext - end - return head,start,true - elseif krn~=0 then - local k=setkern(snext,factor,rlmode,krn) - if trace_kerns then - logprocess("%s: inserting kern %s between %s and %s",cref(dataset,sequence),k,gref(getchar(prev)),gref(nextchar)) + return head,start,true + else + break end - return head,start,true - else - break end end end @@ -29453,8 +29525,8 @@ local function addfeature(data,feature,specifications) coverage=prepare_alternate(list,featuretype,nocheck) elseif featuretype=="multiple" then coverage=prepare_multiple(list,featuretype,nocheck) - elseif featuretype=="kern" then - format="kern" + elseif featuretype=="kern" or featuretype=="move" then + format=featuretype coverage=prepare_kern(list,featuretype) elseif featuretype=="pair" then format="pair" @@ -29494,9 +29566,9 @@ local function addfeature(data,feature,specifications) elseif featuretype=="multiple" then category="gsub" coverage=prepare_multiple(list,featuretype,nocheck) - elseif featuretype=="kern" then + elseif featuretype=="kern" or featuretype=="move" then category="gpos" - format="kern" + format=featuretype coverage=prepare_kern(list,featuretype) elseif featuretype=="pair" then category="gpos" -- cgit v1.2.3