diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-main.lua | 23 | ||||
-rwxr-xr-x | src/luaotfload-tool.lua | 30 |
2 files changed, 34 insertions, 19 deletions
diff --git a/src/luaotfload-main.lua b/src/luaotfload-main.lua index 9e8d088..25be3db 100644 --- a/src/luaotfload-main.lua +++ b/src/luaotfload-main.lua @@ -13,9 +13,30 @@ local luaotfload = luaotfload luaotfload.log = luaotfload.log or { } luaotfload.version = "2.7" luaotfload.loaders = { } -luaotfload.min_luatex_version = 95 --- i. e. 0.95 +luaotfload.min_luatex_version = { 0, 95, 0 } --- i. e. 0.95.0 luaotfload.fontloader_package = "reference" --- default: from current Context +if not tex or not tex.luatexversion then + error "this program must be run in TeX mode" --- or call tex.initialize() =) +else + --- version check + local major = tex.luatexversion / 100 + local minor = tex.luatexversion % 100 + local revision = tex.luatexrevision --[[ : string ]] + local revno = tonumber (revision) + local minimum = luaotfload.min_luatex_version + if major < minimum [1] or minor < minimum [2] + or revno and revno < minimum [3] + then + texio.write_nl ("term and log", + string.format ("\tFATAL ERROR\n\z + \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z + \tPlease update your TeX distribution!\n\n", + (unpack or table.unpack) (minimum))) + error "version check failed" + end +end + local authors = "\z Hans Hagen,\z Khaled Hosny,\z diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 376aa39..9ffdbe6 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -7,10 +7,11 @@ -- LICENSE: GPL v2.0 ----------------------------------------------------------------------- -luaotfload = luaotfload or { } -local version = "2.7" -luaotfload.version = version -luaotfload.self = "luaotfload-tool" +luaotfload = luaotfload or { } +local version = "2.7" +luaotfload.version = version +luaotfload.min_luatex_version = { 0, 95, 0 } --- i. e. 0.95.0 +luaotfload.self = "luaotfload-tool" --[[doc-- @@ -33,16 +34,6 @@ see the luaotfload documentation for more info. Report bugs to kpse.set_program_name "luatex" ---[[doc-- - - We test for Lua 5.1 by means of capability detection to see if - we’re running an outdated Luatex. If so, we bail. - - \url{http://lua-users.org/wiki/LuaVersionCompatibility} - ---doc]]-- - - local iowrite = io.write local kpsefind_file = kpse.find_file local mathfloor = math.floor @@ -64,11 +55,14 @@ if _G.getfenv ~= nil then -- 5.1 or LJ if _G.jit ~= nil then runtime = { "jit", jit.version } else + local minimum = luaotfload.min_luatex_version runtime = { "stock", _VERSION } - print "FATAL ERROR" - print "Luaotfload requires a Luatex version >=0.76." - print "Please update your TeX distribution!" - os.exit (-1) + texio.write_nl ("term and log", + string.format ("\tFATAL ERROR\n\z + \tLuaotfload requires a Luatex version >= %d.%d.%d.\n\z + \tPlease update your TeX distribution!\n\n", + (unpack or table.unpack) (minimum))) + error "version check failed" end else -- 5.2 runtime = { "stock", _VERSION } |