diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2015-04-20 22:33:36 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2015-04-20 22:34:47 +0200 |
commit | e30cc832b620522daf3243fa81e190fec9328ce6 (patch) | |
tree | e5e1794b20fb76f197f3e34bc9d5e1621a324c9e /src | |
parent | da74e7f4d597b566ad99c995f2dd49fb41e218e0 (diff) | |
download | luaotfload-e30cc832b620522daf3243fa81e190fec9328ce6.tar.gz |
[conf] move colorization to post_linebreak_filter
Addresses this behavior: http://tex.stackexchange.com/q/238539/14066
This is a breaking change but it hardly matters since font-based
colorization is deprecated and the old behavior can be restored by means
of a configuration setting.
Diffstat (limited to 'src')
-rw-r--r-- | src/luaotfload-configuration.lua | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/luaotfload-configuration.lua b/src/luaotfload-configuration.lua index 657d671..7791503 100644 --- a/src/luaotfload-configuration.lua +++ b/src/luaotfload-configuration.lua @@ -144,6 +144,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 @@ -479,9 +496,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, }, }, |