summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-04-09 18:29:31 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-04-09 18:29:34 +0200
commita02f276d8fd95bd0c644ec89f7822006baacf4b3 (patch)
treed51f232374a943e4ebc6e083ee31b0af1c86155b /src
parent61f0c68e868a58e7f1ddc929a441b3280a571331 (diff)
downloadluaotfload-a02f276d8fd95bd0c644ec89f7822006baacf4b3.tar.gz
[tool,db] kill off fontforge
This has been coming for some time: Upstream now provides full Opentype reader capabilities. This allows Luatex to drop those horrible fontforge libraries. Since the API is pretty similar, for Luaotfload it means little change and a decent speed gain. Though we still need to investigate whether the result is equivalent or at least acceptable.
Diffstat (limited to 'src')
-rw-r--r--src/luaotfload-database.lua51
-rwxr-xr-xsrc/luaotfload-tool.lua31
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 = { }