diff options
Diffstat (limited to 'Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua')
-rw-r--r-- | Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua index a6cf63ffc9f..e02d22a6db9 100644 --- a/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua +++ b/Master/texmf-dist/tex/luatex/luaotfload/otfl-font-clr.lua @@ -15,8 +15,23 @@ local initializers, format = fonts.initializers, string.format table.insert(fonts.triggers,"color") function initializers.common.color(tfmdata,value) + local sanitized + if value then - tfmdata.color = tostring(value) + value = tostring(value) + if #value == 6 or #value == 8 then + sanitized = value + elseif #value == 7 then + _, _, sanitized = value:find("(......)") + elseif #value > 8 then + _, _, sanitized = value:find("(........)") + else + -- broken color code ignored, issue a warning? + end + end + + if sanitized then + tfmdata.color = sanitized add_color_callback() end end |