summaryrefslogtreecommitdiff
path: root/src/fontloader/misc
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-10-20 07:25:42 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-10-20 07:25:42 +0200
commitb409613a112531013787984bbfb809b1bdda63bf (patch)
tree19aaadfca6f5f754aa25e1bc9b02d2f8d1cfd571 /src/fontloader/misc
parentaad248616a9e02c8684876d4ba61500930e7fceb (diff)
downloadluaotfload-b409613a112531013787984bbfb809b1bdda63bf.tar.gz
[fontloader] sync with Context as of 2016-10-20v2.8-rc3
Diffstat (limited to 'src/fontloader/misc')
-rw-r--r--src/fontloader/misc/fontloader-util-fil.lua26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/fontloader/misc/fontloader-util-fil.lua b/src/fontloader/misc/fontloader-util-fil.lua
index eb054a5..0f9731a 100644
--- a/src/fontloader/misc/fontloader-util-fil.lua
+++ b/src/fontloader/misc/fontloader-util-fil.lua
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['util-fil'] = {
local byte = string.byte
local char = string.char
-local extract = bit32.extract
+local extract = bit32 and bit32.extract
local floor = math.floor
-- Here are a few helpers (the starting point were old ones I used for parsing
@@ -206,17 +206,21 @@ function files.readfixed4(f)
end
end
-function files.read2dot14(f)
- local a, b = byte(f:read(2),1,2)
- local n = 0x100 * a + b
- local m = extract(n,0,30)
- if n > 0x7FFF then
- n = extract(n,30,2)
- return m/0x4000 - 4
- else
- n = extract(n,30,2)
- return n + m/0x4000
+if extract then
+
+ function files.read2dot14(f)
+ local a, b = byte(f:read(2),1,2)
+ local n = 0x100 * a + b
+ local m = extract(n,0,30)
+ if n > 0x7FFF then
+ n = extract(n,30,2)
+ return m/0x4000 - 4
+ else
+ n = extract(n,30,2)
+ return n + m/0x4000
+ end
end
+
end
function files.skipshort(f,n)