summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-06-27 18:48:11 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-06-27 18:48:11 +0200
commitf8d48a62bd62df77685bd8581c1b8311ae26525f (patch)
tree56d8e9d605c1877d2f1c14b878c962d29d52cc9f /tex/generic
parent5c9b859165af46407543b25589ce8852ee079620 (diff)
downloadcontext-f8d48a62bd62df77685bd8581c1b8311ae26525f.tar.gz
2017-06-27 18:10:00
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-basics-nod.lua19
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua198
2 files changed, 113 insertions, 104 deletions
diff --git a/tex/generic/context/luatex/luatex-basics-nod.lua b/tex/generic/context/luatex/luatex-basics-nod.lua
index 35fc96b48..e2d91af41 100644
--- a/tex/generic/context/luatex/luatex-basics-nod.lua
+++ b/tex/generic/context/luatex/luatex-basics-nod.lua
@@ -48,7 +48,6 @@ end
-- Nodes (a subset of context so that we don't get too much unused code):
nodes = { }
-nodes.pool = { }
nodes.handlers = { }
local nodecodes = { }
@@ -73,7 +72,6 @@ nodes.disccodes = disccodes
local flush_node = node.flush_node
local remove_node = node.remove
-local new_node = node.new
local traverse_id = node.traverse_id
nodes.handlers.protectglyphs = node.protect_glyphs
@@ -108,12 +106,6 @@ function nodes.delete(head,current)
return nodes.remove(head,current,true)
end
-function nodes.pool.kern(k)
- local n = new_node("kern",1)
- n.kern = k
- return n
-end
-
local getfield = node.getfield
local setfield = node.setfield
@@ -294,20 +286,11 @@ nuts.traverse_id = direct.traverse_id
nuts.traverse_char = direct.traverse_char
nuts.ligaturing = direct.ligaturing
nuts.kerning = direct.kerning
+nuts.new = direct.new
nuts.getprop = nuts.getattr
nuts.setprop = nuts.setattr
-local new_nut = direct.new
-nuts.new = new_nut
-nuts.pool = { }
-
-function nuts.pool.kern(k)
- local n = new_nut("kern",1)
- setfield(n,"kern",k)
- return n
-end
-
-- properties as used in the (new) injector:
local propertydata = direct.get_properties_table()
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 43577b42c..5d67d8059 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 : 06/21/17 23:03:59
+-- merge date : 06/27/17 18:05:12
do -- begin closure to overcome local limits and interference
@@ -4966,7 +4966,6 @@ attributes.private=attributes.private or function(name)
return number
end
nodes={}
-nodes.pool={}
nodes.handlers={}
local nodecodes={}
local glyphcodes=node.subtypes("glyph")
@@ -4987,7 +4986,6 @@ nodes.glyphcodes=glyphcodes
nodes.disccodes=disccodes
local flush_node=node.flush_node
local remove_node=node.remove
-local new_node=node.new
local traverse_id=node.traverse_id
nodes.handlers.protectglyphs=node.protect_glyphs
nodes.handlers.unprotectglyphs=node.unprotect_glyphs
@@ -5016,11 +5014,6 @@ end
function nodes.delete(head,current)
return nodes.remove(head,current,true)
end
-function nodes.pool.kern(k)
- local n=new_node("kern",1)
- n.kern=k
- return n
-end
local getfield=node.getfield
local setfield=node.setfield
nodes.getfield=getfield
@@ -5172,16 +5165,9 @@ nuts.traverse_id=direct.traverse_id
nuts.traverse_char=direct.traverse_char
nuts.ligaturing=direct.ligaturing
nuts.kerning=direct.kerning
+nuts.new=direct.new
nuts.getprop=nuts.getattr
nuts.setprop=nuts.setattr
-local new_nut=direct.new
-nuts.new=new_nut
-nuts.pool={}
-function nuts.pool.kern(k)
- local n=new_nut("kern",1)
- setfield(n,"kern",k)
- return n
-end
local propertydata=direct.get_properties_table()
nodes.properties={ data=propertydata }
direct.set_properties_mode(true,true)
@@ -20547,7 +20533,6 @@ local kern_code=nodecodes.kern
local glue_code=nodecodes.glue
local nuts=nodes.nuts
local nodepool=nuts.pool
-local newkern=nodepool.kern
local tonode=nuts.tonode
local tonut=nuts.tonut
local getfield=nuts.getfield
@@ -20573,9 +20558,18 @@ local traverse_char=nuts.traverse_char
local insert_node_before=nuts.insert_before
local insert_node_after=nuts.insert_after
local properties=nodes.properties.data
-function injections.installnewkern(nk)
- newkern=nk or newkern
-end
+local fontkern=nuts.pool and nuts.pool.fontkern
+do if not fontkern then
+ local thekern=nuts.new("kern",0)
+ local setkern=nuts.setkern
+ local copy_node=nuts.copy_node
+ fontkern=function(k)
+ local n=copy_node(thekern)
+ setkern(n,k)
+ return n
+ end
+end end
+function injections.installnewkern() end
local nofregisteredkerns=0
local nofregisteredpairs=0
local nofregisteredmarks=0
@@ -20778,21 +20772,40 @@ function injections.setkern(current,factor,rlmode,x,injection)
if not injection then
injection="injections"
end
- if p then
- local i=rawget(p,injection)
- if i then
- i.leftkern=dx+(i.leftkern or 0)
+ if rlmode and rlmode<0 then
+ if p then
+ local i=rawget(p,injection)
+ if i then
+ i.rightkern=dx+(i.rightkern or 0)
+ else
+ p[injection]={
+ rightkern=dx,
+ }
+ end
else
- p[injection]={
- leftkern=dx,
+ properties[current]={
+ [injection]={
+ rightkern=dx,
+ },
}
end
else
- properties[current]={
- [injection]={
- leftkern=dx,
- },
- }
+ 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
@@ -20980,7 +20993,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- head=insert_node_before(head,current,newkern(leftkern))
+ head=insert_node_before(head,current,fontkern(leftkern))
end
end
if prevdisc then
@@ -20990,7 +21003,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(posttail,newkern(leftkern))
+ setlink(posttail,fontkern(leftkern))
done=true
end
end
@@ -21000,7 +21013,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(replacetail,newkern(leftkern))
+ setlink(replacetail,fontkern(leftkern))
done=true
end
end
@@ -21009,7 +21022,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setfield(prev,"replace",newkern(leftkern))
+ setfield(prev,"replace",fontkern(leftkern))
end
end
end
@@ -21034,7 +21047,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,newkern(leftkern))
+ pre=insert_node_before(pre,n,fontkern(leftkern))
done=true
end
end
@@ -21049,7 +21062,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,newkern(leftkern))
+ post=insert_node_before(post,n,fontkern(leftkern))
done=true
end
end
@@ -21064,7 +21077,7 @@ local function inject_kerns_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,newkern(leftkern))
+ replace=insert_node_before(replace,n,fontkern(leftkern))
done=true
end
end
@@ -21123,11 +21136,11 @@ local function inject_pairs_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- head=insert_node_before(head,current,newkern(leftkern))
+ head=insert_node_before(head,current,fontkern(leftkern))
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(head,current,newkern(rightkern))
+ insert_node_after(head,current,fontkern(rightkern))
end
else
local i=p.emptyinjections
@@ -21137,7 +21150,7 @@ local function inject_pairs_only(head,where)
if next and getid(next)==disc_code then
if replace then
else
- setfield(next,"replace",newkern(rightkern))
+ setfield(next,"replace",fontkern(rightkern))
end
end
end
@@ -21150,7 +21163,7 @@ local function inject_pairs_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(posttail,newkern(leftkern))
+ setlink(posttail,fontkern(leftkern))
done=true
end
end
@@ -21160,7 +21173,7 @@ local function inject_pairs_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(replacetail,newkern(leftkern))
+ setlink(replacetail,fontkern(leftkern))
done=true
end
end
@@ -21169,7 +21182,7 @@ local function inject_pairs_only(head,where)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setfield(prev,"replace",newkern(leftkern))
+ setfield(prev,"replace",fontkern(leftkern))
end
end
end
@@ -21198,12 +21211,12 @@ local function inject_pairs_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,newkern(leftkern))
+ pre=insert_node_before(pre,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(pre,n,newkern(rightkern))
+ insert_node_after(pre,n,fontkern(rightkern))
done=true
end
end
@@ -21222,12 +21235,12 @@ local function inject_pairs_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,newkern(leftkern))
+ post=insert_node_before(post,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(post,n,newkern(rightkern))
+ insert_node_after(post,n,fontkern(rightkern))
done=true
end
end
@@ -21246,12 +21259,12 @@ local function inject_pairs_only(head,where)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,newkern(leftkern))
+ replace=insert_node_before(replace,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(replace,n,newkern(rightkern))
+ insert_node_after(replace,n,fontkern(rightkern))
done=true
end
end
@@ -21266,7 +21279,7 @@ local function inject_pairs_only(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- pre=insert_node_before(pre,pre,newkern(rightkern))
+ pre=insert_node_before(pre,pre,fontkern(rightkern))
done=true
end
end
@@ -21279,7 +21292,7 @@ local function inject_pairs_only(head,where)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- replace=insert_node_before(replace,replace,newkern(rightkern))
+ replace=insert_node_before(replace,replace,fontkern(rightkern))
done=true
end
end
@@ -21371,7 +21384,9 @@ local function inject_everything(head,where)
else
if pn.markdir<0 then
ox=px-pn.markx
-+(pn.leftkern or 0)
+if not pn.markmark then
+ ox=ox+(pn.leftkern or 0)
+end
else
ox=px-pn.markx
end
@@ -21382,13 +21397,15 @@ local function inject_everything(head,where)
if trace_injections then
report_injections("correcting non zero width mark %C",getchar(n))
end
- insert_node_before(n,n,newkern(-wn))
- insert_node_after(n,n,newkern(-wn))
+ insert_node_before(n,n,fontkern(-wn))
+ insert_node_after(n,n,fontkern(-wn))
end
end
end
local oy=ny+py+pn.marky
-oy=oy+(pn.yoffset or 0)
+if not pn.markmark then
+ oy=oy+(pn.yoffset or 0)
+end
setoffsets(n,ox,oy)
if trace_marks then
showoffset(n,true)
@@ -21464,11 +21481,11 @@ oy=oy+(pn.yoffset or 0)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- head=insert_node_before(head,current,newkern(leftkern))
+ head=insert_node_before(head,current,fontkern(leftkern))
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(head,current,newkern(rightkern))
+ insert_node_after(head,current,fontkern(rightkern))
end
end
else
@@ -21479,7 +21496,7 @@ oy=oy+(pn.yoffset or 0)
if next and getid(next)==disc_code then
if replace then
else
- setfield(next,"replace",newkern(rightkern))
+ setfield(next,"replace",fontkern(rightkern))
end
end
end
@@ -21493,7 +21510,7 @@ oy=oy+(pn.yoffset or 0)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(posttail,newkern(leftkern))
+ setlink(posttail,fontkern(leftkern))
done=true
end
end
@@ -21503,7 +21520,7 @@ oy=oy+(pn.yoffset or 0)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setlink(replacetail,newkern(leftkern))
+ setlink(replacetail,fontkern(leftkern))
done=true
end
end
@@ -21512,7 +21529,7 @@ oy=oy+(pn.yoffset or 0)
if i then
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- setfield(prev,"replace",newkern(leftkern))
+ setfield(prev,"replace",fontkern(leftkern))
end
end
end
@@ -21554,12 +21571,12 @@ oy=oy+(pn.yoffset or 0)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- pre=insert_node_before(pre,n,newkern(leftkern))
+ pre=insert_node_before(pre,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(pre,n,newkern(rightkern))
+ insert_node_after(pre,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -21584,12 +21601,12 @@ oy=oy+(pn.yoffset or 0)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- post=insert_node_before(post,n,newkern(leftkern))
+ post=insert_node_before(post,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(post,n,newkern(rightkern))
+ insert_node_after(post,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -21614,12 +21631,12 @@ oy=oy+(pn.yoffset or 0)
end
local leftkern=i.leftkern
if leftkern and leftkern~=0 then
- replace=insert_node_before(replace,n,newkern(leftkern))
+ replace=insert_node_before(replace,n,fontkern(leftkern))
done=true
end
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- insert_node_after(replace,n,newkern(rightkern))
+ insert_node_after(replace,n,fontkern(rightkern))
done=true
end
if hasmarks then
@@ -21640,7 +21657,7 @@ oy=oy+(pn.yoffset or 0)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- pre=insert_node_before(pre,pre,newkern(rightkern))
+ pre=insert_node_before(pre,pre,fontkern(rightkern))
done=true
end
end
@@ -21653,7 +21670,7 @@ oy=oy+(pn.yoffset or 0)
if i then
local rightkern=i.rightkern
if rightkern and rightkern~=0 then
- replace=insert_node_before(replace,replace,newkern(rightkern))
+ replace=insert_node_before(replace,replace,fontkern(rightkern))
done=true
end
end
@@ -22393,8 +22410,8 @@ end
local function logwarning(...)
report_direct(...)
end
-local f_unicode=formatters["%U"]
-local f_uniname=formatters["%U (%s)"]
+local f_unicode=formatters["U+%X"]
+local f_uniname=formatters["U+%X (%s)"]
local f_unilist=formatters["% t (% t)"]
local function gref(n)
if type(n)=="number" then
@@ -22944,8 +22961,8 @@ function handlers.gpos_mark2base(head,start,dataset,sequence,markanchors,rlmode)
local ma=markanchors[2]
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%p,%p)",
- pref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy)
+ logprocess("%s, bound %s, anchoring mark %s to basechar %s => (%p,%p)",
+ pref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
end
return head,start,true
elseif trace_bugs then
@@ -23001,8 +23018,8 @@ function handlers.gpos_mark2ligature(head,start,dataset,sequence,markanchors,rlm
if ba then
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, index %s, bound %s: anchoring mark %s to baselig %s at index %s => (%p,%p)",
- pref(dataset,sequence),anchor,index,bound,gref(markchar),gref(basechar),index,dx,dy)
+ logprocess("%s, index %s, bound %s, anchoring mark %s to baselig %s at index %s => (%p,%p)",
+ pref(dataset,sequence),index,bound,gref(markchar),gref(basechar),index,dx,dy)
end
return head,start,true
else
@@ -23048,8 +23065,8 @@ function handlers.gpos_mark2mark(head,start,dataset,sequence,markanchors,rlmode)
local ma=markanchors[2]
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],true,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)",
- pref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy)
+ logprocess("%s, bound %s, anchoring mark %s to basemark %s => (%p,%p)",
+ pref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
end
return head,start,true
end
@@ -23456,8 +23473,8 @@ function chainprocs.gpos_mark2base(head,start,stop,dataset,sequence,currentlooku
if ma then
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, bound %s: anchoring mark %s to basechar %s => (%p,%p)",
- cref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy)
+ logprocess("%s, bound %s, anchoring mark %s to basechar %s => (%p,%p)",
+ cref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
end
return head,start,true
end
@@ -23526,8 +23543,8 @@ function chainprocs.gpos_mark2ligature(head,start,stop,dataset,sequence,currentl
if ba then
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],false,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, bound %s: anchoring mark %s to baselig %s at index %s => (%p,%p)",
- cref(dataset,sequence),anchor,a or bound,gref(markchar),gref(basechar),index,dx,dy)
+ logprocess("%s, bound %s, anchoring mark %s to baselig %s at index %s => (%p,%p)",
+ cref(dataset,sequence),a or bound,gref(markchar),gref(basechar),index,dx,dy)
end
return head,start,true
end
@@ -23582,8 +23599,8 @@ function chainprocs.gpos_mark2mark(head,start,stop,dataset,sequence,currentlooku
if ma then
local dx,dy,bound=setmark(start,base,factor,rlmode,ba,ma,characters[basechar],true,checkmarks)
if trace_marks then
- logprocess("%s, anchor %s, bound %s: anchoring mark %s to basemark %s => (%p,%p)",
- cref(dataset,sequence),anchor,bound,gref(markchar),gref(basechar),dx,dy)
+ logprocess("%s, bound %s, anchoring mark %s to basemark %s => (%p,%p)",
+ cref(dataset,sequence),bound,gref(markchar),gref(basechar),dx,dy)
end
return head,start,true
end
@@ -23657,12 +23674,21 @@ end
local function show_skip(dataset,sequence,char,ck,class)
logwarning("%s: skipping char %s, class %a, rule %a, lookuptype %a",cref(dataset,sequence),gref(char),class,ck[1],ck[8] or ck[2])
end
-local new_kern=nuts.pool.kern
+local userkern=nuts.pool and nuts.pool.newkern
+do if not userkern then
+ local thekern=nuts.new("kern",1)
+ local setkern=nuts.setkern
+ userkern=function(k)
+ local n=copy_node(thekern)
+ setkern(n,k)
+ return n
+ end
+end end
local function checked(head)
local current=head
while current do
if getid(current)==glue_code then
- local kern=new_kern(getwidth(current))
+ local kern=userkern(getwidth(current))
if head==current then
local next=getnext(current)
if next then