Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit b409613

Browse files
committed
[fontloader] sync with Context as of 2016-10-20
1 parent aad2486 commit b409613

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

src/fontloader/misc/fontloader-util-fil.lua

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['util-fil'] = {
88

99
local byte = string.byte
1010
local char = string.char
11-
local extract = bit32.extract
11+
local extract = bit32 and bit32.extract
1212
local floor = math.floor
1313

1414
-- Here are a few helpers (the starting point were old ones I used for parsing
@@ -206,17 +206,21 @@ function files.readfixed4(f)
206206
end
207207
end
208208

209-
function files.read2dot14(f)
210-
local a, b = byte(f:read(2),1,2)
211-
local n = 0x100 * a + b
212-
local m = extract(n,0,30)
213-
if n > 0x7FFF then
214-
n = extract(n,30,2)
215-
return m/0x4000 - 4
216-
else
217-
n = extract(n,30,2)
218-
return n + m/0x4000
209+
if extract then
210+
211+
function files.read2dot14(f)
212+
local a, b = byte(f:read(2),1,2)
213+
local n = 0x100 * a + b
214+
local m = extract(n,0,30)
215+
if n > 0x7FFF then
216+
n = extract(n,30,2)
217+
return m/0x4000 - 4
218+
else
219+
n = extract(n,30,2)
220+
return n + m/0x4000
221+
end
219222
end
223+
220224
end
221225

222226
function files.skipshort(f,n)

src/fontloader/runtime/fontloader-reference.lua

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
22
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
3-
-- merge date : 10/14/16 17:19:03
3+
-- merge date : 10/19/16 22:51:32
44

55
do -- begin closure to overcome local limits and interference
66

@@ -4166,7 +4166,7 @@ if not modules then modules={} end modules ['util-fil']={
41664166
}
41674167
local byte=string.byte
41684168
local char=string.char
4169-
local extract=bit32.extract
4169+
local extract=bit32 and bit32.extract
41704170
local floor=math.floor
41714171
utilities=utilities or {}
41724172
local files={}
@@ -4328,16 +4328,18 @@ function files.readfixed4(f)
43284328
return n+(0x100*c+d)/0xFFFF
43294329
end
43304330
end
4331-
function files.read2dot14(f)
4332-
local a,b=byte(f:read(2),1,2)
4333-
local n=0x100*a+b
4334-
local m=extract(n,0,30)
4335-
if n>0x7FFF then
4336-
n=extract(n,30,2)
4337-
return m/0x4000-4
4338-
else
4339-
n=extract(n,30,2)
4340-
return n+m/0x4000
4331+
if extract then
4332+
function files.read2dot14(f)
4333+
local a,b=byte(f:read(2),1,2)
4334+
local n=0x100*a+b
4335+
local m=extract(n,0,30)
4336+
if n>0x7FFF then
4337+
n=extract(n,30,2)
4338+
return m/0x4000-4
4339+
else
4340+
n=extract(n,30,2)
4341+
return n+m/0x4000
4342+
end
43414343
end
43424344
end
43434345
function files.skipshort(f,n)

0 commit comments

Comments
 (0)