EXPERIMENTAL: Implement file callbacks

This commit is contained in:
Marcel Krüger 2020-07-15 16:36:11 +02:00
parent 7bea04d470
commit 063251b54f
16 changed files with 133 additions and 205 deletions

View file

@ -69,7 +69,7 @@ local function readpostnames(buf, i, usedcids, encoding)
return newusedcids
end
return function(filename, fontid, reencode)
local file <close> = readfile('subset', filename, nil)
local file <close> = readfile('truetype', filename)
local buf = file()
local magic, tables = sfnt.parse(buf, 1, fontid)
if magic ~= "\0\1\0\0" then error[[Invalid TTF font]] end