diff options
Diffstat (limited to 'src/luaotfload-configuration.lua')
-rw-r--r-- | src/luaotfload-configuration.lua | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index b198697..e9393c5 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -2,17 +2,18 @@ ------------------------------------------------------------------------------- -- FILE: luaotfload-configuration.lua -- DESCRIPTION: config file reader --- REQUIREMENTS: Luaotfload 2.5 or above +-- REQUIREMENTS: Luaotfload 2.6 or above -- AUTHOR: Philipp Gesang (Phg), <phg42.2a@gmail.com> +-- AUTHOR: Dohyun Kim <nomosnomos@gmail.com> -- VERSION: same as Luaotfload --- MODIFIED: 2015-03-16 07:48:58+0100 +-- MODIFIED: 2015-05-05 ------------------------------------------------------------------------------- -- if not modules then modules = { } end modules ["luaotfload-configuration"] = { - version = "2.5", + version = "2.6", comment = "part of Luaotfload", - author = "Philipp Gesang", + author = "Philipp Gesang, Dohyun Kim", copyright = "Luaotfload Development Team", license = "GNU GPL v2.0" } @@ -144,6 +145,23 @@ local registered_loaders = { tl2013 = "tl2013", } +--[[doc-- + + The ``post_linebreak_filter`` has been made the default callback for + hooking the colorizer into. This helps with the linebreaking whose + inserted hyphens would remain unaffected by the coloring otherwise. + + http://tex.stackexchange.com/q/238539/14066 + +--doc]]-- + +local permissible_color_callbacks = { + default = "post_linebreak_filter", + pre_linebreak_filter = "pre_linebreak_filter", + post_linebreak_filter = "post_linebreak_filter", + pre_output_filter = "pre_output_filter", +} + ------------------------------------------------------------------------------- --- DEFAULTS @@ -163,7 +181,7 @@ local default_config = { resolver = "cached", definer = "patch", log_level = 0, - color_callback = "pre_linebreak_filter", + color_callback = "post_linebreak_filter", live = true, }, misc = { @@ -479,9 +497,20 @@ local option_spec = { color_callback = { in_t = string_t, out_t = string_t, - transform = function (cb) + transform = function (cb_spec) --- These are the two that make sense. - return cb == "pre_output_filter" and cb or "pre_linebreak_filter" + local cb = permissible_color_callbacks[cb_spec] + if cb then + logreport ("log", 3, "conf", + "Using callback \"%s\" for font colorization.", + cb) + return cb + end + logreport ("log", 0, "conf", + "Requested callback identifier \"%s\" invalid, " + .. "falling back to default.", + cb_spec) + return permissible_color_callbacks.default end, }, }, |