summaryrefslogtreecommitdiff
path: root/tex/generic
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2013-04-01 15:40:24 +0300
committerMarius <mariausol@gmail.com>2013-04-01 15:40:24 +0300
commit7dc68c3dfa63b8669aaa2af75418bec04d52565f (patch)
treeee27fbf673f035551140a175ae43d4dbe891f98c /tex/generic
parent883c139f66ddd567c2323b333fa6694c33c2e5c5 (diff)
downloadcontext-7dc68c3dfa63b8669aaa2af75418bec04d52565f.tar.gz
beta 2013.04.01 14:16
Diffstat (limited to 'tex/generic')
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua90
-rw-r--r--tex/generic/context/luatex/luatex-languages.lua2
2 files changed, 53 insertions, 39 deletions
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index a6a0a2e87..a7b4d64ee 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 : luatex-fonts-merged.lua
-- parent file : luatex-fonts.lua
--- merge date : 03/29/13 01:03:45
+-- merge date : 04/01/13 14:16:57
do -- begin closure to overcome local limits and interference
@@ -82,6 +82,7 @@ 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
@@ -113,45 +114,38 @@ local function getclibpaths()
end
package.libpaths=getlibpaths
package.clibpaths=getclibpaths
-function package.extralibpath(...)
- libpaths=getlibpaths()
+local function addpath(what,paths,extras,hash,...)
local pathlist={... }
local cleanpath=helpers.cleanpath
local trace=helpers.trace
local report=helpers.report
- for p=1,#pathlist do
- local paths=pathlist[p]
- for i=1,#paths do
- local path=cleanpath(paths[i])
- if not libhash[path] then
- if trace then
- report("! extra lua path: %s",path)
- end
- libextras[#libextras+1]=path
- libpaths [#libpaths+1]=path
+ 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
-end
-function package.extraclibpath(...)
- clibpaths=getclibpaths()
- local pathlist={... }
- local cleanpath=helpers.cleanpath
- local trace=helpers.trace
- local report=helpers.report
for p=1,#pathlist do
- local paths=pathlist[p]
- for i=1,#paths do
- local path=cleanpath(paths[i])
- if not clibhash[path] then
- if trace then
- report("! extra lib path: %s",path)
- end
- clibextras[#clibextras+1]=path
- clibpaths [#clibpaths+1]=path
+ 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]
@@ -159,14 +153,19 @@ end
searchers[2]=function(name)
return helpers.loaded(name)
end
+searchers[3]=nil
local function loadedaslib(resolved,rawname)
- return package.loadlib(resolved,"luaopen_"..gsub(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 searchers[-2](name)
+ return true,searchers[-2](name)
end
local function loadedbypath(name,rawname,paths,islib,what)
local trace=helpers.trace
@@ -185,9 +184,9 @@ local function loadedbypath(name,rawname,paths,islib,what)
report("! lib '%s' located on '%s'",name,resolved)
end
if islib then
- return loadedaslib(resolved,rawname)
+ return true,loadedaslib(resolved,rawname)
else
- return loadfile(resolved)
+ return true,loadfile(resolved)
end
end
end
@@ -207,11 +206,23 @@ function helpers.loaded(name)
local libname=addsuffix(thename,os.libsuffix or "so")
local libpaths=getlibpaths()
local clibpaths=getclibpaths()
- return loadedbypath(luaname,name,libpaths,false,"lua")
- or loadedbypath(luaname,name,clibpaths,false,"lua")
- or loadedbypath(libname,name,clibpaths,true,"lib")
- or loadedbylua(name)
- or notloaded(name)
+ 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
end -- closure
@@ -10780,6 +10791,9 @@ function definers.read(specification,size,id)
statistics.stoptiming(fonts)
return tfmdata
end
+function font.getfont(id)
+ return fontdata[id]
+end
callbacks.register('define_font',definers.read,"definition of fonts (tfmdata preparation)")
end -- closure
diff --git a/tex/generic/context/luatex/luatex-languages.lua b/tex/generic/context/luatex/luatex-languages.lua
index 712118dbc..1ea8c1fd1 100644
--- a/tex/generic/context/luatex/luatex-languages.lua
+++ b/tex/generic/context/luatex/luatex-languages.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['luatex-languages'] = {
license = "see context related readme files"
}
--- We borrow fron ConTeXt.
+-- We borrow from ConTeXt.
languages = languages or { }