From 0f880d73d8a537d8b38f95c184a6b96f2a20d28b Mon Sep 17 00:00:00 2001 From: Dohyun Kim Date: Sat, 7 Dec 2024 05:25:40 +0900 Subject: [PATCH] allow user input of tr_alternative --- luamplib.dtx | 5 +++-- test-luamplib-latex.tex | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/luamplib.dtx b/luamplib.dtx index a1e15b1..d42a72f 100644 --- a/luamplib.dtx +++ b/luamplib.dtx @@ -3379,9 +3379,10 @@ local function do_preobj_TR(object,prescript) if opaq then local key, on, os, new local mode = prescript.tr_alternative or 1 - mode = transparancy_modes[tonumber(mode) or mode] + mode = transparancy_modes[tonumber(mode) or mode:lower()] if not mode then - warn("unsupported blend mode: '%s'", prescript.tr_alternative) + mode = prescript.tr_alternative + warn("unsupported blend mode: '%s'", mode) end opaq = format("%.3f", opaq) :gsub(decimals,rmzeros) for i,v in ipairs{ {mode,opaq},{"Normal",1} } do diff --git a/test-luamplib-latex.tex b/test-luamplib-latex.tex index a4248a2..71a87ae 100644 --- a/test-luamplib-latex.tex +++ b/test-luamplib-latex.tex @@ -345,7 +345,9 @@ draw test withpattern "mypatt" ; \endmpfig \mpfig - draw maketext "\bfseries\TeX" rotated 30 scaled 3 + picture tex; + tex = mplibgraphictext "\bfseries\TeX" rotated 30 scaled 4; + draw tex withshadingmethod "linear" withshadingvector (3,0) withshadingcolors (red,blue)