summaryrefslogtreecommitdiff
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
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.
-rw-r--r--src/luaotfload-configuration.lua16
-rw-r--r--src/luaotfload-database.lua21
2 files changed, 33 insertions, 4 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua
index 32e1417..f82c827 100644
--- a/src/luaotfload-configuration.lua
+++ b/src/luaotfload-configuration.lua
@@ -203,6 +203,7 @@ local default_config = {
log_level = 0,
color_callback = "post_linebreak_filter",
fontloader = default_fontloader (),
+ use_fontforge = false,
},
misc = {
bisect = false,
@@ -369,6 +370,18 @@ local set_default_features = function ()
return true
end
+local set_fontforge = function ()
+ if not _G.fontloader then
+ logreport ("both", 0, "db", "The fontloader library is missing.")
+ return false
+ end
+ local names = fonts.names
+ if names and names.use_fontforge then
+ logreport ("log", 0, "db", "Loading font data with FontForge.")
+ names.use_fontforge (true)
+ end
+ return true
+end
reconf_tasks = {
{ "Set the log level" , set_loglevel },
@@ -377,6 +390,7 @@ reconf_tasks = {
{ "Set the font filter" , set_font_filter },
{ "Install font name resolver", set_name_resolver },
{ "Set default features" , set_default_features },
+ { "Set fontforge" , set_fontforge },
}
-------------------------------------------------------------------------------
@@ -509,6 +523,7 @@ local option_spec = {
id)
return id
end,
+ use_fontforge = { in_t = boolean_t, },
},
log_level = {
in_t = number_t,
@@ -672,6 +687,7 @@ local formatters = {
fontloader = { false, format_string },
log_level = { false, format_integer },
resolver = { false, format_string },
+ use_fontforge = { false, format_boolean },
},
}
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 {