From 330909ad62342ff873dc758b909968c66d0252a4 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 16 May 2021 11:46:45 +0200 Subject: 2021-05-15 22:44:00 --- tex/generic/context/luatex/luatex-basics-nod.lua | 221 ++++++------- tex/generic/context/luatex/luatex-fonts-gbn.lua | 44 +-- tex/generic/context/luatex/luatex-fonts-merged.lua | 355 +++++++++++---------- 3 files changed, 326 insertions(+), 294 deletions(-) (limited to 'tex/generic') diff --git a/tex/generic/context/luatex/luatex-basics-nod.lua b/tex/generic/context/luatex/luatex-basics-nod.lua index 25f5473a5..76e36f2aa 100644 --- a/tex/generic/context/luatex/luatex-basics-nod.lua +++ b/tex/generic/context/luatex/luatex-basics-nod.lua @@ -71,8 +71,8 @@ nodes.glyphcodes = glyphcodes nodes.disccodes = disccodes nodes.dirvalues = { lefttoright = 0, righttoleft = 1 } -nodes.handlers.protectglyphs = node.protect_glyphs -- beware: nodes! -nodes.handlers.unprotectglyphs = node.unprotect_glyphs -- beware: nodes! +nodes.handlers.protectglyphs = node.protectglyphs or node.protect_glyphs -- beware: nodes! +nodes.handlers.unprotectglyphs = node.unprotectglyphs or node.unprotect_glyphs -- beware: nodes! -- in generic code, at least for some time, we stay nodes, while in context -- we can go nuts (e.g. experimental); this split permits us us keep code @@ -81,84 +81,85 @@ nodes.handlers.unprotectglyphs = node.unprotect_glyphs -- beware: nodes! -- much of this will go away .. it's part of the context interface and not -- officially in luatex-*.lua -local direct = node.direct -local nuts = { } -nodes.nuts = nuts - -local tonode = direct.tonode -local tonut = direct.todirect - -nodes.tonode = tonode -nodes.tonut = tonut - -nuts.tonode = tonode -nuts.tonut = tonut - -nuts.getattr = direct.get_attribute -nuts.getboth = direct.getboth -nuts.getchar = direct.getchar -nuts.getdirection = direct.getdirection -nuts.getdisc = direct.getdisc -nuts.getreplace = direct.getreplace -nuts.getfield = direct.getfield -nuts.getfont = direct.getfont -nuts.getid = direct.getid -nuts.getkern = direct.getkern -nuts.getlist = direct.getlist -nuts.getnext = direct.getnext -nuts.getoffsets = direct.getoffsets -nuts.getoptions = direct.getoptions or function() return 0 end -nuts.getprev = direct.getprev -nuts.getsubtype = direct.getsubtype -nuts.getwidth = direct.getwidth -nuts.setattr = direct.setfield -nuts.setboth = direct.setboth -nuts.setchar = direct.setchar -nuts.setcomponents = direct.setcomponents -nuts.setdirection = direct.setdirection -nuts.setdisc = direct.setdisc -nuts.setreplace = direct.setreplace -nuts.setfield = setfield -nuts.setkern = direct.setkern -nuts.setlink = direct.setlink -nuts.setlist = direct.setlist -nuts.setnext = direct.setnext -nuts.setoffsets = direct.setoffsets -nuts.setprev = direct.setprev -nuts.setsplit = direct.setsplit -nuts.setsubtype = direct.setsubtype -nuts.setwidth = direct.setwidth - -nuts.getglyphdata = nuts.getattr -nuts.setglyphdata = nuts.setattr - -nuts.ischar = direct.is_char -nuts.isglyph = direct.is_glyph - -nuts.copy = direct.copy -nuts.copy_list = direct.copy_list -nuts.copy_node = direct.copy -nuts.end_of_math = direct.end_of_math -nuts.flush = direct.flush -nuts.flush_list = direct.flush_list -nuts.flush_node = direct.flush_node -nuts.free = direct.free -nuts.insert_after = direct.insert_after -nuts.insert_before = direct.insert_before -nuts.is_node = direct.is_node -nuts.kerning = direct.kerning -nuts.ligaturing = direct.ligaturing -nuts.new = direct.new -nuts.remove = direct.remove -nuts.tail = direct.tail -nuts.traverse = direct.traverse -nuts.traverse_char = direct.traverse_char -nuts.traverse_glyph = direct.traverse_glyph -nuts.traverse_id = direct.traverse_id +local direct = node.direct +local nuts = { } +nodes.nuts = nuts + +local tonode = direct.tonode +local tonut = direct.todirect + +nodes.tonode = tonode +nodes.tonut = tonut + +nuts.tonode = tonode +nuts.tonut = tonut + +nuts.getattr = direct.get_attribute +nuts.getboth = direct.getboth +nuts.getchar = direct.getchar +nuts.getdirection = direct.getdirection +nuts.getdisc = direct.getdisc +nuts.getreplace = direct.getreplace +nuts.getfield = direct.getfield +nuts.getfont = direct.getfont +nuts.getid = direct.getid +nuts.getkern = direct.getkern +nuts.getlist = direct.getlist +nuts.getnext = direct.getnext +nuts.getoffsets = direct.getoffsets +nuts.getoptions = direct.getoptions or function() return 0 end +nuts.getprev = direct.getprev +nuts.getsubtype = direct.getsubtype +nuts.getwidth = direct.getwidth +nuts.setattr = direct.setfield +nuts.setboth = direct.setboth +nuts.setchar = direct.setchar +nuts.setcomponents = direct.setcomponents +nuts.setdirection = direct.setdirection +nuts.setdisc = direct.setdisc +nuts.setreplace = direct.setreplace +nuts.setfield = setfield +nuts.setkern = direct.setkern +nuts.setlink = direct.setlink +nuts.setlist = direct.setlist +nuts.setnext = direct.setnext +nuts.setoffsets = direct.setoffsets +nuts.setprev = direct.setprev +nuts.setsplit = direct.setsplit +nuts.setsubtype = direct.setsubtype +nuts.setwidth = direct.setwidth + +nuts.getglyphdata = nuts.getattribute or nuts.getattr +nuts.setglyphdata = nuts.setattribute or nuts.setattr + +nuts.ischar = direct.ischar or direct.is_char +nuts.isglyph = direct.isglyph or direct.is_glyph +nuts.copy = direct.copy +nuts.copynode = direct.copy +nuts.copylist = direct.copylist or direct.copy_list +nuts.endofmath = direct.endofmath or direct.end_of_math +nuts.flush = direct.flush +nuts.flushlist = direct.flushlist or direct.flush_list +nuts.flushnode = direct.flushnode or direct.flush_node +nuts.free = direct.free +nuts.insertafter = direct.insertafter or direct.insert_after +nuts.insertbefore = direct.insertbefore or direct.insert_before +nuts.isnode = direct.isnode or direct.is_node +nuts.isdirect = direct.isdirect or direct.is_direct +nuts.isnut = direct.isdirect or direct.is_direct +nuts.kerning = direct.kerning +nuts.ligaturing = direct.ligaturing +nuts.new = direct.new +nuts.remove = direct.remove +nuts.tail = direct.tail +nuts.traverse = direct.traverse +nuts.traversechar = direct.traversechar or direct.traverse_char +nuts.traverseglyph = direct.traverseglyph or direct.traverse_glyph +nuts.traverseid = direct.traverseid or direct.traverse_id -- properties as used in the (new) injector: -local propertydata = direct.get_properties_table() +local propertydata = (direct.getpropertiestable or direct.get_properties_table)() nodes.properties = { data = propertydata } if direct.set_properties_mode then @@ -199,10 +200,10 @@ local setfield = nuts.setfield local getsubtype = nuts.getsubtype local isglyph = nuts.isglyph local find_tail = nuts.tail -local flush_list = nuts.flush_list -local flush_node = nuts.flush_node -local traverse_id = nuts.traverse_id -local copy_node = nuts.copy_node +local flushlist = nuts.flushlist +local flushnode = nuts.flushnode +local traverseid = nuts.traverseid +local copynode = nuts.copynode local glyph_code = nodes.nodecodes.glyph local ligature_code = nodes.glyphcodes.ligature @@ -222,22 +223,22 @@ end do - local get_components = node.direct.getcomponents - local set_components = node.direct.setcomponents + local getcomponents = node.direct.getcomponents + local setcomponents = node.direct.setcomponents - local function copy_no_components(g,copyinjection) - local components = get_components(g) + local function copynocomponents(g,copyinjection) + local components = getcomponents(g) if components then - set_components(g) - local n = copy_node(g) + setcomponents(g) + local n = copynode(g) if copyinjection then copyinjection(n,g) end - set_components(g,components) + setcomponents(g,components) -- maybe also upgrade the subtype but we don't use it anyway return n else - local n = copy_node(g) + local n = copynode(g) if copyinjection then copyinjection(n,g) end @@ -245,11 +246,11 @@ do end end - local function copy_only_glyphs(current) + local function copyonlyglyphs(current) local head = nil local previous = nil - for n in traverse_id(glyph_code,current) do - n = copy_node(n) + for n in traverseid(glyph_code,current) do + n = copynode(n) if head then setlink(previous,n) else @@ -260,14 +261,14 @@ do return head end - local function count_components(start,marks) + local function countcomponents(start,marks) local char = isglyph(start) if char then if getsubtype(start) == ligature_code then local n = 0 - local components = get_components(start) + local components = getcomponents(start) while components do - n = n + count_components(components,marks) + n = n + countcomponents(components,marks) components = getnext(components) end return n @@ -278,20 +279,22 @@ do return 0 end - local function flush_components() + local function flushcomponents() -- this is a no-op in mkiv / generic end - nuts.set_components = set_components - nuts.get_components = get_components - nuts.copy_only_glyphs = copy_only_glyphs - nuts.copy_no_components = copy_no_components - nuts.count_components = count_components - nuts.flush_components = flush_components + nuts.components = { + set = setcomponents, + get = getcomponents, + copyonlyglyphs = copyonlyglyphs, + copynocomponents = copynocomponents, + count = countcomponents, + flush = flushcomponents, + } end -nuts.uses_font = direct.uses_font +nuts.usesfont = direct.usesfont or direct.uses_font do @@ -301,12 +304,12 @@ do local dummy = tonut(node.new("glyph")) nuts.traversers = { - glyph = nuts.traverse_id(nodecodes.glyph,dummy), - glue = nuts.traverse_id(nodecodes.glue,dummy), - disc = nuts.traverse_id(nodecodes.disc,dummy), - boundary = nuts.traverse_id(nodecodes.boundary,dummy), + glyph = nuts.traverseid(nodecodes.glyph,dummy), + glue = nuts.traverseid(nodecodes.glue,dummy), + disc = nuts.traverseid(nodecodes.disc,dummy), + boundary = nuts.traverseid(nodecodes.boundary,dummy), - char = nuts.traverse_char(dummy), + char = nuts.traversechar(dummy), node = nuts.traverse(dummy), } @@ -333,7 +336,7 @@ do local getsubtype = nuts.getsubtype - function nuts.start_of_par(n) + function nuts.startofpar(n) local s = getsubtype(n) return s == 0 or s == 2 -- sorry, hardcoded, won't change anyway end diff --git a/tex/generic/context/luatex/luatex-fonts-gbn.lua b/tex/generic/context/luatex/luatex-fonts-gbn.lua index 53be41c7e..d690ee567 100644 --- a/tex/generic/context/luatex/luatex-fonts-gbn.lua +++ b/tex/generic/context/luatex/luatex-fonts-gbn.lua @@ -17,27 +17,27 @@ local next = next local fonts = fonts local nodes = nodes -local nuts = nodes.nuts -- context abstraction of direct nodes +local nuts = nodes.nuts -- context abstraction of direct nodes -local traverse_id = nuts.traverse_id -local flush_node = nuts.flush_node +local traverseid = nuts.traverseid +local flushnode = nuts.flushnode -local glyph_code = nodes.nodecodes.glyph -local disc_code = nodes.nodecodes.disc +local glyph_code = nodes.nodecodes.glyph +local disc_code = nodes.nodecodes.disc -local tonode = nuts.tonode -local tonut = nuts.tonut +local tonode = nuts.tonode +local tonut = nuts.tonut -local getfont = nuts.getfont -local getchar = nuts.getchar -local getid = nuts.getid -local getboth = nuts.getboth -local getprev = nuts.getprev -local getnext = nuts.getnext -local getdisc = nuts.getdisc -local setchar = nuts.setchar -local setlink = nuts.setlink -local setprev = nuts.setprev +local getfont = nuts.getfont +local getchar = nuts.getchar +local getid = nuts.getid +local getboth = nuts.getboth +local getprev = nuts.getprev +local getnext = nuts.getnext +local getdisc = nuts.getdisc +local setchar = nuts.setchar +local setlink = nuts.setlink +local setprev = nuts.setprev -- from now on we apply ligaturing and kerning here because it might interfere with complex -- opentype discretionary handling where the base ligature pass expect some weird extra @@ -99,7 +99,7 @@ local function nodepass(head,groupcode,size,packtype,direction) local variants = nil local redundant = nil local nofused = 0 - for n in traverse_id(glyph_code,head) do + for n in traverseid(glyph_code,head) do local font = getfont(n) if font ~= prevfont then if basefont then @@ -178,13 +178,13 @@ local function nodepass(head,groupcode,size,packtype,direction) end end end - flush_node(r) + flushnode(r) end end - for d in traverse_id(disc_code,head) do + for d in traverseid(disc_code,head) do local _, _, r = getdisc(d) if r then - for n in traverse_id(glyph_code,r) do + for n in traverseid(glyph_code,r) do local font = getfont(n) if font ~= prevfont then prevfont = font @@ -254,7 +254,7 @@ local function basepass(head) return head end -local protectpass = node.direct.protect_glyphs +local protectpass = node.direct.protectglyphs or node.direct.protect_glyphs local injectpass = nodes.injections.handler -- This is the only official public interface and this one can be hooked into a callback (chain) and diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 386529b1a..267c8361b 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 : 2021-05-09 17:12 +-- merge date : 2021-05-15 22:41 do -- begin closure to overcome local limits and interference @@ -4961,8 +4961,8 @@ nodes.nodecodes=nodecodes nodes.glyphcodes=glyphcodes nodes.disccodes=disccodes nodes.dirvalues={ lefttoright=0,righttoleft=1 } -nodes.handlers.protectglyphs=node.protect_glyphs -nodes.handlers.unprotectglyphs=node.unprotect_glyphs +nodes.handlers.protectglyphs=node.protectglyphs or node.protect_glyphs +nodes.handlers.unprotectglyphs=node.unprotectglyphs or node.unprotect_glyphs local direct=node.direct local nuts={} nodes.nuts=nuts @@ -5006,31 +5006,33 @@ nuts.setprev=direct.setprev nuts.setsplit=direct.setsplit nuts.setsubtype=direct.setsubtype nuts.setwidth=direct.setwidth -nuts.getglyphdata=nuts.getattr -nuts.setglyphdata=nuts.setattr -nuts.ischar=direct.is_char -nuts.isglyph=direct.is_glyph +nuts.getglyphdata=nuts.getattribute or nuts.getattr +nuts.setglyphdata=nuts.setattribute or nuts.setattr +nuts.ischar=direct.ischar or direct.is_char +nuts.isglyph=direct.isglyph or direct.is_glyph nuts.copy=direct.copy -nuts.copy_list=direct.copy_list -nuts.copy_node=direct.copy -nuts.end_of_math=direct.end_of_math +nuts.copynode=direct.copy +nuts.copylist=direct.copylist or direct.copy_list +nuts.endofmath=direct.endofmath or direct.end_of_math nuts.flush=direct.flush -nuts.flush_list=direct.flush_list -nuts.flush_node=direct.flush_node +nuts.flushlist=direct.flushlist or direct.flush_list +nuts.flushnode=direct.flushnode or direct.flush_node nuts.free=direct.free -nuts.insert_after=direct.insert_after -nuts.insert_before=direct.insert_before -nuts.is_node=direct.is_node +nuts.insertafter=direct.insertafter or direct.insert_after +nuts.insertbefore=direct.insertbefore or direct.insert_before +nuts.isnode=direct.isnode or direct.is_node +nuts.isdirect=direct.isdirect or direct.is_direct +nuts.isnut=direct.isdirect or direct.is_direct nuts.kerning=direct.kerning nuts.ligaturing=direct.ligaturing nuts.new=direct.new nuts.remove=direct.remove nuts.tail=direct.tail nuts.traverse=direct.traverse -nuts.traverse_char=direct.traverse_char -nuts.traverse_glyph=direct.traverse_glyph -nuts.traverse_id=direct.traverse_id -local propertydata=direct.get_properties_table() +nuts.traversechar=direct.traversechar or direct.traverse_char +nuts.traverseglyph=direct.traverseglyph or direct.traverse_glyph +nuts.traverseid=direct.traverseid or direct.traverse_id +local propertydata=(direct.getpropertiestable or direct.get_properties_table)() nodes.properties={ data=propertydata } if direct.set_properties_mode then direct.set_properties_mode(true,true) @@ -5063,10 +5065,10 @@ local setfield=nuts.setfield local getsubtype=nuts.getsubtype local isglyph=nuts.isglyph local find_tail=nuts.tail -local flush_list=nuts.flush_list -local flush_node=nuts.flush_node -local traverse_id=nuts.traverse_id -local copy_node=nuts.copy_node +local flushlist=nuts.flushlist +local flushnode=nuts.flushnode +local traverseid=nuts.traverseid +local copynode=nuts.copynode local glyph_code=nodes.nodecodes.glyph local ligature_code=nodes.glyphcodes.ligature do @@ -5079,31 +5081,31 @@ do end end do - local get_components=node.direct.getcomponents - local set_components=node.direct.setcomponents - local function copy_no_components(g,copyinjection) - local components=get_components(g) + local getcomponents=node.direct.getcomponents + local setcomponents=node.direct.setcomponents + local function copynocomponents(g,copyinjection) + local components=getcomponents(g) if components then - set_components(g) - local n=copy_node(g) + setcomponents(g) + local n=copynode(g) if copyinjection then copyinjection(n,g) end - set_components(g,components) + setcomponents(g,components) return n else - local n=copy_node(g) + local n=copynode(g) if copyinjection then copyinjection(n,g) end return n end end - local function copy_only_glyphs(current) + local function copyonlyglyphs(current) local head=nil local previous=nil - for n in traverse_id(glyph_code,current) do - n=copy_node(n) + for n in traverseid(glyph_code,current) do + n=copynode(n) if head then setlink(previous,n) else @@ -5113,14 +5115,14 @@ do end return head end - local function count_components(start,marks) + local function countcomponents(start,marks) local char=isglyph(start) if char then if getsubtype(start)==ligature_code then local n=0 - local components=get_components(start) + local components=getcomponents(start) while components do - n=n+count_components(components,marks) + n=n+countcomponents(components,marks) components=getnext(components) end return n @@ -5130,24 +5132,26 @@ do end return 0 end - local function flush_components() + local function flushcomponents() end - nuts.set_components=set_components - nuts.get_components=get_components - nuts.copy_only_glyphs=copy_only_glyphs - nuts.copy_no_components=copy_no_components - nuts.count_components=count_components - nuts.flush_components=flush_components + nuts.components={ + set=setcomponents, + get=getcomponents, + copyonlyglyphs=copyonlyglyphs, + copynocomponents=copynocomponents, + count=countcomponents, + flush=flushcomponents, + } end -nuts.uses_font=direct.uses_font +nuts.usesfont=direct.usesfont or direct.uses_font do local dummy=tonut(node.new("glyph")) nuts.traversers={ - glyph=nuts.traverse_id(nodecodes.glyph,dummy), - glue=nuts.traverse_id(nodecodes.glue,dummy), - disc=nuts.traverse_id(nodecodes.disc,dummy), - boundary=nuts.traverse_id(nodecodes.boundary,dummy), - char=nuts.traverse_char(dummy), + glyph=nuts.traverseid(nodecodes.glyph,dummy), + glue=nuts.traverseid(nodecodes.glue,dummy), + disc=nuts.traverseid(nodecodes.disc,dummy), + boundary=nuts.traverseid(nodecodes.boundary,dummy), + char=nuts.traversechar(dummy), node=nuts.traverse(dummy), } end @@ -5164,7 +5168,7 @@ if not nuts.setreplace then end do local getsubtype=nuts.getsubtype - function nuts.start_of_par(n) + function nuts.startofpar(n) local s=getsubtype(n) return s==0 or s==2 end @@ -11798,8 +11802,6 @@ readers.post=function(f,fontdata,specification) if length>0 then glyphs[mapping].name=readstring(f,length) else - report("quit post name fetching at %a of %a: %s",i,maxnames,"overflow") - break end end end @@ -12899,7 +12901,7 @@ if not modules then modules={} end modules ['font-cff']={ } local next,type,tonumber,rawget=next,type,tonumber,rawget local byte,char,gmatch,sub=string.byte,string.char,string.gmatch,string.sub -local concat,remove,unpack=table.concat,table.remove,table.unpack +local concat,insert,remove,unpack=table.concat,table.insert,table.remove,table.unpack local floor,abs,round,ceil,min,max=math.floor,math.abs,math.round,math.ceil,math.min,math.max local P,C,R,S,C,Cs,Ct=lpeg.P,lpeg.C,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Ct local lpegmatch=lpeg.match @@ -14503,8 +14505,34 @@ do showstate(reverse[t] or "") end if top>0 then - for i=1,top do - r=r+1;result[r]=encode[stack[i]] + if t==8 and top>48 then + local n=0 + for i=1,top do + if n==48 then + local zero=encode[0] + local res3=result[r-3] + local res2=result[r-2] + local res1=result[r-1] + local res0=result[r] + result[r-3]=zero + result[r-2]=zero + r=r+1;result[r]=chars[t] + r=r+1;result[r]=zero + r=r+1;result[r]=zero + r=r+1;result[r]=res3 + r=r+1;result[r]=res2 + r=r+1;result[r]=res1 + r=r+1;result[r]=res0 + n=1 + else + n=n+1 + end + r=r+1;result[r]=encode[stack[i]] + end + else + for i=1,top do + r=r+1;result[r]=encode[stack[i]] + end end top=0 end @@ -20830,7 +20858,7 @@ local trace_defining=false registertracker("fonts.defining",function(v) trace_d local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf -otf.version=3.113 +otf.version=3.114 otf.cache=containers.define("fonts","otl",otf.version,true) otf.svgcache=containers.define("fonts","svg",otf.version,true) otf.pngcache=containers.define("fonts","png",otf.version,true) @@ -22030,8 +22058,8 @@ local setwidth=nuts.setwidth local getwidth=nuts.getwidth local nextchar=nuts.traversers.char local nextglue=nuts.traversers.glue -local insert_node_before=nuts.insert_before -local insert_node_after=nuts.insert_after +local insertnodebefore=nuts.insertbefore +local insertnodeafter=nuts.insertafter local properties=nodes.properties.data local fontkern=nuts.pool and nuts.pool.fontkern local italickern=nuts.pool and nuts.pool.italickern @@ -22045,7 +22073,7 @@ end) if not fontkern then local thekern=nuts.new("kern",0) local setkern=nuts.setkern - local copy_node=nuts.copy_node + local copy_node=nuts.copy fontkern=function(k) local n=copy_node(thekern) setkern(n,k) @@ -22055,7 +22083,7 @@ end if not italickern then local thekern=nuts.new("kern",3) local setkern=nuts.setkern - local copy_node=nuts.copy_node + local copy_node=nuts.copy italickern=function(k) local n=copy_node(thekern) setkern(n,k) @@ -22516,12 +22544,12 @@ local function inject_kerns_only(head,where) if leftkern and leftkern~=0 then if prev and getid(prev)==glue_code then if useitalickerns then - head=insert_node_before(head,current,italickern(leftkern)) + head=insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev,getwidth(prev)+leftkern) end else - head=insert_node_before(head,current,fontkern(leftkern)) + head=insertnodebefore(head,current,fontkern(leftkern)) end end end @@ -22575,7 +22603,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,fontkern(leftkern)) + pre=insertnodebefore(pre,n,fontkern(leftkern)) done=true end end @@ -22590,7 +22618,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,fontkern(leftkern)) + post=insertnodebefore(post,n,fontkern(leftkern)) done=true end end @@ -22605,7 +22633,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,fontkern(leftkern)) + replace=insertnodebefore(replace,n,fontkern(leftkern)) done=true end end @@ -22667,23 +22695,23 @@ local function inject_positions_only(head,where) rightkern=0 elseif prev and getid(prev)==glue_code then if useitalickerns then - head=insert_node_before(head,current,italickern(leftkern)) + head=insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev,getwidth(prev)+leftkern) end else - head=insert_node_before(head,current,fontkern(leftkern)) + head=insertnodebefore(head,current,fontkern(leftkern)) end end if rightkern and rightkern~=0 then if next and getid(next)==glue_code then if useitalickerns then - insert_node_after(head,current,italickern(rightkern)) + insertnodeafter(head,current,italickern(rightkern)) else setwidth(next,getwidth(next)+rightkern) end else - insert_node_after(head,current,fontkern(rightkern)) + insertnodeafter(head,current,fontkern(rightkern)) end end else @@ -22757,12 +22785,12 @@ local function inject_positions_only(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - pre=insert_node_before(pre,n,fontkern(leftkern)) + pre=insertnodebefore(pre,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(pre,n,fontkern(rightkern)) + insertnodeafter(pre,n,fontkern(rightkern)) done=true end end @@ -22781,12 +22809,12 @@ local function inject_positions_only(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - post=insert_node_before(post,n,fontkern(leftkern)) + post=insertnodebefore(post,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(post,n,fontkern(rightkern)) + insertnodeafter(post,n,fontkern(rightkern)) done=true end end @@ -22805,12 +22833,12 @@ local function inject_positions_only(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - replace=insert_node_before(replace,n,fontkern(leftkern)) + replace=insertnodebefore(replace,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(replace,n,fontkern(rightkern)) + insertnodeafter(replace,n,fontkern(rightkern)) done=true end end @@ -22825,7 +22853,7 @@ local function inject_positions_only(head,where) if i then local rightkern=i.rightkern if rightkern and rightkern~=0 then - pre=insert_node_before(pre,pre,fontkern(rightkern)) + pre=insertnodebefore(pre,pre,fontkern(rightkern)) done=true end end @@ -22838,7 +22866,7 @@ local function inject_positions_only(head,where) if i then local rightkern=i.rightkern if rightkern and rightkern~=0 then - replace=insert_node_before(replace,replace,fontkern(rightkern)) + replace=insertnodebefore(replace,replace,fontkern(rightkern)) done=true end end @@ -22941,8 +22969,8 @@ 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,fontkern(-wn)) - insert_node_after(n,n,fontkern(-wn)) + insertnodebefore(n,n,fontkern(-wn)) + insertnodeafter(n,n,fontkern(-wn)) end end end @@ -23034,23 +23062,23 @@ local function inject_everything(head,where) rightkern=0 elseif prev and getid(prev)==glue_code then if useitalickerns then - head=insert_node_before(head,current,italickern(leftkern)) + head=insertnodebefore(head,current,italickern(leftkern)) else setwidth(prev,getwidth(prev)+leftkern) end else - head=insert_node_before(head,current,fontkern(leftkern)) + head=insertnodebefore(head,current,fontkern(leftkern)) end end if rightkern and rightkern~=0 then if next and getid(next)==glue_code then if useitalickerns then - insert_node_after(head,current,italickern(rightkern)) + insertnodeafter(head,current,italickern(rightkern)) else setwidth(next,getwidth(next)+rightkern) end else - insert_node_after(head,current,fontkern(rightkern)) + insertnodeafter(head,current,fontkern(rightkern)) end end end @@ -23139,12 +23167,12 @@ local function inject_everything(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - pre=insert_node_before(pre,n,fontkern(leftkern)) + pre=insertnodebefore(pre,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(pre,n,fontkern(rightkern)) + insertnodeafter(pre,n,fontkern(rightkern)) done=true end if hasmarks then @@ -23169,12 +23197,12 @@ local function inject_everything(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - post=insert_node_before(post,n,fontkern(leftkern)) + post=insertnodebefore(post,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(post,n,fontkern(rightkern)) + insertnodeafter(post,n,fontkern(rightkern)) done=true end if hasmarks then @@ -23199,12 +23227,12 @@ local function inject_everything(head,where) end local leftkern=i.leftkern if leftkern and leftkern~=0 then - replace=insert_node_before(replace,n,fontkern(leftkern)) + replace=insertnodebefore(replace,n,fontkern(leftkern)) done=true end local rightkern=i.rightkern if rightkern and rightkern~=0 then - insert_node_after(replace,n,fontkern(rightkern)) + insertnodeafter(replace,n,fontkern(rightkern)) done=true end if hasmarks then @@ -23225,7 +23253,7 @@ local function inject_everything(head,where) if i then local rightkern=i.rightkern if rightkern and rightkern~=0 then - pre=insert_node_before(pre,pre,fontkern(rightkern)) + pre=insertnodebefore(pre,pre,fontkern(rightkern)) done=true end end @@ -23238,7 +23266,7 @@ local function inject_everything(head,where) if i then local rightkern=i.rightkern if rightkern and rightkern~=0 then - replace=insert_node_before(replace,replace,fontkern(rightkern)) + replace=insertnodebefore(replace,replace,fontkern(rightkern)) done=true end end @@ -23384,8 +23412,8 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p + %p] %C",prevchar,lnew,old,rnew,nextchar) end - head=insert_node_before(head,n,italickern(lnew)) - insert_node_after(head,n,italickern(rnew)) + head=insertnodebefore(head,n,italickern(lnew)) + insertnodeafter(head,n,italickern(rnew)) else local new=old+(leftkern+rightkern)*factor if trace_spaces then @@ -23400,7 +23428,7 @@ local function injectspaces(head) if trace_spaces then report_spaces("%C [%p + %p]",prevchar,old,new) end - insert_node_after(head,n,italickern(new)) + insertnodeafter(head,n,italickern(new)) else local new=old+leftkern*factor if trace_spaces then @@ -23419,7 +23447,7 @@ local function injectspaces(head) if trace_spaces then report_spaces("[%p + %p] %C",old,new,nextchar) end - insert_node_after(head,n,italickern(new)) + insertnodeafter(head,n,italickern(new)) else local new=old+rightkern*factor if trace_spaces then @@ -26134,7 +26162,7 @@ local setprop=nuts.setprop local getsubtype=nuts.getsubtype local getchar=nuts.getchar local ischar=nuts.ischar -local end_of_math=nuts.end_of_math +local endofmath=nuts.endofmath local nodecodes=nodes.nodecodes local disc_code=nodecodes.disc local math_code=nodecodes.math @@ -26240,7 +26268,7 @@ function analyzers.setstate(head,font) end first,last,n=nil,nil,0 if id==math_code then - current=end_of_math(current) + current=endofmath(current) end elseif id==disc_code then setstate(current,s_medi) @@ -26253,7 +26281,7 @@ function analyzers.setstate(head,font) end first,last,n=nil,nil,0 if id==math_code then - current=end_of_math(current) + current=endofmath(current) end end current=getnext(current) @@ -26469,7 +26497,7 @@ function methods.arab(head,font,attr) first=nil end if id==math_code then - current=end_of_math(current) + current=endofmath(current) end end current=getnext(current) @@ -26583,7 +26611,7 @@ do wrapup() end if id==math_code then - current=end_of_math(current) + current=endofmath(current) end end current=getnext(current) @@ -26679,23 +26707,24 @@ local setlink=nuts.setlink local getwidth=nuts.getwidth local getattr=nuts.getattr local getglyphdata=nuts.getglyphdata -local copy_no_components=nuts.copy_no_components -local copy_only_glyphs=nuts.copy_only_glyphs -local count_components=nuts.count_components -local set_components=nuts.set_components -local get_components=nuts.get_components -local flush_components=nuts.flush_components +local components=nuts.components +local copynocomponents=components.copynocomponents +local copyonlyglyphs=components.copyonlyglyphs +local countcomponents=components.count +local setcomponents=components.set +local getcomponents=components.get +local flushcomponents=components.flush local ischar=nuts.ischar -local usesfont=nuts.uses_font -local insert_node_after=nuts.insert_after +local usesfont=nuts.usesfont +local insertnodeafter=nuts.insertafter local copy_node=nuts.copy -local copy_node_list=nuts.copy_list +local copy_node_list=nuts.copylist local remove_node=nuts.remove local find_node_tail=nuts.tail -local flush_node_list=nuts.flush_list -local flush_node=nuts.flush_node -local end_of_math=nuts.end_of_math -local start_of_par=nuts.start_of_par +local flushnodelist=nuts.flushlist +local flushnode=nuts.flushnode +local endofmath=nuts.endofmath +local startofpar=nuts.startofpar local setmetatable=setmetatable local setmetatableindex=table.setmetatableindex local nextnode=nuts.traversers.node @@ -26826,12 +26855,12 @@ local function flattendisk(head,disc) local prev,next=getboth(disc) local ishead=head==disc setdisc(disc) - flush_node(disc) + flushnode(disc) if pre then - flush_node_list(pre) + flushnodelist(pre) end if post then - flush_node_list(post) + flushnodelist(post) end if ishead then if replace then @@ -26880,16 +26909,16 @@ local function markstoligature(head,start,stop,char) local next=getnext(stop) setprev(start) setnext(stop) - local base=copy_no_components(start,copyinjection) + local base=copynocomponents(start,copyinjection) if head==start then head=base end resetinjection(base) setchar(base,char) setsubtype(base,ligatureglyph_code) - set_components(base,start) + setcomponents(base,start) setlink(prev,base,next) - flush_components(start) + flushcomponents(start) return head,base end end @@ -26897,7 +26926,7 @@ local no_left_ligature_code=1 local no_right_ligature_code=2 local no_left_kern_code=4 local no_right_kern_code=8 -local has_glyph_option=node.direct.has_glyph_option or function(n,c) +local hasglyphoption=function(n,c) if c==no_left_ligature_code or c==no_right_ligature_code then return getattr(n,a_noligature)==1 else @@ -26905,7 +26934,7 @@ local has_glyph_option=node.direct.has_glyph_option or function(n,c) end end local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfound,hasmarks) - if has_glyph_option(start,no_right_ligature_code) then + if hasglyphoption(start,no_right_ligature_code) then return head,start end if start==stop and getchar(start)==char then @@ -26918,14 +26947,14 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou local comp=start setprev(start) setnext(stop) - local base=copy_no_components(start,copyinjection) + local base=copynocomponents(start,copyinjection) if start==head then head=base end resetinjection(base) setchar(base,char) setsubtype(base,ligatureglyph_code) - set_components(base,comp) + setcomponents(base,comp) setlink(prev,base,next) if not discfound then local deletemarks=not skiphash or hasmarks @@ -26938,7 +26967,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou local char=getchar(start) if not marks[char] then baseindex=baseindex+componentindex - componentindex=count_components(start,marks) + componentindex=countcomponents(start,marks) elseif not deletemarks then setligaindex(start,baseindex+getligaindex(start,componentindex)) if trace_marks then @@ -26946,7 +26975,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end local n=copy_node(start) copyinjection(n,start) - head,current=insert_node_after(head,current,n) + head,current=insertnodeafter(head,current,n) elseif trace_marks then logwarning("%s: delete ligature mark %s",pref(dataset,sequence),gref(char)) end @@ -26969,14 +26998,14 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou break end end - flush_components(components) + flushcomponents(components) else local discprev,discnext=getboth(discfound) if discprev and discnext then local pre,post,replace,pretail,posttail,replacetail=getdisc(discfound,true) if not replace then local prev=getprev(base) - local copied=copy_only_glyphs(comp) + local copied=copyonlyglyphs(comp) if pre then setlink(discprev,pre) else @@ -26992,7 +27021,7 @@ local function toligature(head,start,stop,char,dataset,sequence,skiphash,discfou end setlink(prev,discfound,next) setboth(base) - set_components(base,copied) + setcomponents(base,copied) replace=base if forcediscretionaries then setdisc(discfound,pre,post,replace,discretionarydisc_code) @@ -27016,7 +27045,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) local n=copy_node(start) resetinjection(n) setchar(n,multiple[k]) - insert_node_after(head,start,n) + insertnodeafter(head,start,n) start=n end if what==true then @@ -27026,7 +27055,7 @@ local function multiple_glyphs(head,start,multiple,skiphash,what,stop) local n=copy_node(start) resetinjection(n) setchar(n,m) - insert_node_after(head,start,n) + insertnodeafter(head,start,n) start=n end end @@ -27256,7 +27285,7 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip return head,start,false,false end function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection) - if has_glyph_option(start,no_right_kern_code) then + if hasglyphoption(start,no_right_kern_code) then return head,start,false else local startchar=getchar(start) @@ -27276,7 +27305,7 @@ function handlers.gpos_single(head,start,dataset,sequence,kerns,rlmode,skiphash, end end function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,step,injection) - if has_glyph_option(start,no_right_kern_code) then + if hasglyphoption(start,no_right_kern_code) then return head,start,false else local snext=getnext(start) @@ -27765,7 +27794,7 @@ function chainprocs.gsub_ligature(head,start,stop,dataset,sequence,currentlookup return head,start,false,0,false end function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) - if not has_glyph_option(start,no_right_kern_code) then + if not hasglyphoption(start,no_right_kern_code) then local mapping=currentlookup.mapping if mapping==nil then mapping=getmapping(dataset,sequence,currentlookup) @@ -27793,7 +27822,7 @@ function chainprocs.gpos_single(head,start,stop,dataset,sequence,currentlookup,r return head,start,false end function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash,chainindex) - if not has_glyph_option(start,no_right_kern_code) then + if not hasglyphoption(start,no_right_kern_code) then local mapping=currentlookup.mapping if mapping==nil then mapping=getmapping(dataset,sequence,currentlookup) @@ -28116,13 +28145,13 @@ local function checked(head) if next then setlink(kern,next) end - flush_node(current) + flushnode(current) head=kern current=next else local prev,next=getboth(current) setlink(prev,kern,next) - flush_node(current) + flushnode(current) current=next end else @@ -29673,7 +29702,7 @@ do checkstep(head) end local initialrl=0 - if getid(head)==par_code and start_of_par(head) then + if getid(head)==par_code and startofpar(head) then initialrl=pardirstate(head) elseif direction==righttoleft_code then initialrl=-1 @@ -29790,7 +29819,7 @@ do start=getnext(start) end elseif id==math_code then - start=getnext(end_of_math(start)) + start=getnext(endofmath(start)) elseif id==dir_code then topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode) start=getnext(start) @@ -29860,7 +29889,7 @@ do start=getnext(start) end elseif id==math_code then - start=getnext(end_of_math(start)) + start=getnext(endofmath(start)) elseif id==dir_code then topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode) start=getnext(start) @@ -29938,7 +29967,7 @@ do elseif char==false or id==glue_code then start=getnext(start) elseif id==math_code then - start=getnext(end_of_math(start)) + start=getnext(endofmath(start)) elseif id==dir_code then topstack,rlmode=txtdirstate(start,dirstack,topstack,rlparmode) start=getnext(start) @@ -31026,11 +31055,11 @@ local setprop=nuts.setprop local getstate=nuts.getstate local setstate=nuts.setstate local ischar=nuts.ischar -local insert_node_after=nuts.insert_after +local insertnodeafter=nuts.insertafter local copy_node=nuts.copy local remove_node=nuts.remove -local flush_list=nuts.flush_list -local flush_node=nuts.flush_node +local flushlist=nuts.flushlist +local flushnode=nuts.flushnode local copyinjection=nodes.injections.copy local unsetvalue=attributes.unsetvalue local fontdata=fonts.hashes.identifiers @@ -31655,7 +31684,7 @@ local function inject_syntax_error(head,current,char) else setchar(current,dotted_circle) end - return insert_node_after(head,current,signal) + return insertnodeafter(head,current,signal) end local function initialize_one(font,attr) local tfmdata=fontdata[font] @@ -31773,7 +31802,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) if current==stop then stop=getprev(stop) head=remove_node(head,current) - flush_node(current) + flushnode(current) return head,stop,nbspaces else nbspaces=nbspaces+1 @@ -31803,7 +31832,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) tempcurrent=processcharacters(tempcurrent,font) setstate(tempcurrent,unsetvalue) if getchar(next)==getchar(tempcurrent) then - flush_list(tempcurrent) + flushlist(tempcurrent) if show_syntax_errors then head,current=inject_syntax_error(head,current,char) end @@ -31811,8 +31840,8 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) setchar(current,getchar(tempcurrent)) local freenode=getnext(current) setlink(current,tmp) - flush_node(freenode) - flush_list(tempcurrent) + flushnode(freenode) + flushlist(tempcurrent) if changestop then stop=current end @@ -31939,7 +31968,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) ch=tpm[1] setchar(n,ch) setchar(extra,tpm[2]) - head=insert_node_after(head,current,extra) + head=insertnodeafter(head,current,extra) tpm=twopart_mark[ch] end while c~=stop and dependent_vowel[ch] do @@ -32113,7 +32142,7 @@ local function reorder_one(head,start,stop,font,attr,nbspaces) stop=getprev(stop) end head=remove_node(head,base) - flush_node(base) + flushnode(base) end return head,stop,nbspaces end @@ -32373,7 +32402,7 @@ function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replaceme if head==start then head=stop end - flush_list(start) + flushlist(start) return head,stop,true end local function initialize_two(font,attr) @@ -32518,7 +32547,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) if current==stop then stop=getprev(stop) head=remove_node(head,current) - flush_node(current) + flushnode(current) return head,stop,nbspaces else nbspaces=nbspaces+1 @@ -32615,7 +32644,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) char=tpm[1] setchar(current,char) setchar(extra,tpm[2]) - head=insert_node_after(head,current,extra) + head=insertnodeafter(head,current,extra) tpm=twopart_mark[char] end if not moved[current] and dependent_vowel[char] then @@ -32765,7 +32794,7 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) end nbspaces=nbspaces-1 head=remove_node(head,base) - flush_node(base) + flushnode(base) end return head,stop,nbspaces end @@ -33701,7 +33730,7 @@ end local nofshapes=#svgshapes local f_svgfile=formatters["temp-otf-svg-shape-%i.svg"] local f_pdffile=formatters["temp-otf-svg-shape-%i.pdf"] - local f_convert=formatters["%s --export-%s=%s\n"] + local f_convert=formatters[new and "file-open:%s; export-%s:%s; export-do\n" or "%s --export-%s=%s\n"] local filterglyph=otfsvg.filterglyph local nofdone=0 local processed={} @@ -39451,8 +39480,8 @@ local next=next local fonts=fonts local nodes=nodes local nuts=nodes.nuts -local traverse_id=nuts.traverse_id -local flush_node=nuts.flush_node +local traverseid=nuts.traverseid +local flushnode=nuts.flushnode local glyph_code=nodes.nodecodes.glyph local disc_code=nodes.nodecodes.disc local tonode=nuts.tonode @@ -39511,7 +39540,7 @@ local function nodepass(head,groupcode,size,packtype,direction) local variants=nil local redundant=nil local nofused=0 - for n in traverse_id(glyph_code,head) do + for n in traverseid(glyph_code,head) do local font=getfont(n) if font~=prevfont then if basefont then @@ -39589,13 +39618,13 @@ local function nodepass(head,groupcode,size,packtype,direction) end end end - flush_node(r) + flushnode(r) end end - for d in traverse_id(disc_code,head) do + for d in traverseid(disc_code,head) do local _,_,r=getdisc(d) if r then - for n in traverse_id(glyph_code,r) do + for n in traverseid(glyph_code,r) do local font=getfont(n) if font~=prevfont then prevfont=font @@ -39663,7 +39692,7 @@ local function basepass(head) end return head end -local protectpass=node.direct.protect_glyphs +local protectpass=node.direct.protectglyphs or node.direct.protect_glyphs local injectpass=nodes.injections.handler function nodes.handlers.nodepass(head,...) if head then -- cgit v1.2.3