[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Be more permissive when parsing colors (b82702c)
Marcel Fabian Krüger
tex at 2krueger.de
Fri Feb 21 21:05:14 CET 2020
Repository : https://github.com/latex3/luaotfload
On branch : dev
Link : https://github.com/latex3/luaotfload/commit/b82702cbfe725ef6c80040694d9147bf526a2417
>---------------------------------------------------------------
commit b82702cbfe725ef6c80040694d9147bf526a2417
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date: Fri Feb 21 21:05:14 2020 +0100
Be more permissive when parsing colors
>---------------------------------------------------------------
b82702cbfe725ef6c80040694d9147bf526a2417
src/luaotfload-colors.lua | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/luaotfload-colors.lua b/src/luaotfload-colors.lua
index e39dc64..8f0d3b4 100644
--- a/src/luaotfload-colors.lua
+++ b/src/luaotfload-colors.lua
@@ -66,15 +66,16 @@ local lpeg = require"lpeg"
local lpegmatch = lpeg.match
local C, Cg, Ct, P, R, S = lpeg.C, lpeg.Cg, lpeg.Ct, lpeg.P, lpeg.R, lpeg.S
+local spaces = S"\t "^0
local digit16 = R("09", "af", "AF")
local opaque = S("fF") * S("fF")
local octet = digit16 * digit16 / function(s)
return tonumber(s, 16) / 255
end
-local extract_color = octet * octet * octet / function(r,g,b)
+local extract_color = spaces * octet * octet * octet / function(r,g,b)
return stringformat("%.3g %.3g %.3g rg", r, g, b)
- end * (octet - opaque + opaque)^-1 * -1
+ end * (opaque + octet)^-1 * spaces * -1
--- something is carried around in ``res``
--- for later use by color_handler() --- but what?
More information about the latex3-commits
mailing list.