diff options
-rw-r--r-- | src/luaotfload-database.lua | 51 | ||||
-rwxr-xr-x | src/luaotfload-tool.lua | 31 |
2 files changed, 41 insertions, 41 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua index f5aacbc..58ad2ab 100644 --- a/src/luaotfload-database.lua +++ b/src/luaotfload-database.lua @@ -53,10 +53,13 @@ local require = require local tonumber = tonumber local unpack = table.unpack -local fontloaderinfo = fontloader.info -local fontloaderclose = fontloader.close -local fontloaderopen = fontloader.open ------ fontloaderto_table = fontloader.to_table +local fonts = fonts or { } +local fontshandlers = fonts.handlers or { } +local otfhandler = fonts.handlers.otf or { } +fonts.handlers = fontshandlers + +local otfreadersgetinfo = otfhandler.readers.getinfo + local gzipload = gzip.load local gzipsave = gzip.save local iolines = io.lines @@ -1224,24 +1227,8 @@ find_closest = function (name, limit) return false end --- find_closest() ---[[doc-- - - load_font_file -- Safely open a font file. See - <http://www.ntg.nl/pipermail/ntg-context/2013/075885.html> - regarding the omission of ``fontloader.close()``. - - TODO -- check if fontloader.info() is ready for prime in 0.78+ - -- fields /tables needed: - -- names - -- postscriptname - -- validation_state - -- .. - ---doc]]-- - local load_font_file = function (filename, subfont) - local rawfont, _msg = fontloaderopen (filename, subfont) - --local rawfont, _msg = fontloaderinfo (filename, subfont) + local rawfont, _msg = otfreadersgetinfo (filename, subfont) if not rawfont then logreport ("log", 1, "db", "ERROR: failed to open %s.", filename) return @@ -1293,9 +1280,7 @@ local get_english_names = function (metadata) end --[[-- - In case of broken PS names we set some dummies. However, we cannot - directly modify the font data as returned by fontloader.open() because - it is a userdata object. + In case of broken PS names we set some dummies. For this reason we copy what is necessary whilst keeping the table structure the same as in the tfmdata. @@ -1471,11 +1456,7 @@ ot_fullinfo = function (filename, return nil end - local rawinfo = get_raw_info (metadata, basename) - --- Closing the file manually is a tad faster and more memory - --- efficient than having it closed by the gc - fontloaderclose (metadata) - + local rawinfo = get_raw_info (metadata, basename) local english_names = get_english_names (rawinfo) local namedata = organize_namedata (rawinfo, english_names, @@ -1629,15 +1610,7 @@ local insert_fullinfo = function (fullname, targetentrystatus, info) - local subfont - if n_font ~= false then - subfont = n_font - 1 - else - subfont = false - n_font = 1 - end - - local fullinfo = loader (fullname, subfont, + local fullinfo = loader (fullname, n_font, location, basename, format, info) @@ -1722,7 +1695,7 @@ local read_font_names = function (fullname, --- 4) get basic info, abort if fontloader can’t read it - local info = fontloaderinfo (fullname) + local info = otfreadersgetinfo (fullname) if not info then logreport ("log", 1, "db", diff --git a/src/luaotfload-tool.lua b/src/luaotfload-tool.lua index 4b842dd..0981582 100755 --- a/src/luaotfload-tool.lua +++ b/src/luaotfload-tool.lua @@ -130,11 +130,38 @@ local backup = { texio.write, texio.write_nl = dummy_function, dummy_function require "fontloader-basics-gen.lua" - texio.write, texio.write_nl = backup.write, backup.write_nl utilities = backup.utilities -fonts = { names = { } } -- for db; normally provided by the fontloaders +require "fontloader-data-con" +require "fontloader-font-ini" +require "fontloader-font-con" +require "fontloader-fonts-enc" +require "fontloader-font-cid" +require "fontloader-font-map" +require "fontloader-font-tfm" +require "fontloader-font-afm" +require "fontloader-font-afk" +require "fontloader-font-oti" +require "fontloader-font-otr" +require "fontloader-font-cff" +require "fontloader-font-ttf" +require "fontloader-font-dsp" +require "fontloader-font-oup" +require "fontloader-font-otl" +require "fontloader-font-oto" +------- "fontloader-font-otj" +------- "fontloader-font-ota" +------- "fontloader-font-ots" +------- "fontloader-font-osd" +require "fontloader-font-lua" +require "fontloader-font-def" +require "fontloader-fonts-ext" +------- "fontloader-font-gbn" + +fonts = fonts or { } +local fontsnames = fonts.names or { } +fonts.names = fontsnames local require_init = { } |