summaryrefslogtreecommitdiff
path: root/tex/generic/context/luatex/luatex-fonts-merged.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/generic/context/luatex/luatex-fonts-merged.lua')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua517
1 files changed, 305 insertions, 212 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index d470094fc..6a8a418bd 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 : 02/14/19 16:57:24
+-- merge date : 04/04/19 13:31:02
do -- begin closure to overcome local limits and interference
@@ -119,8 +119,7 @@ if not FFISUPPORTED then
elseif not ffi.number then
ffi.number=tonumber
end
-if not bit32 then
- bit32=require("l-bit32")
+if LUAVERSION>5.3 then
end
end -- closure
@@ -1045,7 +1044,7 @@ if not modules then modules={} end modules ['l-table']={
}
local type,next,tostring,tonumber,select=type,next,tostring,tonumber,select
local table,string=table,string
-local concat,sort,insert,remove=table.concat,table.sort,table.insert,table.remove
+local concat,sort=table.concat,table.sort
local format,lower,dump=string.format,string.lower,string.dump
local getmetatable,setmetatable=getmetatable,setmetatable
local lpegmatch,patterns=lpeg.match,lpeg.patterns
@@ -1055,7 +1054,8 @@ function table.getn(t)
return t and #t
end
function table.strip(tab)
- local lst,l={},0
+ local lst={}
+ local l=0
for i=1,#tab do
local s=lpegmatch(stripper,tab[i]) or ""
if s=="" then
@@ -1068,7 +1068,8 @@ function table.strip(tab)
end
function table.keys(t)
if t then
- local keys,k={},0
+ local keys={}
+ local k=0
for key in next,t do
k=k+1
keys[k]=key
@@ -1099,27 +1100,30 @@ local function compare(a,b)
end
local function sortedkeys(tab)
if tab then
- local srt,category,s={},0,0
+ local srt={}
+ local category=0
+ local s=0
for key in next,tab do
s=s+1
srt[s]=key
- if category==3 then
- elseif category==1 then
- if type(key)~="string" then
- category=3
- end
- elseif category==2 then
- if type(key)~="number" then
- category=3
- end
- else
+ if category~=3 then
local tkey=type(key)
- if tkey=="string" then
- category=1
- elseif tkey=="number" then
- category=2
+ if category==1 then
+ if tkey~="string" then
+ category=3
+ end
+ elseif category==2 then
+ if tkey~="number" then
+ category=3
+ end
else
- category=3
+ if tkey=="string" then
+ category=1
+ elseif tkey=="number" then
+ category=2
+ else
+ category=3
+ end
end
end
end
@@ -1136,7 +1140,8 @@ local function sortedkeys(tab)
end
local function sortedhashonly(tab)
if tab then
- local srt,s={},0
+ local srt={}
+ local s=0
for key in next,tab do
if type(key)=="string" then
s=s+1
@@ -1153,7 +1158,8 @@ local function sortedhashonly(tab)
end
local function sortedindexonly(tab)
if tab then
- local srt,s={},0
+ local srt={}
+ local s=0
for key in next,tab do
if type(key)=="number" then
s=s+1
@@ -1170,7 +1176,8 @@ local function sortedindexonly(tab)
end
local function sortedhashkeys(tab,cmp)
if tab then
- local srt,s={},0
+ local srt={}
+ local s=0
for key in next,tab do
if key then
s=s+1
@@ -1246,7 +1253,9 @@ function table.prepend(t,list)
return t
end
function table.merge(t,...)
- t=t or {}
+ if not t then
+ t={}
+ end
for i=1,select("#",...) do
for k,v in next,(select(i,...)) do
t[k]=v
@@ -1275,7 +1284,8 @@ function table.imerge(t,...)
return t
end
function table.imerged(...)
- local tmp,ntmp={},0
+ local tmp={}
+ local ntmp=0
for i=1,select("#",...) do
local nst=select(i,...)
for j=1,#nst do
@@ -1307,7 +1317,9 @@ local function fastcopy(old,metatabletoo)
end
end
local function copy(t,tables)
- tables=tables or {}
+ if not tables then
+ tables={}
+ end
local tcopy={}
if not tables[t] then
tables[t]=tcopy
@@ -1354,7 +1366,8 @@ function table.tohash(t,value)
return h
end
function table.fromhash(t)
- local hsh,h={},0
+ local hsh={}
+ local h=0
for k,v in next,t do
if v then
h=h+1
@@ -1455,7 +1468,8 @@ local function do_serialize(root,name,depth,level,indexed)
end
end
if root and next(root)~=nil then
- local first,last=nil,0
+ local first=nil
+ local last=0
if compact then
last=#root
for k=1,last do
@@ -1714,7 +1728,8 @@ local function serialize(_handle,root,name,specification)
handle("}")
end
function table.serialize(root,name,specification)
- local t,n={},0
+ local t={}
+ local n=0
local function flush(s)
n=n+1
t[n]=s
@@ -1728,13 +1743,15 @@ function table.tofile(filename,root,name,specification)
local f=io.open(filename,'w')
if f then
if maxtab>1 then
- local t,n={},0
+ local t={}
+ local n=0
local function flush(s)
n=n+1
t[n]=s
if n>maxtab then
f:write(concat(t,"\n"),"\n")
- t,n={},0
+ t={}
+ n=0
end
end
serialize(flush,root,name,specification)
@@ -1836,8 +1853,12 @@ local function are_equal(a,b,n,m)
if a==b then
return true
elseif a and b and #a==#b then
- n=n or 1
- m=m or #a
+ if not n then
+ n=1
+ end
+ if not m then
+ m=#a
+ end
for i=n,m do
local ai,bi=a[i],b[i]
if ai==bi then
@@ -1937,7 +1958,8 @@ function table.mirrored(t)
end
function table.reversed(t)
if t then
- local tt,tn={},#t
+ local tt={}
+ local tn=#t
if tn>0 then
local ttn=0
for i=tn,1,-1 do
@@ -2050,7 +2072,9 @@ function table.sorted(t,...)
end
function table.values(t,s)
if t then
- local values,keys,v={},{},0
+ local values={}
+ local keys={}
+ local v=0
for key,value in next,t do
if not keys[value] then
v=v+1
@@ -2652,40 +2676,45 @@ local reslasher=lpeg.replacer(P("\\"),"/")
function file.reslash(str)
return str and lpegmatch(reslasher,str)
end
-function file.is_writable(name)
- if not name then
- elseif lfs.isdir(name) then
- name=name.."/m_t_x_t_e_s_t.tmp"
- local f=io.open(name,"wb")
- if f then
- f:close()
- os.remove(name)
- return true
- end
- elseif lfs.isfile(name) then
- local f=io.open(name,"ab")
- if f then
- f:close()
- return true
- end
- else
- local f=io.open(name,"ab")
- if f then
- f:close()
- os.remove(name)
- return true
+if lfs.isreadablefile and lfs.iswritablefile then
+ file.is_readable=lfs.isreadablefile
+ file.is_writable=lfs.iswritablefile
+else
+ function file.is_writable(name)
+ if not name then
+ elseif lfs.isdir(name) then
+ name=name.."/m_t_x_t_e_s_t.tmp"
+ local f=io.open(name,"wb")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
+ elseif lfs.isfile(name) then
+ local f=io.open(name,"ab")
+ if f then
+ f:close()
+ return true
+ end
+ else
+ local f=io.open(name,"ab")
+ if f then
+ f:close()
+ os.remove(name)
+ return true
+ end
end
- end
- return false
-end
-local readable=P("r")*Cc(true)
-function file.is_readable(name)
- if name then
- local a=attributes(name)
- return a and lpegmatch(readable,a.permissions) or false
- else
return false
end
+ local readable=P("r")*Cc(true)
+ function file.is_readable(name)
+ if name then
+ local a=attributes(name)
+ return a and lpegmatch(readable,a.permissions) or false
+ else
+ return false
+ end
+ end
end
file.isreadable=file.is_readable
file.iswritable=file.is_writable
@@ -3045,7 +3074,6 @@ local format,gsub,rep,sub,find=string.format,string.gsub,string.rep,string.sub,s
local load,dump=load,string.dump
local tonumber,type,tostring,next,setmetatable=tonumber,type,tostring,next,setmetatable
local unpack,concat=table.unpack,table.concat
-local unpack,concat=table.unpack,table.concat
local P,V,C,S,R,Ct,Cs,Cp,Carg,Cc=lpeg.P,lpeg.V,lpeg.C,lpeg.S,lpeg.R,lpeg.Ct,lpeg.Cs,lpeg.Cp,lpeg.Carg,lpeg.Cc
local patterns,lpegmatch=lpeg.patterns,lpeg.match
local utfchar,utfbyte,utflen=utf.char,utf.byte,utf.len
@@ -3384,8 +3412,8 @@ local environment={
formattednumber=number.formatted,
sparseexponent=number.sparseexponent,
formattedfloat=number.formattedfloat,
- stripzero=lpeg.patterns.stripzero,
- stripzeros=lpeg.patterns.stripzeros,
+ stripzero=patterns.stripzero,
+ stripzeros=patterns.stripzeros,
FORMAT=string.f9,
}
local arguments={ "a1" }
@@ -3472,7 +3500,7 @@ local format_F=function(f)
end
local format_k=function(b,a)
n=n+1
- return format("formattedfloat(a%s,%i,%i)",n,b or 0,a or 0)
+ return format("formattedfloat(a%s,%s,%s)",n,b or 0,a or 0)
end
local format_g=function(f)
n=n+1
@@ -3828,9 +3856,9 @@ patterns.xmlescape=Cs((P("<")/"&lt;"+P(">")/"&gt;"+P("&")/"&amp;"+P('"')/"&quot;
patterns.texescape=Cs((C(S("#$%\\{}"))/"\\%1"+anything)^0)
patterns.luaescape=Cs(((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0)
patterns.luaquoted=Cs(Cc('"')*((1-S('"\n'))^1+P('"')/'\\"'+P('\n')/'\\n"')^0*Cc('"'))
-add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],{ xmlescape=lpeg.patterns.xmlescape })
-add(formatters,"tex",[[lpegmatch(texescape,%s)]],{ texescape=lpeg.patterns.texescape })
-add(formatters,"lua",[[lpegmatch(luaescape,%s)]],{ luaescape=lpeg.patterns.luaescape })
+add(formatters,"xml",[[lpegmatch(xmlescape,%s)]],{ xmlescape=patterns.xmlescape })
+add(formatters,"tex",[[lpegmatch(texescape,%s)]],{ texescape=patterns.texescape })
+add(formatters,"lua",[[lpegmatch(luaescape,%s)]],{ luaescape=patterns.luaescape })
local dquote=patterns.dquote
local equote=patterns.escaped+dquote/'\\"'+1
local cquote=Cc('"')
@@ -3862,6 +3890,27 @@ local f_16_16=formatters["%0.5N"]
function number.to16dot16(n)
return f_16_16(n/65536.0)
end
+if not string.explode then
+ local tsplitat=lpeg.tsplitat
+ local p_utf=patterns.utf8character
+ local p_check=C(p_utf)*(P("+")*Cc(true))^0
+ local p_split=Ct(C(p_utf)^0)
+ local p_space=Ct((C(1-P(" ")^1)+P(" ")^1)^0)
+ function string.explode(str,symbol)
+ if symbol=="" then
+ return lpegmatch(p_split,str)
+ elseif symbol then
+ local a,b=lpegmatch(p_check,symbol)
+ if b then
+ return lpegmatch(tsplitat(P(a)^1),str)
+ else
+ return lpegmatch(tsplitat(a),str)
+ end
+ else
+ return lpegmatch(p_space,str)
+ end
+ end
+end
end -- closure
@@ -4074,6 +4123,32 @@ if bit32 then
local b=char(n%256)
f:write(b,a)
end
+ function files.writecardinal4(f,n)
+ local a=char(n%256)
+ n=rshift(n,8)
+ local b=char(n%256)
+ n=rshift(n,8)
+ local c=char(n%256)
+ n=rshift(n,8)
+ local d=char(n%256)
+ f:write(d,c,b,a)
+ end
+ function files.writecardinal2le(f,n)
+ local a=char(n%256)
+ n=rshift(n,8)
+ local b=char(n%256)
+ f:write(a,b)
+ end
+ function files.writecardinal4le(f,n)
+ local a=char(n%256)
+ n=rshift(n,8)
+ local b=char(n%256)
+ n=rshift(n,8)
+ local c=char(n%256)
+ n=rshift(n,8)
+ local d=char(n%256)
+ f:write(a,b,c,d)
+ end
else
local floor=math.floor
function files.writecardinal2(f,n)
@@ -4082,16 +4157,32 @@ else
local b=char(n%256)
f:write(b,a)
end
-end
-function files.writecardinal4(f,n)
- local a=char(n%256)
- n=rshift(n,8)
- local b=char(n%256)
- n=rshift(n,8)
- local c=char(n%256)
- n=rshift(n,8)
- local d=char(n%256)
- f:write(d,c,b,a)
+ function files.writecardinal4(f,n)
+ local a=char(n%256)
+ n=floor(n/256)
+ local b=char(n%256)
+ n=floor(n/256)
+ local c=char(n%256)
+ n=floor(n/256)
+ local d=char(n%256)
+ f:write(d,c,b,a)
+ end
+ function files.writecardinal2le(f,n)
+ local a=char(n%256)
+ n=floor(n/256)
+ local b=char(n%256)
+ f:write(a,b)
+ end
+ function files.writecardinal4le(f,n)
+ local a=char(n%256)
+ n=floor(n/256)
+ local b=char(n%256)
+ n=floor(n/256)
+ local c=char(n%256)
+ n=floor(n/256)
+ local d=char(n%256)
+ f:write(a,b,c,d)
+ end
end
function files.writestring(f,s)
f:write(char(byte(s,1,#s)))
@@ -4104,10 +4195,18 @@ if fio and fio.readcardinal1 then
files.readcardinal2=fio.readcardinal2
files.readcardinal3=fio.readcardinal3
files.readcardinal4=fio.readcardinal4
+ files.readcardinal1le=fio.readcardinal1le or files.readcardinal1le
+ files.readcardinal2le=fio.readcardinal2le or files.readcardinal2le
+ files.readcardinal3le=fio.readcardinal3le or files.readcardinal3le
+ files.readcardinal4le=fio.readcardinal4le or files.readcardinal4le
files.readinteger1=fio.readinteger1
files.readinteger2=fio.readinteger2
files.readinteger3=fio.readinteger3
files.readinteger4=fio.readinteger4
+ files.readinteger1le=fio.readinteger1le or files.readinteger1le
+ files.readinteger2le=fio.readinteger2le or files.readinteger2le
+ files.readinteger3le=fio.readinteger3le or files.readinteger3le
+ files.readinteger4le=fio.readinteger4le or files.readinteger4le
files.readfixed2=fio.readfixed2
files.readfixed4=fio.readfixed4
files.read2dot14=fio.read2dot14
@@ -4128,6 +4227,24 @@ if fio and fio.readcardinal1 then
skipposition(f,4*(n or 1))
end
end
+if fio and fio.writecardinal1 then
+ files.writecardinal1=fio.writecardinal1
+ files.writecardinal2=fio.writecardinal2
+ files.writecardinal3=fio.writecardinal3
+ files.writecardinal4=fio.writecardinal4
+ files.writecardinal1le=fio.writecardinal1le
+ files.writecardinal2le=fio.writecardinal2le
+ files.writecardinal3le=fio.writecardinal3le
+ files.writecardinal4le=fio.writecardinal4le
+ files.writeinteger1=fio.writeinteger1 or fio.writecardinal1
+ files.writeinteger2=fio.writeinteger2 or fio.writecardinal2
+ files.writeinteger3=fio.writeinteger3 or fio.writecardinal3
+ files.writeinteger4=fio.writeinteger4 or fio.writecardinal4
+ files.writeinteger1le=files.writeinteger1le or fio.writecardinal1le
+ files.writeinteger2le=files.writeinteger2le or fio.writecardinal2le
+ files.writeinteger3le=files.writeinteger3le or fio.writecardinal3le
+ files.writeinteger4le=files.writeinteger4le or fio.writecardinal4le
+end
if fio and fio.readcardinaltable then
files.readcardinaltable=fio.readcardinaltable
files.readintegertable=fio.readintegertable
@@ -4712,67 +4829,8 @@ end
nodes.nodecodes=nodecodes
nodes.glyphcodes=glyphcodes
nodes.disccodes=disccodes
-local flush_node=node.flush_node
-local remove_node=node.remove
-local traverse_id=node.traverse_id
nodes.handlers.protectglyphs=node.protect_glyphs
-nodes.handlers.unprotectglyphs=node.unprotect_glyphs
-function nodes.remove(head,current,free_too)
- local t=current
- head,current=remove_node(head,current)
- if t then
- if free_too then
- flush_node(t)
- t=nil
- else
- t.next,t.prev=nil,nil
- end
- end
- return head,current,t
-end
-function nodes.delete(head,current)
- return nodes.remove(head,current,true)
-end
-local getfield=node.getfield
-local setfield=node.setfield
-nodes.getfield=getfield
-nodes.setfield=setfield
-nodes.getattr=getfield
-nodes.setattr=setfield
-nodes.tostring=node.tostring or tostring
-nodes.copy=node.copy
-nodes.copy_node=node.copy
-nodes.copy_list=node.copy_list
-nodes.delete=node.delete
-nodes.dimensions=node.dimensions
-nodes.end_of_math=node.end_of_math
-nodes.flush_list=node.flush_list
-nodes.flush_node=node.flush_node
-nodes.flush=node.flush_node
-nodes.free=node.free
-nodes.insert_after=node.insert_after
-nodes.insert_before=node.insert_before
-nodes.hpack=node.hpack
-nodes.new=node.new
-nodes.tail=node.tail
-nodes.traverse=node.traverse
-nodes.traverse_id=node.traverse_id
-nodes.slide=node.slide
-nodes.vpack=node.vpack
-nodes.first_glyph=node.first_glyph
-nodes.has_glyph=node.has_glyph or node.first_glyph
-nodes.current_attr=node.current_attr
-nodes.has_field=node.has_field
-nodes.last_node=node.last_node
-nodes.usedlist=node.usedlist
-nodes.protrusion_skippable=node.protrusion_skippable
-nodes.write=node.write
-nodes.has_attribute=node.has_attribute
-nodes.set_attribute=node.set_attribute
-nodes.unset_attribute=node.unset_attribute
-nodes.protect_glyphs=node.protect_glyphs
-nodes.unprotect_glyphs=node.unprotect_glyphs
-nodes.mlist_to_hlist=node.mlist_to_hlist
+nodes.handlers.unprotectglyphs=node.unprotect_glyphs
local direct=node.direct
local nuts={}
nodes.nuts=nuts
@@ -8637,7 +8695,6 @@ function constructors.scale(tfmdata,specification)
local hasitalics=properties.hasitalics
local autoitalicamount=properties.autoitalicamount
local stackmath=not properties.nostackmath
- local nonames=properties.noglyphnames
local haskerns=properties.haskerns or properties.mode=="base"
local hasligatures=properties.hasligatures or properties.mode=="base"
local realdimensions=properties.realdimensions
@@ -8744,6 +8801,7 @@ function constructors.scale(tfmdata,specification)
local width=description.width
local height=description.height
local depth=description.depth
+ local isunicode=description.unicode
if realdimensions then
if not height or height==0 then
local bb=description.boundingbox
@@ -8768,16 +8826,16 @@ function constructors.scale(tfmdata,specification)
if height then height=vdelta*height else height=scaledheight end
if depth and depth~=0 then
depth=delta*depth
- if nonames then
+ if isunicode then
chr={
index=index,
height=height,
depth=depth,
width=width,
+ unicode=isunicode,
}
else
chr={
- name=description.name,
index=index,
height=height,
depth=depth,
@@ -8785,33 +8843,23 @@ function constructors.scale(tfmdata,specification)
}
end
else
- if nonames then
+ if isunicode then
chr={
index=index,
height=height,
width=width,
+ unicode=isunicode,
}
else
chr={
- name=description.name,
index=index,
height=height,
width=width,
}
end
end
- local isunicode=description.unicode
if addtounicode then
- if isunicode then
- chr.unicode=isunicode
- chr.tounicode=tounicode(isunicode)
- else
- chr.tounicode=unknowncode
- end
- else
- if isunicode then
- chr.unicode=isunicode
- end
+ chr.tounicode=isunicode and tounicode(isunicode) or unknowncode
end
if hasquality then
local ve=character.expansion_factor
@@ -8881,7 +8929,10 @@ function constructors.scale(tfmdata,specification)
if stackmath then
local mk=character.mathkerns
if mk then
- local tr,tl,br,bl=mk.topright,mk.topleft,mk.bottomright,mk.bottomleft
+ local tr=mk.topright
+ local tl=mk.topleft
+ local br=mk.bottomright
+ local bl=mk.bottomleft
chr.mathkern={
top_right=tr and mathkerns(tr,vdelta) or nil,
top_left=tl and mathkerns(tl,vdelta) or nil,
@@ -9167,7 +9218,9 @@ hashmethods.normal=function(list)
end
end
function constructors.hashinstance(specification,force)
- local hash,size,fallbacks=specification.hash,specification.size,specification.fallbacks
+ local hash=specification.hash
+ local size=specification.size
+ local fallbacks=specification.fallbacks
if force or not hash then
hash=constructors.hashfeatures(specification)
specification.hash=hash
@@ -9534,7 +9587,8 @@ function constructors.initializefeatures(what,tfmdata,features,trace,report)
end
end
function constructors.collectprocessors(what,tfmdata,features,trace,report)
- local processes,nofprocesses={},0
+ local processes={}
+ local nofprocesses=0
if features and next(features) then
local properties=tfmdata.properties
local whathandler=handlers[what]
@@ -10071,7 +10125,8 @@ function mappings.addtounicode(data,filename,checklookups,forceligatures)
glyph.unicode=unicode
end
else
- local t,n={},0
+ local t={}
+ local n=0
for l=1,nsplit do
local base=split[l]
local u=unicodes[base] or unicodevector[base] or contextvector[name]
@@ -10410,7 +10465,6 @@ local P,R,S,C,Cs,Cc,Ct,Carg,Cmt=lpeg.P,lpeg.R,lpeg.S,lpeg.C,lpeg.Cs,lpeg.Cc,lpeg
local lpegmatch=lpeg.match
local rshift=bit32.rshift
local setmetatableindex=table.setmetatableindex
-local formatters=string.formatters
local sortedkeys=table.sortedkeys
local sortedhash=table.sortedhash
local stripstring=string.nospaces
@@ -14945,7 +14999,8 @@ end
end
end
local function setbias(globals,locals)
- local g,l=#globals,#locals
+ local g=#globals
+ local l=#locals
return
((g<1240 and 107) or (g<33900 and 1131) or 32768)+1,
((l<1240 and 107) or (l<33900 and 1131) or 32768)+1
@@ -15681,7 +15736,8 @@ local function contours2outlines_normal(glyphs,shapes)
local nofsegments=0
glyph.segments=segments
if nofcontours>0 then
- local px,py=0,0
+ local px=0
+ local py=0
local first=1
for i=1,nofcontours do
local last=contours[i]
@@ -15708,15 +15764,20 @@ local function contours2outlines_normal(glyphs,shapes)
end
control_pt=first_pt
end
- local x,y=first_pt[1],first_pt[2]
+ local x=first_pt[1]
+ local y=first_pt[2]
if not done then
- xmin,ymin,xmax,ymax=x,y,x,y
+ xmin=x
+ ymin=y
+ xmax=x
+ ymax=y
done=true
end
nofsegments=nofsegments+1
segments[nofsegments]={ x,y,"m" }
if not quadratic then
- px,py=x,y
+ px=x
+ py=y
end
local previous_pt=first_pt
for i=first,last do
@@ -15735,8 +15796,10 @@ local function contours2outlines_normal(glyphs,shapes)
control_pt=current_pt
end
elseif current_on then
- local x1,y1=control_pt[1],control_pt[2]
- local x2,y2=current_pt[1],current_pt[2]
+ local x1=control_pt[1]
+ local y1=control_pt[2]
+ local x2=current_pt[1]
+ local y2=current_pt[2]
nofsegments=nofsegments+1
if quadratic then
segments[nofsegments]={ x1,y1,x2,y2,"q" }
@@ -15746,8 +15809,10 @@ local function contours2outlines_normal(glyphs,shapes)
end
control_pt=false
else
- local x2,y2=(previous_pt[1]+current_pt[1])/2,(previous_pt[2]+current_pt[2])/2
- local x1,y1=control_pt[1],control_pt[2]
+ local x2=(previous_pt[1]+current_pt[1])/2
+ local y2=(previous_pt[2]+current_pt[2])/2
+ local x1=control_pt[1]
+ local y1=control_pt[2]
nofsegments=nofsegments+1
if quadratic then
segments[nofsegments]={ x1,y1,x2,y2,"q" }
@@ -15762,14 +15827,17 @@ local function contours2outlines_normal(glyphs,shapes)
if first_pt==last_pt then
else
nofsegments=nofsegments+1
- local x2,y2=first_pt[1],first_pt[2]
+ local x2=first_pt[1]
+ local y2=first_pt[2]
if not control_pt then
segments[nofsegments]={ x2,y2,"l" }
elseif quadratic then
- local x1,y1=control_pt[1],control_pt[2]
+ local x1=control_pt[1]
+ local y1=control_pt[2]
segments[nofsegments]={ x1,y1,x2,y2,"q" }
else
- local x1,y1=control_pt[1],control_pt[2]
+ local x1=control_pt[1]
+ local y1=control_pt[2]
x1,y1,x2,y2,px,py=curveto(x1,y1,px,py,x2,y2)
segments[nofsegments]={ x1,y1,x2,y2,px,py,"c" }
end
@@ -15828,7 +15896,8 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
end
control_pt=first_pt
end
- local x,y=first_pt[1],first_pt[2]
+ local x=first_pt[1]
+ local y=first_pt[2]
if not done then
xmin,ymin,xmax,ymax=x,y,x,y
done=true
@@ -15841,7 +15910,8 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
segments[nofsegments]={ x,y,"m" }
end
if not quadratic then
- px,py=x,y
+ px=x
+ py=y
end
local previous_pt=first_pt
for i=first,last do
@@ -15850,7 +15920,8 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
local previous_on=previous_pt[3]
if previous_on then
if current_on then
- local x,y=current_pt[1],current_pt[2]
+ local x=current_pt[1]
+ local y=current_pt[2]
if x<xmin then xmin=x elseif x>xmax then xmax=x end
if y<ymin then ymin=y elseif y>ymax then ymax=y end
if keepcurve then
@@ -15858,14 +15929,17 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
segments[nofsegments]={ x,y,"l" }
end
if not quadratic then
- px,py=x,y
+ px=x
+ py=y
end
else
control_pt=current_pt
end
elseif current_on then
- local x1,y1=control_pt[1],control_pt[2]
- local x2,y2=current_pt[1],current_pt[2]
+ local x1=control_pt[1]
+ local y1=control_pt[2]
+ local x2=current_pt[1]
+ local y2=current_pt[2]
if quadratic then
if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
@@ -15888,8 +15962,10 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
end
control_pt=false
else
- local x2,y2=(previous_pt[1]+current_pt[1])/2,(previous_pt[2]+current_pt[2])/2
- local x1,y1=control_pt[1],control_pt[2]
+ local x2=(previous_pt[1]+current_pt[1])/2
+ local y2=(previous_pt[2]+current_pt[2])/2
+ local x1=control_pt[1]
+ local y1=control_pt[2]
if quadratic then
if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
@@ -15921,8 +15997,10 @@ local function contours2outlines_shaped(glyphs,shapes,keepcurve)
segments[nofsegments]={ first_pt[1],first_pt[2],"l" }
end
else
- local x1,y1=control_pt[1],control_pt[2]
- local x2,y2=first_pt[1],first_pt[2]
+ local x1=control_pt[1]
+ local y1=control_pt[2]
+ local x2=first_pt[1]
+ local y2=first_pt[2]
if x1<xmin then xmin=x1 elseif x1>xmax then xmax=x1 end
if y1<ymin then ymin=y1 elseif y1>ymax then ymax=y1 end
if quadratic then
@@ -19587,12 +19665,13 @@ function readers.avar(f,fontdata,specification)
local lastfrom=false
local lastto=false
for i=1,nofvalues do
- local f,t=read2dot14(f),read2dot14(f)
- if lastfrom and f<=lastfrom then
- elseif lastto and t>=lastto then
+ local from=read2dot14(f)
+ local to=read2dot14(f)
+ if lastfrom and from<=lastfrom then
+ elseif lastto and to>=lastto then
else
- values[#values+1]={ f,t }
- lastfrom,lastto=f,t
+ values[#values+1]={ from,to }
+ lastfrom,lastto=from,to
end
end
nofvalues=#values
@@ -21074,7 +21153,9 @@ function readers.pack(data)
end
return false
elseif nt>=threshold then
- local one,two,rest=0,0,0
+ local one=0
+ local two=0
+ local rest=0
if pass==1 then
for k,v in next,c do
if v==1 then
@@ -22822,7 +22903,6 @@ local function copytotfm(data,cache_id)
properties.space=spacer
properties.encodingbytes=2
properties.format=data.format or formats.otf
- properties.noglyphnames=true
properties.filename=filename
properties.fontname=fontname
properties.fullname=fullname
@@ -23176,7 +23256,9 @@ local function gref(descriptions,n)
return f_unicode(n)
end
elseif n then
- local num,nam,j={},{},0
+ local num={}
+ local nam={}
+ local j=0
for i=1,#n do
local ni=n[i]
if tonumber(ni) then
@@ -23381,12 +23463,15 @@ local function preparesubstitutions(tfmdata,feature,value,validlookups,lookuplis
local done=trace_baseinit and trace_ligatures and {}
for i=1,nofligatures do
local ligature=ligatures[i]
- local unicode,tree=ligature[1],ligature[2]
+ local unicode=ligature[1]
+ local tree=ligature[2]
make_1(present,tree,"ctx_"..unicode)
end
for i=1,nofligatures do
local ligature=ligatures[i]
- local unicode,tree,lookupname=ligature[1],ligature[2],ligature[3]
+ local unicode=ligature[1]
+ local tree=ligature[2]
+ local lookupname=ligature[3]
make_2(present,tfmdata,characters,tree,"ctx_"..unicode,unicode,unicode,done,sequence)
end
end
@@ -23952,7 +24037,8 @@ function injections.setmove(current,factor,rlmode,x,injection)
end
end
function injections.setmark(start,base,factor,rlmode,ba,ma,tfmbase,mkmk,checkmark)
- local dx,dy=factor*(ba[1]-ma[1]),factor*(ba[2]-ma[2])
+ local dx=factor*(ba[1]-ma[1])
+ local dy=factor*(ba[2]-ma[2])
nofregisteredmarks=nofregisteredmarks+1
if rlmode>=0 then
dx=tfmbase.width-dx
@@ -25278,9 +25364,9 @@ if not classifiers then
characters.classifiers=classifiers
end
function methods.arab(head,font,attr)
- local first,last=nil,nil
- local c_first,c_last=nil,nil
- local current,done=head,false
+ local first,last,c_first,c_last
+ local current=head
+ local done=false
current=tonut(current)
while current do
local char,id=ischar(current,font)
@@ -26021,8 +26107,8 @@ function handlers.gsub_ligature(head,start,dataset,sequence,ligature,rlmode,skip
local prev=getprev(start)
if stop then
setnext(stop)
- local tail=getprev(stop)
local copy=copy_node_list(start)
+ local tail=stop
local liat=find_node_tail(copy)
if pre then
setlink(liat,pre)
@@ -26113,7 +26199,8 @@ function handlers.gpos_pair(head,start,dataset,sequence,kerns,rlmode,skiphash,st
end
local format=step.format
if format=="pair" then
- local a,b=krn[1],krn[2]
+ local a=krn[1]
+ local b=krn[2]
if a==true then
elseif a then
local x,y,w,h=setposition(1,start,factor,rlmode,a,injection)
@@ -26631,7 +26718,8 @@ function chainprocs.gpos_pair(head,start,stop,dataset,sequence,currentlookup,rlm
end
local format=currentlookup.format
if format=="pair" then
- local a,b=krn[1],krn[2]
+ local a=krn[1]
+ local b=krn[2]
if a==true then
elseif a then
local x,y,w,h=setposition(1,start,factor,rlmode,a,"injections")
@@ -30034,7 +30122,7 @@ function handlers.devanagari_reorder_pre_base_reordering_consonants(head,start)
end
function handlers.devanagari_remove_joiners(head,start,kind,lookupname,replacement)
local stop=getnext(start)
- local font=getfont(start)
+ local font=getfont(start)
local last=start
while stop do
local char=ischar(stop,font)
@@ -31668,7 +31756,8 @@ local function addfeature(data,feature,specifications)
if not nocheck and not description then
skip=skip+1
elseif type(replacement)=="table" then
- local r,n={},0
+ local r={}
+ local n=0
for i=1,#replacement do
local u=tounicode(replacement[i])
if nocheck or descriptions[u] then
@@ -32601,13 +32690,15 @@ function afm.load(filename)
local name=file.removesuffix(file.basename(filename))
local data=containers.read(afm.cache,name)
local attr=lfs.attributes(filename)
- local size,time=attr and attr.size or 0,attr and attr.modification or 0
+ local size=attr and attr.size or 0
+ local time=attr and attr.modification or 0
local pfbfile=file.replacesuffix(name,"pfb")
local pfbname=resolvers.findfile(pfbfile,"pfb") or ""
if pfbname=="" then
pfbname=resolvers.findfile(file.basename(pfbfile),"pfb") or ""
end
- local pfbsize,pfbtime=0,0
+ local pfbsize=0
+ local pfbtime=0
if pfbname~="" then
local attr=lfs.attributes(pfbname)
pfbsize=attr.size or 0
@@ -32816,7 +32907,8 @@ local addthem=function(rawdata,ligatures)
local one=descriptions[unicodes[ligname]]
if one then
for _,pair in next,ligdata do
- local two,three=unicodes[pair[1]],unicodes[pair[2]]
+ local two=unicodes[pair[1]]
+ local three=unicodes[pair[2]]
if two and three then
local ol=one.ligatures
if ol then
@@ -32916,7 +33008,8 @@ local function adddimensions(data)
for unicode,description in next,data.descriptions do
local bb=description.boundingbox
if bb then
- local ht,dp=bb[4],-bb[2]
+ local ht=bb[4]
+ local dp=-bb[2]
if ht==0 or ht<0 then
else
description.height=ht
@@ -33182,7 +33275,7 @@ local function check_afm(specification,fullname)
if foundname=="" then
foundname=fonts.names.getfilename(fullname,"afm") or ""
end
- if foundname=="" and afm.autoprefixed then
+ if fullname and foundname=="" and afm.autoprefixed then
local encoding,shortname=match(fullname,"^(.-)%-(.*)$")
if encoding and shortname and fonts.encodings.known[encoding] then
shortname=findbinfile(shortname,'afm') or ""