This repository was archived by the owner on Sep 27, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +29
-23
lines changed
Expand file tree Collapse file tree 2 files changed +29
-23
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ if not modules then modules = { } end modules ['util-fil'] = {
88
99local byte = string.byte
1010local char = string.char
11- local extract = bit32.extract
11+ local extract = bit32 and bit32 .extract
1212local 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
207207end
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+
220224end
221225
222226function files .skipshort (f ,n )
Original file line number Diff line number Diff line change 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
55do -- begin closure to overcome local limits and interference
66
@@ -4166,7 +4166,7 @@ if not modules then modules={} end modules ['util-fil']={
41664166}
41674167local byte=string.byte
41684168local char=string.char
4169- local extract=bit32.extract
4169+ local extract=bit32 and bit32 .extract
41704170local floor=math.floor
41714171utilities=utilities or {}
41724172local files={}
@@ -4328,16 +4328,18 @@ function files.readfixed4(f)
43284328 return n+(0x100*c+d)/0xFFFF
43294329 end
43304330end
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
43424344end
43434345function files.skipshort(f,n)
You can’t perform that action at this time.
0 commit comments