diff options
Diffstat (limited to 'Master/texmf-dist/tex/generic/context/luatex')
3 files changed, 42 insertions, 185 deletions
diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua index ec515001e4a..5ab9df7f94b 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-basics-nod.lua @@ -28,12 +28,12 @@ if tex.attribute[0] ~= 0 then end -attributes = { } +attributes = attributes or { } attributes.unsetvalue = -0x7FFFFFFF local numbers, last = { }, 127 -function attributes.private(name) +attributes.private = attributes.private or function(name) local number = numbers[name] if not number then if last < 255 then diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua index b79cc280723..c5ce7b5ce02 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : luatex-fonts-merged.lua -- parent file : luatex-fonts.lua --- merge date : 04/11/13 19:49:14 +-- merge date : 04/20/13 01:08:47 do -- begin closure to overcome local limits and interference @@ -82,158 +82,6 @@ function optionalrequire(...) return result end end -local type=type -local gsub,format=string.gsub,string.format -local package=package -local searchers=package.searchers or package.loaders -local libpaths=nil -local clibpaths=nil -local libhash={} -local clibhash={} -local libextras={} -local clibextras={} -local filejoin=file and file.join or function(path,name) return path.."/"..name end -local isreadable=file and file.is_readable or function(name) local f=io.open(name) if f then f:close() return true end end -local addsuffix=file and file.addsuffix or function(name,suffix) return name.."."..suffix end -local function cleanpath(path) - return path -end -local helpers=package.helpers or { - libpaths=function() return {} end, - clibpaths=function() return {} end, - cleanpath=cleanpath, - trace=false, - report=function(...) print(format(...)) end, -} -package.helpers=helpers -local function getlibpaths() - return libpaths or helpers.libpaths(libhash) -end -local function getclibpaths() - return clibpaths or helpers.clibpaths(clibhash) -end -package.libpaths=getlibpaths -package.clibpaths=getclibpaths -local function addpath(what,paths,extras,hash,...) - local pathlist={... } - local cleanpath=helpers.cleanpath - local trace=helpers.trace - local report=helpers.report - local function add(path) - local path=cleanpath(path) - if not hash[path] then - if trace then - report("extra %s path: %s",what,path) - end - paths [#paths+1]=path - extras[#extras+1]=path - end - end - for p=1,#pathlist do - local path=pathlist[p] - if type(path)=="table" then - for i=1,#path do - add(path[i]) - end - else - add(path) - end - end - return paths,extras -end -function package.extralibpath(...) - libpaths,libextras=addpath("lua",getlibpaths(),libextras,libhash,...) -end -function package.extraclibpath(...) - clibpaths,clibextras=addpath("lib",getclibpaths(),clibextras,clibhash,...) -end -if not searchers[-2] then - searchers[-2]=searchers[2] -end -searchers[2]=function(name) - return helpers.loaded(name) -end -searchers[3]=nil -local function loadedaslib(resolved,rawname) - local init="luaopen_"..gsub(rawname,"%.","_") - if helpers.trace then - helpers.report("calling loadlib with '%s' with init '%s'",resolved,init) - end - return package.loadlib(resolved,init) -end -local function loadedbylua(name) - if helpers.trace then - helpers.report("locating '%s' using normal loader",name) - end - return true,searchers[-2](name) -end -local function loadedbypath(name,rawname,paths,islib,what) - local trace=helpers.trace - local report=helpers.report - if trace then - report("locating '%s' as '%s' on '%s' paths",rawname,name,what) - end - for p=1,#paths do - local path=paths[p] - local resolved=filejoin(path,name) - if trace then - report("checking for '%s' using '%s' path '%s'",name,what,path) - end - if isreadable(resolved) then - if trace then - report("lib '%s' located on '%s'",name,resolved) - end - if islib then - return true,loadedaslib(resolved,rawname) - else - return true,loadfile(resolved) - end - end - end -end -local function notloaded(name) - if helpers.trace then - helpers.report("unable to locate library '%s'",name) - end -end -helpers.loadedaslib=loadedaslib -helpers.loadedbylua=loadedbylua -helpers.loadedbypath=loadedbypath -helpers.notloaded=notloaded -function helpers.loaded(name) - local thename=gsub(name,"%.","/") - local luaname=addsuffix(thename,"lua") - local libname=addsuffix(thename,os.libsuffix or "so") - local libpaths=getlibpaths() - local clibpaths=getclibpaths() - local done,result=loadedbypath(luaname,name,libpaths,false,"lua") - if done then - return result - end - local done,result=loadedbypath(luaname,name,clibpaths,false,"lua") - if done then - return result - end - local done,result=loadedbypath(libname,name,clibpaths,true,"lib") - if done then - return result - end - local done,result=loadedbylua(name) - if done then - return result - end - return notloaded(name) -end -function helpers.unload(name) - if helpers.trace then - if package.loaded[name] then - helpers.report("unloading library '%s', %s",name,"done") - else - helpers.report("unloading library '%s', %s",name,"not loaded") - end - end - package.loaded[name]=nil -end end -- closure @@ -1553,7 +1401,7 @@ function table.tofile(filename,root,name,specification) io.flush() end end -local function flattened(t,f,depth) +local function flattened(t,f,depth) if f==nil then f={} depth=0xFFFF @@ -1568,19 +1416,16 @@ local function flattened(t,f,depth) if depth>0 and type(v)=="table" then flattened(v,f,depth-1) else - f[k]=v + f[#f+1]=v end end end - local n=#f for k=1,#t do local v=t[k] if depth>0 and type(v)=="table" then flattened(v,f,depth-1) - n=#f else - n=n+1 - f[n]=v + f[#f+1]=v end end return f @@ -2141,7 +1986,7 @@ elseif not lfs.isfile then end end local insert,concat=table.insert,table.concat -local match=string.match +local match,find=string.match,string.find local lpegmatch=lpeg.match local getcurrentdir,attributes=lfs.currentdir,lfs.attributes local checkedsplit=string.checkedsplit @@ -2355,11 +2200,11 @@ local anchors=fwslash+drivespec local untouched=periods+(1-period)^1*P(-1) local splitstarter=(Cs(drivespec*(bwslash/"/"+fwslash)^0)+Cc(false))*Ct(lpeg.splitat(S("/\\")^1)) local absolute=fwslash -function file.collapsepath(str,anchor) +function file.collapsepath(str,anchor) if not str then return end - if anchor and not lpegmatch(anchors,str) then + if anchor==true and not lpegmatch(anchors,str) then str=getcurrentdir().."/"..str end if str=="" or str=="." then @@ -2399,7 +2244,12 @@ function file.collapsepath(str,anchor) elseif lpegmatch(absolute,str) then return "/"..concat(newelements,'/') else - return concat(newelements,'/') + newelements=concat(newelements,'/') + if anchor=="." and find(str,"^%./") then + return "./"..newelements + else + return newelements + end end end local validchars=R("az","09","AZ","--","..") @@ -3399,10 +3249,10 @@ if tex.attribute[0]~=0 then texio.write_nl("log","!") tex.attribute[0]=0 end -attributes={} +attributes=attributes or {} attributes.unsetvalue=-0x7FFFFFFF local numbers,last={},127 -function attributes.private(name) +attributes.private=attributes.private or function(name) local number=numbers[name] if not number then if last<255 then @@ -5167,6 +5017,7 @@ local lpegmatch=lpeg.match local reversed,concat,remove=table.reversed,table.concat,table.remove local ioflush=io.flush local fastcopy,tohash,derivetable=table.fastcopy,table.tohash,table.derive +local formatters=string.formatters local allocate=utilities.storage.allocate local registertracker=trackers.register local registerdirective=directives.register @@ -5185,7 +5036,7 @@ local report_otf=logs.reporter("fonts","otf loading") local fonts=fonts local otf=fonts.handlers.otf otf.glists={ "gsub","gpos" } -otf.version=2.741 +otf.version=2.742 otf.cache=containers.define("fonts","otf",otf.version,true) local fontdata=fonts.hashes.identifiers local chardata=characters and characters.data @@ -6148,7 +5999,18 @@ local function t_hashed(t,cache) return nil end end -local s_hashed=t_hashed +local function s_hashed(t,cache) + if t then + local ht={} + local tf=t[1] + for i=1,#tf do + ht[i]={ [tf[i]]=true } + end + return ht + else + return nil + end +end local function r_uncover(splitter,cache,cover,replacements) if cover=="" then return nil @@ -10514,6 +10376,7 @@ local variants=allocate() specifiers.variants=variants definers.methods=definers.methods or {} local internalized=allocate() +local lastdefined=nil local loadedfonts=constructors.loadedfonts local designsizes=constructors.designsizes local resolvefile=fontgoodies and fontgoodies.filenames and fontgoodies.filenames.resolve or function(s) return s end @@ -10714,18 +10577,7 @@ function definers.loadfont(specification) end return tfmdata end -local function checkvirtual(tfmdata) - local fonts=tfmdata.fonts - local selfid=font.nextid() - if fonts and #fonts>0 then - for i=1,#fonts do - if fonts[i][2]==0 then - fonts[i][2]=selfid - end - end - else - tfmdata.fonts={ "id",selfid } - end +function constructors.checkvirtualids() end function constructors.readanddefine(name,size) local specification=definers.analyze(name,size) @@ -10739,7 +10591,8 @@ function constructors.readanddefine(name,size) if not id then local tfmdata=definers.loadfont(specification) if tfmdata then - checkvirtual(tfmdata) + tfmdata.properties.hash=hash + constructors.checkvirtualids(tfmdata) id=font.define(tfmdata) definers.register(tfmdata,id) else @@ -10748,8 +10601,6 @@ function constructors.readanddefine(name,size) end return fontdata[id],id end -local lastdefined=nil -local internalized={} function definers.current() return lastdefined end @@ -10760,7 +10611,9 @@ end function definers.register(tfmdata,id) if tfmdata and id then local hash=tfmdata.properties.hash - if not internalized[hash] then + if not hash then + report_defining("registering font, id %a, name %a, invalid hash",id,tfmdata.properties.filename or "?") + elseif not internalized[hash] then internalized[hash]=id if trace_defining then report_defining("registering font, id %s, hash %a",id,hash) diff --git a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua index 0a6dc68e86d..96f35012ff5 100644 --- a/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua +++ b/Master/texmf-dist/tex/generic/context/luatex/luatex-fonts.lua @@ -16,6 +16,10 @@ if not modules then modules = { } end modules ['luatex-fonts'] = { -- places where in context other code is plugged in, but this does not affect the core code. Users -- can (given that their macro package provides this option) access the font data (characters, -- descriptions, properties, parameters, etc) of this main table. +-- +-- Future versions will probably have some more specific context code removed, like tracing and +-- obscure hooks, so that we have a more efficient version (and less files too). So, don't depend +-- too much on low level code that is meant for context as it can change without notice. utf = utf or unicode.utf8 |