summaryrefslogtreecommitdiff
path: root/src/luaotfload-database.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg@phi-gamma.net>2016-04-09 22:20:10 +0200
committerPhilipp Gesang <phg@phi-gamma.net>2016-04-09 22:20:13 +0200
commit2a802efe6456f8cfeda53b6df1201413e199812f (patch)
tree7954604fa515af9e6d9ed550a110fecfe70c95ce /src/luaotfload-database.lua
parenta02f276d8fd95bd0c644ec89f7822006baacf4b3 (diff)
downloadluaotfload-2a802efe6456f8cfeda53b6df1201413e199812f.tar.gz
[conf,db] allow switching back to fontforge
There are some non-negligible differences in the reader output, especially concerning font names. Until this is sorted out we need a fast way to switch back to the old code for reference.
Diffstat (limited to 'src/luaotfload-database.lua')
-rw-r--r--src/luaotfload-database.lua21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/luaotfload-database.lua b/src/luaotfload-database.lua
index 58ad2ab..7c5e69b 100644
--- a/src/luaotfload-database.lua
+++ b/src/luaotfload-database.lua
@@ -58,7 +58,8 @@ local fontshandlers = fonts.handlers or { }
local otfhandler = fonts.handlers.otf or { }
fonts.handlers = fontshandlers
-local otfreadersgetinfo = otfhandler.readers.getinfo
+local read_font_file = otfhandler.readers.getinfo
+local read_font_info = read_font_file
local gzipload = gzip.load
local gzipsave = gzip.save
@@ -1228,7 +1229,7 @@ find_closest = function (name, limit)
end --- find_closest()
local load_font_file = function (filename, subfont)
- local rawfont, _msg = otfreadersgetinfo (filename, subfont)
+ local rawfont, _msg = read_font_file (filename, subfont)
if not rawfont then
logreport ("log", 1, "db", "ERROR: failed to open %s.", filename)
return
@@ -1695,7 +1696,7 @@ local read_font_names = function (fullname,
--- 4) get basic info, abort if fontloader can’t read it
- local info = otfreadersgetinfo (fullname)
+ local info = read_font_file (fullname)
if not info then
logreport ("log", 1, "db",
@@ -3419,6 +3420,17 @@ local show_cache = function ( )
return true
end
+local use_fontforge = function (val)
+ if val == true then
+ local fontloader = fontloader
+ read_font_info = fontloader.info
+ read_font_file = fontloader.open
+ else
+ read_font_file = otfhandler.readers.getinfo
+ read_font_info = read_font_file
+ end
+end
+
-----------------------------------------------------------------------
--- export functionality to the namespace “fonts.names”
-----------------------------------------------------------------------
@@ -3449,7 +3461,8 @@ local export = {
erase_cache = erase_cache,
show_cache = show_cache,
find_closest = find_closest,
- -- for testing purpose
+ --- transitionary
+ use_fontforge = use_fontforge,
}
return {