summaryrefslogtreecommitdiff
path: root/src/luaotfload-main.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-05-03 00:09:40 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-05-03 00:10:06 +0200
commitdb2e9e6df994386a71d9cca126b55e2676eedfc3 (patch)
tree70515087f4b9575615ff4d608c8c9ac3c7fbd1a3 /src/luaotfload-main.lua
parent687430a81dcd658d664e6a8c7dca6f53bc093a8c (diff)
downloadluaotfload-db2e9e6df994386a71d9cca126b55e2676eedfc3.tar.gz
[main,tool] reintroduce lost version check
The version check was removed by accident in commit 5ce60cc98a30. This isn’t normally a problem except when people start to run the Pretest version on ancient Luatex binaries … In any case, the check must be present. While we’re at it, make the error messages consistent between the tool and a live TeX run. This can’t cover the fact that there is no (direct) means of determining the Luatex version when not running in TeX mode, so the checks still aren’t equivalent.
Diffstat (limited to 'src/luaotfload-main.lua')
-rw-r--r--src/luaotfload-main.lua23
1 files changed, 22 insertions, 1 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