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

Commit

Permalink
[fontloader] sync with Context as of 2016-10-20
Browse files Browse the repository at this point in the history
  • Loading branch information
phi-gamma committed Oct 20, 2016
1 parent aad2486 commit b409613
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
26 changes: 15 additions & 11 deletions src/fontloader/misc/fontloader-util-fil.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
26 changes: 14 additions & 12 deletions src/fontloader/runtime/fontloader-reference.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
-- merge date : 10/14/16 17:19:03
-- merge date : 10/19/16 22:51:32

do -- begin closure to overcome local limits and interference

Expand Down Expand Up @@ -4166,7 +4166,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
utilities=utilities or {}
local files={}
Expand Down Expand Up @@ -4328,16 +4328,18 @@ function files.readfixed4(f)
return n+(0x100*c+d)/0xFFFF
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)
Expand Down

0 comments on commit b409613

Please sign in to comment.