summaryrefslogtreecommitdiff
path: root/tex
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2009-10-19 14:43:00 +0200
committerHans Hagen <pragma@wxs.nl>2009-10-19 14:43:00 +0200
commite95ec93b5fe70c7d0e16071a1df8777cb9289d3b (patch)
tree3ea17776ea748226d95e52b420a5f30394e2d1eb /tex
parentea36ada779b87db193b865429d5db510713038a4 (diff)
downloadcontext-e95ec93b5fe70c7d0e16071a1df8777cb9289d3b.tar.gz
beta 2009.10.19 14:43
Diffstat (limited to 'tex')
-rw-r--r--tex/context/base/catc-ini.lua7
-rw-r--r--tex/context/base/char-ini.mkiv1
-rw-r--r--tex/context/base/cont-new.tex2
-rw-r--r--tex/context/base/context.tex2
-rw-r--r--tex/context/base/font-gds.lua5
-rw-r--r--tex/context/base/font-otn.lua58
-rw-r--r--tex/context/base/luat-sto.lua2
-rw-r--r--tex/context/base/lxml-aux.lua25
-rw-r--r--tex/context/base/lxml-dir.lua7
-rw-r--r--tex/context/base/lxml-ini.mkiv2
-rw-r--r--tex/context/base/lxml-lpt.lua2
-rw-r--r--tex/context/base/lxml-tab.lua10
-rw-r--r--tex/context/base/lxml-tex.lua4
-rw-r--r--tex/context/base/node-inj.lua167
-rw-r--r--tex/context/base/strc-des.mkiv2
-rw-r--r--tex/context/base/strc-ini.lua5
-rw-r--r--tex/context/base/strc-num.mkiv8
-rw-r--r--tex/context/base/strc-ref.lua11
-rw-r--r--tex/context/base/supp-fil.lua1
-rw-r--r--tex/context/base/supp-fil.mkiv2
-rw-r--r--tex/context/base/typo-mir.lua12
-rw-r--r--tex/context/base/x-ct.mkiv39
-rw-r--r--tex/generic/context/luatex-fonts-merged.lua227
23 files changed, 313 insertions, 288 deletions
diff --git a/tex/context/base/catc-ini.lua b/tex/context/base/catc-ini.lua
index 90fe08bb4..2749f403c 100644
--- a/tex/context/base/catc-ini.lua
+++ b/tex/context/base/catc-ini.lua
@@ -17,7 +17,12 @@ storage.register("catcodes/names", catcodes.names, "catcodes.names")
function catcodes.register(name,number)
catcodes.numbers[name] = number
- catcodes.names[number] = name
+ local cnn = catcodes.names[number]
+ if cnn then
+ cnn[#cnn+1] = name
+ else
+ catcodes.names[number] = { name }
+ end
tex[name] = number
end
diff --git a/tex/context/base/char-ini.mkiv b/tex/context/base/char-ini.mkiv
index 2f1fe23a1..e64ed0819 100644
--- a/tex/context/base/char-ini.mkiv
+++ b/tex/context/base/char-ini.mkiv
@@ -67,7 +67,6 @@
\number\xmlcatcodesn,
\number\xmlcatcodese,
\number\xmlcatcodesr,
- \number\xmlcatcodes,
}
)
catcodes.register("xmlcatcodes",\number\xmlcatcodes)
diff --git a/tex/context/base/cont-new.tex b/tex/context/base/cont-new.tex
index 4798e31bc..0e8c16506 100644
--- a/tex/context/base/cont-new.tex
+++ b/tex/context/base/cont-new.tex
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2009.10.18 15:20}
+\newcontextversion{2009.10.19 14:43}
%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/context.tex b/tex/context/base/context.tex
index da8ad455b..b4f667749 100644
--- a/tex/context/base/context.tex
+++ b/tex/context/base/context.tex
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2009.10.18 15:20}
+\edef\contextversion{2009.10.19 14:43}
%D For those who want to use this:
diff --git a/tex/context/base/font-gds.lua b/tex/context/base/font-gds.lua
index 95623df1c..9a59b404e 100644
--- a/tex/context/base/font-gds.lua
+++ b/tex/context/base/font-gds.lua
@@ -11,6 +11,8 @@ local type, next = type, next
local gmatch = string.gmatch
-- goodies=name,colorscheme=,featureset=
+--
+-- goodies=auto
-- goodies
@@ -52,8 +54,9 @@ fonts.goodies.get = getgoodies
local preset_context = fonts.define.specify.preset_context
function fonts.initializers.common.goodies(tfmdata,value)
- local goodies = { }
+ local goodies = tfmdata.goodies or { } -- future versions might store goodies in the cached instance
for filename in gmatch(value,"[^, ]+") do
+ -- we need to check for duplicates
local ok = getgoodies(filename)
if ok then
goodies[#goodies+1] = ok
diff --git a/tex/context/base/font-otn.lua b/tex/context/base/font-otn.lua
index 880b52a49..6c6e7ed24 100644
--- a/tex/context/base/font-otn.lua
+++ b/tex/context/base/font-otn.lua
@@ -756,9 +756,9 @@ end
function handlers.gpos_single(start,kind,lookupname,kerns,sequence)
local startchar = start.char
- local dx, dy = set_pair(start,tfmdata.factor,rlmode,kerns,characters[startchar])
+ local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar])
if trace_kerns then
- logprocess("%s: shifting single %s by (%s,%s)",pref(kind,lookupname),gref(startchar),dx,dy)
+ 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
end
@@ -787,14 +787,14 @@ local krn = kerns[nextchar]
local a, b = krn[3], krn[4]
if a and #a > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(start,factor,rlmode,a,characters[startchar])
+ local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar])
if trace_kerns then
logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
end
if b and #b > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(snext,factor,rlmode,b,characters[nextchar])
+ local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar])
if trace_kerns then
logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
@@ -1408,7 +1408,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache,
return start, false
end
-function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname)
+function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence)
-- untested
local startchar = start.char
local subtables = currentlookup.subtables
@@ -1417,9 +1417,9 @@ function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,c
if kerns then
kerns = kerns[startchar]
if kerns then
- local dx, dy = set_pair(start,tfmdata.factor,rlmode,kerns,characters[startchar])
+ local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar])
if trace_kerns then
- logprocess("%s: shifting single %s by (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),dx,dy)
+ logprocess("%s: shifting single %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),dx,dy,w,h)
end
end
end
@@ -1428,7 +1428,7 @@ end
-- when machines become faster i will make a shared function
-function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname)
+function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence)
-- logwarning("%s: gpos_pair not yet supported",cref(kind,chainname,chainlookupname))
local snext = start.next
if snext then
@@ -1455,14 +1455,14 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,cur
local a, b = krn[3], krn[4]
if a and #a > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(start,factor,rlmode,a,characters[startchar])
+ local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar])
if trace_kerns then
logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
end
if b and #b > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(snext,factor,rlmode,b,characters[nextchar])
+ local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar])
if trace_kerns then
logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
@@ -1523,12 +1523,12 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
for k=1,#contexts do
local match, current, last = true, start, start
local ck = contexts[k]
- local sequence = ck[3]
- local s = #sequence
+ local seq = ck[3]
+ local s = #seq
-- f..l = mid string
if s == 1 then
-- never happens
- match = current.id == glyph and current.subtype<256 and current.font == currentfont and sequence[1][current.char]
+ match = current.id == glyph and current.subtype<256 and current.font == currentfont and seq[1][current.char]
else
-- todo: better space check (maybe check for glue)
local f, l = ck[4], ck[5]
@@ -1542,7 +1542,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
-- we cannot optimize for n=2 because there can be disc nodes
-- if not someskip and n == l then
-- -- n=2 and no skips then faster loop
- -- match = last and last.id == glyph and last.subtype<256 and last.font == currentfont and sequence[n][last.char]
+ -- match = last and last.id == glyph and last.subtype<256 and last.font == currentfont and seq[n][last.char]
-- else
while n <= l do
if last then
@@ -1558,7 +1558,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
show_skip(kind,chainname,char,ck,class)
end
last = last.next
- elseif sequence[n][char] then
+ elseif seq[n][char] then
if n < l then
last = last.next
end
@@ -1601,7 +1601,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if trace_skips then
show_skip(kind,chainname,char,ck,class)
end
- elseif sequence[n][char] then
+ elseif seq[n][char] then
n = n -1
else
match = false break
@@ -1614,23 +1614,23 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
end
elseif id == disc then
-- skip 'm
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n -1
else
match = false break
end
prev = prev.prev
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n -1
else
match = false break
end
end
elseif f == 2 then
- match = sequence[1][32]
+ match = seq[1][32]
else
for n=f-1,1 do
- if not sequence[n][32] then
+ if not seq[n][32] then
match = false break
end
end
@@ -1655,7 +1655,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if trace_skips then
show_skip(kind,chainname,char,ck,class)
end
- elseif sequence[n][char] then
+ elseif seq[n][char] then
n = n + 1
else
match = false break
@@ -1668,23 +1668,23 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
end
elseif id == disc then
-- skip 'm
- elseif sequence[n][32] then -- brrr
+ elseif seq[n][32] then -- brrr
n = n + 1
else
match = false break
end
current = current.next
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n + 1
else
match = false break
end
end
elseif s-l == 1 then
- match = sequence[s][32]
+ match = seq[s][32]
else
for n=l+1,s do
- if not sequence[n][32] then
+ if not seq[n][32] then
match = false break
end
end
@@ -1694,7 +1694,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if match then
-- ck == currentcontext
if trace_contexts then
- local rule, lookuptype, sequence, f, l = ck[1], ck[2] ,ck[3], ck[4], ck[5]
+ local rule, lookuptype, f, l = ck[1], ck[2], ck[4], ck[5]
local char = start.char
if ck[9] then
logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s (%s=>%s)",cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype,ck[9],ck[10])
@@ -1711,7 +1711,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
local chainlookup = lookuptable[chainlookupname]
local cp = chainprocs[chainlookup.type]
if cp then
- start, done = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname)
+ start, done = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,nil,sequence)
else
logprocess("%s: %s is not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type)
end
@@ -1724,7 +1724,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
local cp = chainmores[chainlookup.type]
if cp then
local ok, n
- start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i)
+ start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence)
-- messy since last can be changed !
if ok then
done = true
@@ -1743,7 +1743,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,cache,replacements)
+ start, done = chainprocs.reversesub(start,last,kind,chainname,ck,cache,replacements) -- sequence
else
done = true -- can be meant to be skipped
if trace_contexts then
diff --git a/tex/context/base/luat-sto.lua b/tex/context/base/luat-sto.lua
index 5e51660c4..30358a836 100644
--- a/tex/context/base/luat-sto.lua
+++ b/tex/context/base/luat-sto.lua
@@ -122,7 +122,7 @@ function statistics.report_storage(whereto)
end
write_nl(whereto," ","stored catcodetables:"," ")
for k,v in table.sortedpairs(catcodes.names) do
- write_nl(whereto,format("%03i %s",k,v))
+ write_nl(whereto,format("%03i %s",k,table.concat(v," ")))
end
write_nl(whereto," ")
end
diff --git a/tex/context/base/lxml-aux.lua b/tex/context/base/lxml-aux.lua
index eb2f3bb85..9eab06e45 100644
--- a/tex/context/base/lxml-aux.lua
+++ b/tex/context/base/lxml-aux.lua
@@ -9,6 +9,8 @@ if not modules then modules = { } end modules ['lxml-aux'] = {
-- not all functions here make sense anymore vbut we keep them for
-- compatibility reasons
+local trace_manipulations = false trackers.register("lxml.manipulations", function(v) trace_manipulations = v end)
+
local xmlparseapply, xmlconvert, xmlcopy = xml.parse_apply, xml.convert, xml.copy
local type = type
@@ -238,16 +240,25 @@ xml.insert_element_before = function(r,p,e) xml.insert_element(r,p,e,true) end
xml.inject_element_after = xml.inject_element
xml.inject_element_before = function(r,p,e) xml.inject_element(r,p,e,true) end
+local function report(what,pattern,c,e)
+ logs.report("xml","%s element '%s' (root: '%s', position: %s, index: %s, pattern: %s)",what,xml.name(e),xml.name(e.__p__),c,e.ni,pattern)
+end
+
function xml.delete_element(root, pattern)
local collected = xmlparseapply({ root },pattern)
if collected then
for c=1,#collected do
local e = collected[c]
- remove(e.__p__.dt,e.ni)
- e.ni = nil
+ local p = e.__p__
+ if p then
+ if trace_manipulations then
+ report('deleting',pattern,c,e)
+ end
+ remove(p.dt,e.ni)
+ e.ni = nil
+ end
end
end
- return collection
end
function xml.replace_element(root, pattern, element)
@@ -262,7 +273,13 @@ function xml.replace_element(root, pattern, element)
if collected then
for c=1,#collected do
local e = collected[c]
- e.__p__.dt[e.ni] = element.dt -- maybe not clever enough
+ local p = e.__p__
+ if p then
+ if trace_manipulations then
+ report('replacing',pattern,c,e)
+ end
+ p.dt[e.ni] = element.dt -- maybe not clever enough
+ end
end
end
end
diff --git a/tex/context/base/lxml-dir.lua b/tex/context/base/lxml-dir.lua
index 12d7680ed..f57208a91 100644
--- a/tex/context/base/lxml-dir.lua
+++ b/tex/context/base/lxml-dir.lua
@@ -39,12 +39,13 @@ local data = {
}
local function load_setup(filename)
- local fullname = resolvers.find_file(filename) or ""
+ local fullname = resolvers.findtexfile(filename) or ""
if fullname ~= "" then
filename = fullname
end
local collection = xmlparseapply({ get_id(xml.load(filename)) },"directive")
if collection then
+ local valid = 0
for i=1,#collection do
local at = collection[i].at
local attribute, value, element = at.attribute or "", at.value or "", at.element or '*'
@@ -56,8 +57,12 @@ local function load_setup(filename)
if before ~= "" then t.before = before end
if after ~= "" then t.after = after end
data[key] = t
+ valid = valid + 1
end
end
+ logs.report("lxml","%s directives found in '%s', %s valid",#collection,filename,valid)
+ else
+ logs.report("lxml","no directives found in '%s'",filename)
end
end
diff --git a/tex/context/base/lxml-ini.mkiv b/tex/context/base/lxml-ini.mkiv
index d3a56afbe..01b80562d 100644
--- a/tex/context/base/lxml-ini.mkiv
+++ b/tex/context/base/lxml-ini.mkiv
@@ -40,7 +40,7 @@
\def\xmlconcat #1#2#3{\ctxlua{lxml.concat("#1","#2",[[\detokenize{#3}]])}}
\def\xmlconcatrange#1#2#3#4#5{\ctxlua{lxml.concatrange("#1","#2","#3","#4",[[\detokenize{#5}]])}}
\def\xmlcount #1#2{\ctxlua{lxml.count("#1","#2")}}
-\def\xmldelete #1#2{\ctxlua{xml.delete(lxml.id("#1"),"#2")}}
+\def\xmldelete #1#2{\ctxlua{lxml.delete("#1","#2")}}
\def\xmldirectives #1{\ctxlua{lxml.directives.setup("#1")}}
\def\xmldirectivesbefore #1{\ctxlua{lxml.directives.before("#1")}}
\def\xmldirectivesafter #1{\ctxlua{lxml.directives.after("#1")}}
diff --git a/tex/context/base/lxml-lpt.lua b/tex/context/base/lxml-lpt.lua
index 0f5407bda..07c112943 100644
--- a/tex/context/base/lxml-lpt.lua
+++ b/tex/context/base/lxml-lpt.lua
@@ -389,7 +389,7 @@ local lp_builtin = P (
P("ns") / "ll.ns"
) * ((spaces * P("(") * spaces * P(")"))/"")
-local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("ll.at['") * R("az","AZ","--","__")^1 * Cc("']")
+local lp_attribute = (P("@") + P("attribute::")) / "" * Cc("(ll.at and ll.at['") * R("az","AZ","--","__")^1 * Cc("'])")
local lp_fastpos = ((R("09","--","++")^1 * P(-1)) / function(s) return "l==" .. s end)
local lp_reserved = C("and") + C("or") + C("not") + C("div") + C("mod") + C("true") + C("false")
diff --git a/tex/context/base/lxml-tab.lua b/tex/context/base/lxml-tab.lua
index faafa4462..15ed7a26f 100644
--- a/tex/context/base/lxml-tab.lua
+++ b/tex/context/base/lxml-tab.lua
@@ -960,6 +960,16 @@ function xml.content(root) -- bugged
return (root and root.dt and xml.tostring(root.dt)) or ""
end
+function xml.name(root)
+ if not root then
+ return ""
+ elseif root.ns == "" then
+ return root.tg
+ else
+ return root.ns .. ":" .. root.tg
+ end
+end
+
--[[ldx--
<p>The next helper erases an element but keeps the table as it is,
and since empty strings are not serialized (effectively) it does
diff --git a/tex/context/base/lxml-tex.lua b/tex/context/base/lxml-tex.lua
index 0759a7277..843ba704b 100644
--- a/tex/context/base/lxml-tex.lua
+++ b/tex/context/base/lxml-tex.lua
@@ -1329,3 +1329,7 @@ function lxml.stripped(id,pattern,nolines)
end
xmlsprint(str)
end
+
+function lxml.delete(id,pattern)
+ xml.delete(get_id(id),pattern)
+end
diff --git a/tex/context/base/node-inj.lua b/tex/context/base/node-inj.lua
index 5829513d3..18077b159 100644
--- a/tex/context/base/node-inj.lua
+++ b/tex/context/base/node-inj.lua
@@ -10,7 +10,8 @@ if not modules then modules = { } end modules ['node-inj'] = {
-- This is very experimental (this will change when we have luatex > .50 and
-- a few pending thingies are available. Also, Idris needs to make a few more
--- test fonts.
+-- test fonts. Btw, future versions of luatex will have extended glyph properties
+-- that can be of help.
local next = next
@@ -50,6 +51,8 @@ local kerns = { }
-- explicitly i will provide an alternative; also, we can share
-- tables
+-- for the moment we pass the r2l key ... volt/arabtype tests
+
function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext)
local dx, dy = factor*(exit[1]-entry[1]), factor*(exit[2]-entry[2])
local ws, wn = tfmstart.width, tfmnext.width
@@ -60,7 +63,7 @@ function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext)
return dx, dy, bound
end
-function nodes.set_pair(current,factor,rlmode,spec,tfmchr)
+function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr)
local x, y, w, h = factor*spec[1], factor*spec[2], factor*spec[3], factor*spec[4]
-- dy = y - h
if x ~= 0 or w ~= 0 or y ~= 0 or h ~= 0 then
@@ -71,7 +74,7 @@ function nodes.set_pair(current,factor,rlmode,spec,tfmchr)
else
bound = #kerns + 1
set_attribute(current,kernpair,bound)
- kerns[bound] = { rlmode, x, y, w, h }
+ kerns[bound] = { rlmode, x, y, w, h, r2lflag }
end
return x, y, w, h, bound
end
@@ -171,7 +174,7 @@ end
function nodes.inject_kerns(head,where,keep)
local has_marks, has_cursives, has_kerns = next(marks), next(cursives), next(kerns)
if has_marks or has_cursives then
---~ if true then
+--~ if has_marks or has_cursives or has_kerns then
if trace_injections then
nodes.trace_injection(head)
end
@@ -306,16 +309,15 @@ function nodes.inject_kerns(head,where,keep)
local d = mrks[index]
if d then
-- local rlmode = d[3] -- not used
- -- if rlmode and rlmode < 0 then
- -- n.xoffset = p.xoffset + d[1]
+ -- if rlmode and rlmode > 0 then
+ -- todo
-- else
-local k = wx[p]
-if k then
- n.xoffset = p.xoffset - d[1] - k[2]
---~ n.xoffset = p.xoffset - k[2]
-else
- n.xoffset = p.xoffset - d[1]
-end
+ local k = wx[p]
+ if k then
+ n.xoffset = p.xoffset - d[1] - k[2]
+ else
+ n.xoffset = p.xoffset - d[1]
+ end
-- end
if mk[p] then
n.yoffset = p.yoffset + d[2]
@@ -337,30 +339,40 @@ end
if next(wx) then
for n, k in next, wx do
-- only w can be nil, can be sped up when w == nil
- local rl, x, w = k[1], k[2] or 0, k[4] or 0
+ local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6]
local wx = w - x
+-- we can probably listen to only one of them i.e. ignore rl here
if rl < 0 then
---~ if false then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
---~ else
---~ if wx ~= 0 then
---~ insert_node_after(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
else
- -- if wx ~= 0 then
- -- insert_node_after(head,n,newkern(wx))
- -- end
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
end
end
@@ -388,10 +400,7 @@ end
if trace_injections then
nodes.trace_injection(head)
end
- local n = head
- while n do
- local id = n.id
- if id == glyph then
+ for n in traverse_id(glyph,head) do
local k = has_attribute(n,kernpair)
if k then
local kk = kerns[k]
@@ -401,34 +410,51 @@ end
n.yoffset = y -- todo: h ?
end
if w then
- -- gpospair kerns
+ -- copied from above
+ local r2l = kk[6]
local wx = w - x
if rl < 0 then
- if wx ~= 0 then
- head, _ = insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- head, n = insert_node_after(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
else
- -- if wx ~= 0 then
- -- head, n = insert_node_after(head,n,newkern(wx))
- -- end
- if x ~= 0 then
- head, _ = insert_node_before(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
end
else
-- simple (e.g. kernclass kerns)
if x ~= 0 then
- head, _ = insert_node_before(head,n,newkern(x))
+ insert_node_before(head,n,newkern(x))
end
end
end
end
end
- n = n.next
- end
if not keep then
kerns = { }
end
@@ -438,42 +464,3 @@ end
end
return head, false
end
-
---~ for n in traverse_id(glyph,head) do
---~ local k = has_attribute(n,kernpair)
---~ if k then
---~ local kk = kerns[k]
---~ if kk then
---~ -- only w can be nil, can be sped up when w == nil
---~ local rl, x, y, w = kk[1], kk[2] or 0, kk[3] or 0, kk[4] or 0
---~ if y ~= 0 then
---~ n.yoffset = y -- todo: h ?
---~ end
---~ local wx = w - x
---~ if rl < 0 then
---~ if false then
---~ if wx ~= 0 then
---~ insert_node_before(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_after (head,n,newkern(x))
---~ end
---~ else
---~ if wx ~= 0 then
---~ insert_node_after(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
---~ else
---~ -- if wx ~= 0 then
---~ -- insert_node_after(head,n,newkern(wx))
---~ -- end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
---~ end
---~ end
---~ end
diff --git a/tex/context/base/strc-des.mkiv b/tex/context/base/strc-des.mkiv
index c72db1899..56462bdd4 100644
--- a/tex/context/base/strc-des.mkiv
+++ b/tex/context/base/strc-des.mkiv
@@ -401,7 +401,7 @@
\def\@@makedescription[#1]#2%
{\postponenotes % new, assumes grouping
\doenumerationcheckconditions
- \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,][]%
+ \dodescriptioncomponent[\c!reference=#1,\c!label={\descriptionparameter\c!text},\c!title={#2},\c!bookmark=,\c!list=][]%
\@@dostartdescriptionindeed}
\def\dostartstoreddescription
diff --git a/tex/context/base/strc-ini.lua b/tex/context/base/strc-ini.lua
index 8fa304ed4..2d81cb9ab 100644
--- a/tex/context/base/strc-ini.lua
+++ b/tex/context/base/strc-ini.lua
@@ -24,7 +24,7 @@ local format, concat, match = string.format, table.concat, string.match
local count, texwrite, texprint, texsprint = tex.count, tex.write, tex.print, tex.sprint
local type, next, tonumber, tostring = type, next, tonumber, tostring
-local ctxcatcodes, xmlcatcodes = tex.ctxcatcodes, 11 -- tex.xmlcatcodes -- tricky as we're in notcatcodes
+local ctxcatcodes, xmlcatcodes, notcatcodes = tex.ctxcatcodes, tex.xmlcatcodes, tex.notcatcodes -- tricky as we're in notcatcodes
local trace_processors = false trackers.register("structure.processors", function(v) trace_processors = v end)
@@ -168,7 +168,8 @@ function helpers.title(title,metadata) -- brrr
texsprint(ctxcatcodes,format("\\xmlsetup{%s}{%s}",title,metadata.xmlsetup)) -- nasty
else
local catcodes = metadata.catcodes
- if catcodes == xmlcatcodes then
+--~ print(tex.ctxcatcodes,tex.xmlcatcodes,catcodes,title)
+ if catcodes == notcatcodes or catcodes == xmlcatcodes then
texsprint(ctxcatcodes,title) -- nasty
else
texsprint(catcodes,title)
diff --git a/tex/context/base/strc-num.mkiv b/tex/context/base/strc-num.mkiv
index 45f71827f..5ae161456 100644
--- a/tex/context/base/strc-num.mkiv
+++ b/tex/context/base/strc-num.mkiv
@@ -357,10 +357,10 @@
\edef\hasstructurecounternumber {#3\s!hasnumber}%
\edef\hasstructurecounterlevel {#3\s!haslevel}%
%
-\edef\askedprefixsegments{#3\c!prefixsegments}%
-\ifx\askedprefixsegments\v!auto
- \edef\askedprefixsegments{\autostructureprefixsegments#3}%
-\fi
+ \edef\askedprefixsegments{#3\c!prefixsegments}%
+ \ifx\askedprefixsegments\v!auto
+ \edef\askedprefixsegments{\autostructureprefixsegments#3}%
+ \fi
%
\edef\currentname{#3\c!name}%
\ifx\currentname\empty
diff --git a/tex/context/base/strc-ref.lua b/tex/context/base/strc-ref.lua
index 7698f203b..53d45178a 100644
--- a/tex/context/base/strc-ref.lua
+++ b/tex/context/base/strc-ref.lua
@@ -968,13 +968,10 @@ filters.section.title = filters.generic.title
filters.section.page = filters.generic.page
filters.section.default = filters.section.number
-filters.formula = {}
-
-filters.formula.default = filters.generic.number
-
-filters.float = { }
-
-filters.float.default = filters.generic.number
+filters.note = { default = filters.generic.number }
+filters.formula = { default = filters.generic.number }
+filters.float = { default = filters.generic.number }
+filters.description = { default = filters.generic.number }
structure.references = structure.references or { }
structure.helpers = structure.helpers or { }
diff --git a/tex/context/base/supp-fil.lua b/tex/context/base/supp-fil.lua
index bd92061f5..42db290a9 100644
--- a/tex/context/base/supp-fil.lua
+++ b/tex/context/base/supp-fil.lua
@@ -86,3 +86,4 @@ end
function support.lastexistingfile()
tex.sprint(ctxcatcodes,lastexistingfile)
end
+
diff --git a/tex/context/base/supp-fil.mkiv b/tex/context/base/supp-fil.mkiv
index 00263a85f..86c01fe0b 100644
--- a/tex/context/base/supp-fil.mkiv
+++ b/tex/context/base/supp-fil.mkiv
@@ -265,6 +265,8 @@
% We need to postpone loading, else we got frozen type-* files and so when
% a format is generated on a source path.
+%
+% It's about time we move this to lua.
\def\doreadfile#1#2#3#4%
{\sanitizefilename#2\to\readfilename
diff --git a/tex/context/base/typo-mir.lua b/tex/context/base/typo-mir.lua
index 14125e5d3..b85a8b833 100644
--- a/tex/context/base/typo-mir.lua
+++ b/tex/context/base/typo-mir.lua
@@ -14,7 +14,7 @@ local utfchar = utf.char
-- vertical space handler
-local trace_mirroring = false trackers.register("nodes.mirroring", function(v) trace_mirroring = v end)
+local trace_mirroring = false trackers.register("nodes.mirroring", function(v) trace_mirroring = v end)
local has_attribute = node.has_attribute
local unset_attribute = node.unset_attribute
@@ -254,10 +254,16 @@ function mirror.process(namespace,attribute,start) -- todo: make faster
if autodir <= 0 then
force_auto_left_before()
end
- elseif d == "r" or d == "al" or d == "an" then -- arabic left, arabic number
+ elseif d == "r" or d == "al" then -- arabic number
if autodir >= 0 then
force_auto_right_before()
end
+ elseif d == "an" then -- arabic number
+ -- actually this is language dependent ...
+ if autodir <= 0 then
+--~ force_auto_right_before()
+ force_auto_left_before()
+ end
elseif d == "lro" then -- Left-to-Right Override -> right becomes left
if trace_mirroring then
list[#list+1] = "override right -> left"
@@ -310,7 +316,7 @@ function mirror.process(namespace,attribute,start) -- todo: make faster
if trace_mirroring then
local char = current.char
local d = directions[char]
- list[#list+1] = format("char %s (%s / U+%04X) of class %s (no bidi)",utfchar(char),char,char,d)
+ list[#list+1] = format("char %s (%s / U+%04X) of class %s (no bidi)",utfchar(char),char,char,d or "?")
end
end
elseif id == whatsit then
diff --git a/tex/context/base/x-ct.mkiv b/tex/context/base/x-ct.mkiv
index 03a0e4b69..7836f5060 100644
--- a/tex/context/base/x-ct.mkiv
+++ b/tex/context/base/x-ct.mkiv
@@ -28,8 +28,10 @@ do
justify = '',
}
- local texsprint = tex.sprint
- local xmlsprint = xml.sprint
+ local texsprint = tex.sprint
+ local xmlsprint = xml.sprint
+ local xmlfilter = xml.filter
+ local ctxcatcodes = tex.ctxcatcodes
local function roottemplate(root)
local rt = root.at.template
@@ -97,20 +99,20 @@ do
defaulttemplate
lxml.directives.before(root,'cdx')
- texsprint(tex.ctxcatcodes, "\\bgroup")
+ texsprint(ctxcatcodes, "\\bgroup")
lxml.directives.setup(root,'cdx')
-- todo: head and foot
- texsprint(tex.ctxcatcodes, string.format("\\starttabulate[%s]",template))
+ texsprint(ctxcatcodes, string.format("\\starttabulate[%s]",template))
for e in xml.collected(root,bodyrowspec) do
- texsprint(tex.ctxcatcodes, "\\NC ")
+ texsprint(ctxcatcodes, "\\NC ")
for e in xml.collected(e,cellspec) do
texsprint(xml.content(e))
- texsprint(tex.ctxcatcodes, "\\NC")
+ texsprint(ctxcatcodes, "\\NC")
end
- texsprint(tex.ctxcatcodes, "\\NR")
+ texsprint(ctxcatcodes, "\\NR")
end
- texsprint(tex.ctxcatcodes, "\\stoptabulate")
- texsprint(tex.ctxcatcodes, "\\egroup")
+ texsprint(ctxcatcodes, "\\stoptabulate")
+ texsprint(ctxcatcodes, "\\egroup")
lxml.directives.after(root,'cdx')
end
@@ -137,20 +139,19 @@ do
local template = string.format("%s*%s", nx or 1, ny or 1)
lxml.directives.before(root,'cdx')
- texsprint(tex.ctxcatcodes, "\\bgroup")
+ texsprint(ctxcatcodes, "\\bgroup")
lxml.directives.setup(root,'cdx')
-- todo: alignments
- texsprint(tex.ctxcatcodes, string.format("\\startcombination[%s]",template))
+ texsprint(ctxcatcodes, "\\startcombination[",template,"]")
for e in xml.collected(root,pairspec) do
- texsprint(tex.ctxcatcodes,"{")
- xmlsprint(xml.filter(e,contentspec) or "")
- texsprint(tex.ctxcatcodes,"}")
- texsprint(tex.ctxcatcodes,"{")
- xmlsprint(xml.filter(e,captionspec) or "")
- texsprint(tex.ctxcatcodes,"}")
+ texsprint(ctxcatcodes,"{")
+ xmlfilter(e,contentspec)
+ texsprint(ctxcatcodes,"}{")
+ xmlfilter(e,captionspec)
+ texsprint(ctxcatcodes,"}")
end
- texsprint(tex.ctxcatcodes, "\\stopcombination")
- texsprint(tex.ctxcatcodes, "\\egroup")
+ texsprint(ctxcatcodes, "\\stopcombination")
+ texsprint(ctxcatcodes, "\\egroup")
lxml.directives.after(root,'cdx')
end
diff --git a/tex/generic/context/luatex-fonts-merged.lua b/tex/generic/context/luatex-fonts-merged.lua
index 9c513633b..fec779d9e 100644
--- a/tex/generic/context/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/texmf/tex/generic/context/luatex-fonts.lua
--- merge date : 10/18/09 15:26:25
+-- merge date : 10/19/09 14:48:40
do -- begin closure to overcome local limits and interference
@@ -2402,7 +2402,8 @@ if not modules then modules = { } end modules ['node-inj'] = {
-- This is very experimental (this will change when we have luatex > .50 and
-- a few pending thingies are available. Also, Idris needs to make a few more
--- test fonts.
+-- test fonts. Btw, future versions of luatex will have extended glyph properties
+-- that can be of help.
local next = next
@@ -2442,6 +2443,8 @@ local kerns = { }
-- explicitly i will provide an alternative; also, we can share
-- tables
+-- for the moment we pass the r2l key ... volt/arabtype tests
+
function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext)
local dx, dy = factor*(exit[1]-entry[1]), factor*(exit[2]-entry[2])
local ws, wn = tfmstart.width, tfmnext.width
@@ -2452,7 +2455,7 @@ function nodes.set_cursive(start,nxt,factor,rlmode,exit,entry,tfmstart,tfmnext)
return dx, dy, bound
end
-function nodes.set_pair(current,factor,rlmode,spec,tfmchr)
+function nodes.set_pair(current,factor,rlmode,r2lflag,spec,tfmchr)
local x, y, w, h = factor*spec[1], factor*spec[2], factor*spec[3], factor*spec[4]
-- dy = y - h
if x ~= 0 or w ~= 0 or y ~= 0 or h ~= 0 then
@@ -2463,7 +2466,7 @@ function nodes.set_pair(current,factor,rlmode,spec,tfmchr)
else
bound = #kerns + 1
set_attribute(current,kernpair,bound)
- kerns[bound] = { rlmode, x, y, w, h }
+ kerns[bound] = { rlmode, x, y, w, h, r2lflag }
end
return x, y, w, h, bound
end
@@ -2563,7 +2566,7 @@ end
function nodes.inject_kerns(head,where,keep)
local has_marks, has_cursives, has_kerns = next(marks), next(cursives), next(kerns)
if has_marks or has_cursives then
---~ if true then
+--~ if has_marks or has_cursives or has_kerns then
if trace_injections then
nodes.trace_injection(head)
end
@@ -2698,16 +2701,15 @@ function nodes.inject_kerns(head,where,keep)
local d = mrks[index]
if d then
-- local rlmode = d[3] -- not used
- -- if rlmode and rlmode < 0 then
- -- n.xoffset = p.xoffset + d[1]
+ -- if rlmode and rlmode > 0 then
+ -- todo
-- else
-local k = wx[p]
-if k then
- n.xoffset = p.xoffset - d[1] - k[2]
---~ n.xoffset = p.xoffset - k[2]
-else
- n.xoffset = p.xoffset - d[1]
-end
+ local k = wx[p]
+ if k then
+ n.xoffset = p.xoffset - d[1] - k[2]
+ else
+ n.xoffset = p.xoffset - d[1]
+ end
-- end
if mk[p] then
n.yoffset = p.yoffset + d[2]
@@ -2729,30 +2731,40 @@ end
if next(wx) then
for n, k in next, wx do
-- only w can be nil, can be sped up when w == nil
- local rl, x, w = k[1], k[2] or 0, k[4] or 0
+ local rl, x, w, r2l = k[1], k[2] or 0, k[4] or 0, k[6]
local wx = w - x
+-- we can probably listen to only one of them i.e. ignore rl here
if rl < 0 then
---~ if false then
- if wx ~= 0 then
- insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- insert_node_after (head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
---~ else
---~ if wx ~= 0 then
---~ insert_node_after(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
else
- -- if wx ~= 0 then
- -- insert_node_after(head,n,newkern(wx))
- -- end
- if x ~= 0 then
- insert_node_before(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
end
end
@@ -2780,10 +2792,7 @@ end
if trace_injections then
nodes.trace_injection(head)
end
- local n = head
- while n do
- local id = n.id
- if id == glyph then
+ for n in traverse_id(glyph,head) do
local k = has_attribute(n,kernpair)
if k then
local kk = kerns[k]
@@ -2793,34 +2802,51 @@ end
n.yoffset = y -- todo: h ?
end
if w then
- -- gpospair kerns
+ -- copied from above
+ local r2l = kk[6]
local wx = w - x
if rl < 0 then
- if wx ~= 0 then
- head, _ = insert_node_before(head,n,newkern(wx))
- end
- if x ~= 0 then
- head, n = insert_node_after(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
else
- -- if wx ~= 0 then
- -- head, n = insert_node_after(head,n,newkern(wx))
- -- end
- if x ~= 0 then
- head, _ = insert_node_before(head,n,newkern(x))
+ if r2l then
+ if wx ~= 0 then
+ insert_node_before(head,n,newkern(wx))
+ end
+ if x ~= 0 then
+ insert_node_after (head,n,newkern(x))
+ end
+ else
+ if x ~= 0 then
+ insert_node_before(head,n,newkern(x))
+ end
+ if wx ~= 0 then
+ insert_node_after(head,n,newkern(wx))
+ end
end
end
else
-- simple (e.g. kernclass kerns)
if x ~= 0 then
- head, _ = insert_node_before(head,n,newkern(x))
+ insert_node_before(head,n,newkern(x))
end
end
end
end
end
- n = n.next
- end
if not keep then
kerns = { }
end
@@ -2831,45 +2857,6 @@ end
return head, false
end
---~ for n in traverse_id(glyph,head) do
---~ local k = has_attribute(n,kernpair)
---~ if k then
---~ local kk = kerns[k]
---~ if kk then
---~ -- only w can be nil, can be sped up when w == nil
---~ local rl, x, y, w = kk[1], kk[2] or 0, kk[3] or 0, kk[4] or 0
---~ if y ~= 0 then
---~ n.yoffset = y -- todo: h ?
---~ end
---~ local wx = w - x
---~ if rl < 0 then
---~ if false then
---~ if wx ~= 0 then
---~ insert_node_before(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_after (head,n,newkern(x))
---~ end
---~ else
---~ if wx ~= 0 then
---~ insert_node_after(head,n,newkern(wx))
---~ end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
---~ else
---~ -- if wx ~= 0 then
---~ -- insert_node_after(head,n,newkern(wx))
---~ -- end
---~ if x ~= 0 then
---~ insert_node_before(head,n,newkern(x))
---~ end
---~ end
---~ end
---~ end
---~ end
-
end -- closure
do -- begin closure to overcome local limits and interference
@@ -8084,9 +8071,9 @@ end
function handlers.gpos_single(start,kind,lookupname,kerns,sequence)
local startchar = start.char
- local dx, dy = set_pair(start,tfmdata.factor,rlmode,kerns,characters[startchar])
+ local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar])
if trace_kerns then
- logprocess("%s: shifting single %s by (%s,%s)",pref(kind,lookupname),gref(startchar),dx,dy)
+ 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
end
@@ -8115,14 +8102,14 @@ local krn = kerns[nextchar]
local a, b = krn[3], krn[4]
if a and #a > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(start,factor,rlmode,a,characters[startchar])
+ local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar])
if trace_kerns then
logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
end
if b and #b > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(snext,factor,rlmode,b,characters[nextchar])
+ local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar])
if trace_kerns then
logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",pref(kind,lookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
@@ -8736,7 +8723,7 @@ function chainprocs.gpos_cursive(start,stop,kind,chainname,currentcontext,cache,
return start, false
end
-function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname)
+function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence)
-- untested
local startchar = start.char
local subtables = currentlookup.subtables
@@ -8745,9 +8732,9 @@ function chainprocs.gpos_single(start,stop,kind,chainname,currentcontext,cache,c
if kerns then
kerns = kerns[startchar]
if kerns then
- local dx, dy = set_pair(start,tfmdata.factor,rlmode,kerns,characters[startchar])
+ local dx, dy, w, h = set_pair(start,tfmdata.factor,rlmode,sequence.flags[4],kerns,characters[startchar])
if trace_kerns then
- logprocess("%s: shifting single %s by (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),dx,dy)
+ logprocess("%s: shifting single %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),dx,dy,w,h)
end
end
end
@@ -8756,7 +8743,7 @@ end
-- when machines become faster i will make a shared function
-function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname)
+function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,currentlookup,chainlookupname,chainindex,sequence)
-- logwarning("%s: gpos_pair not yet supported",cref(kind,chainname,chainlookupname))
local snext = start.next
if snext then
@@ -8783,14 +8770,14 @@ function chainprocs.gpos_pair(start,stop,kind,chainname,currentcontext,cache,cur
local a, b = krn[3], krn[4]
if a and #a > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(start,factor,rlmode,a,characters[startchar])
+ local x, y, w, h = set_pair(start,factor,rlmode,sequence.flags[4],a,characters[startchar])
if trace_kerns then
logprocess("%s: shifting first of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
end
if b and #b > 0 then
local startchar = start.char
- local x, y, w, h = set_pair(snext,factor,rlmode,b,characters[nextchar])
+ local x, y, w, h = set_pair(snext,factor,rlmode,sequence.flags[4],b,characters[nextchar])
if trace_kerns then
logprocess("%s: shifting second of pair %s and %s by (%s,%s) and correction (%s,%s)",cref(kind,chainname,chainlookupname),gref(startchar),gref(nextchar),x,y,w,h)
end
@@ -8851,12 +8838,12 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
for k=1,#contexts do
local match, current, last = true, start, start
local ck = contexts[k]
- local sequence = ck[3]
- local s = #sequence
+ local seq = ck[3]
+ local s = #seq
-- f..l = mid string
if s == 1 then
-- never happens
- match = current.id == glyph and current.subtype<256 and current.font == currentfont and sequence[1][current.char]
+ match = current.id == glyph and current.subtype<256 and current.font == currentfont and seq[1][current.char]
else
-- todo: better space check (maybe check for glue)
local f, l = ck[4], ck[5]
@@ -8870,7 +8857,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
-- we cannot optimize for n=2 because there can be disc nodes
-- if not someskip and n == l then
-- -- n=2 and no skips then faster loop
- -- match = last and last.id == glyph and last.subtype<256 and last.font == currentfont and sequence[n][last.char]
+ -- match = last and last.id == glyph and last.subtype<256 and last.font == currentfont and seq[n][last.char]
-- else
while n <= l do
if last then
@@ -8886,7 +8873,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
show_skip(kind,chainname,char,ck,class)
end
last = last.next
- elseif sequence[n][char] then
+ elseif seq[n][char] then
if n < l then
last = last.next
end
@@ -8929,7 +8916,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if trace_skips then
show_skip(kind,chainname,char,ck,class)
end
- elseif sequence[n][char] then
+ elseif seq[n][char] then
n = n -1
else
match = false break
@@ -8942,23 +8929,23 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
end
elseif id == disc then
-- skip 'm
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n -1
else
match = false break
end
prev = prev.prev
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n -1
else
match = false break
end
end
elseif f == 2 then
- match = sequence[1][32]
+ match = seq[1][32]
else
for n=f-1,1 do
- if not sequence[n][32] then
+ if not seq[n][32] then
match = false break
end
end
@@ -8983,7 +8970,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if trace_skips then
show_skip(kind,chainname,char,ck,class)
end
- elseif sequence[n][char] then
+ elseif seq[n][char] then
n = n + 1
else
match = false break
@@ -8996,23 +8983,23 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
end
elseif id == disc then
-- skip 'm
- elseif sequence[n][32] then -- brrr
+ elseif seq[n][32] then -- brrr
n = n + 1
else
match = false break
end
current = current.next
- elseif sequence[n][32] then
+ elseif seq[n][32] then
n = n + 1
else
match = false break
end
end
elseif s-l == 1 then
- match = sequence[s][32]
+ match = seq[s][32]
else
for n=l+1,s do
- if not sequence[n][32] then
+ if not seq[n][32] then
match = false break
end
end
@@ -9022,7 +9009,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
if match then
-- ck == currentcontext
if trace_contexts then
- local rule, lookuptype, sequence, f, l = ck[1], ck[2] ,ck[3], ck[4], ck[5]
+ local rule, lookuptype, f, l = ck[1], ck[2], ck[4], ck[5]
local char = start.char
if ck[9] then
logwarning("%s: rule %s matches at char %s for (%s,%s,%s) chars, lookuptype %s (%s=>%s)",cref(kind,chainname),rule,gref(char),f-1,l-f+1,s-l,lookuptype,ck[9],ck[10])
@@ -9039,7 +9026,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
local chainlookup = lookuptable[chainlookupname]
local cp = chainprocs[chainlookup.type]
if cp then
- start, done = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname)
+ start, done = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,nil,sequence)
else
logprocess("%s: %s is not yet supported",cref(kind,chainname,chainlookupname),chainlookup.type)
end
@@ -9052,7 +9039,7 @@ local function normal_handle_contextchain(start,kind,chainname,contexts,sequence
local cp = chainmores[chainlookup.type]
if cp then
local ok, n
- start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i)
+ start, ok, n = cp(start,last,kind,chainname,ck,cache,chainlookup,chainlookupname,i,sequence)
-- messy since last can be changed !
if ok then
done = true
@@ -9071,7 +9058,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,cache,replacements)
+ start, done = chainprocs.reversesub(start,last,kind,chainname,ck,cache,replacements) -- sequence
else
done = true -- can be meant to be skipped
if trace_contexts then