From 3c25716e01b7251f0f7504481692421a729e4b53 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Sun, 19 Apr 2020 20:29:51 +0200 Subject: 2020-04-19 19:24:00 --- metapost/context/base/mpiv/mp-lmtx.mpxl | 2 +- metapost/context/base/mpiv/mp-mlib.mpiv | 31 ++++++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'metapost') diff --git a/metapost/context/base/mpiv/mp-lmtx.mpxl b/metapost/context/base/mpiv/mp-lmtx.mpxl index cd4712ea8..543569822 100644 --- a/metapost/context/base/mpiv/mp-lmtx.mpxl +++ b/metapost/context/base/mpiv/mp-lmtx.mpxl @@ -2226,7 +2226,7 @@ vardef rawmaptext(expr s) = mfun_tt_c := nullpicture ; mfun_tt_o := nullpicture ; addto mfun_tt_o doublepath origin _op_ ; % save drawoptions - mfun_tt_r := lua.mp.mf_map_text(mfun_tt_n,s) ; + mfun_tt_r := lua.mp.mf_map_text(mfun_tt_n,s,catcoderegime) ; mfun_tt_s := lua.mp.mf_map_move(mfun_tt_n) ; addto mfun_tt_c doublepath unitsquare xscaled wdpart mfun_tt_r diff --git a/metapost/context/base/mpiv/mp-mlib.mpiv b/metapost/context/base/mpiv/mp-mlib.mpiv index 88bf56674..1aae87241 100644 --- a/metapost/context/base/mpiv/mp-mlib.mpiv +++ b/metapost/context/base/mpiv/mp-mlib.mpiv @@ -127,13 +127,27 @@ let transparency = pair ; % withtransparency (1,.5) % withtransparency ("normal",.5) -def withtransparency (expr t) (text rest) = +% def withtransparency (expr t) (text rest) = +% if pair t : +% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t) +% withprescript "tr_transparency=" & decimal ypart t +% else : +% mfun_with_transparency (transparency_alternative_to_number(t)) +% fi rest +% enddef ; +% +% def mfun_with_transparency (expr a) expr t = +% withprescript "tr_alternative=" & decimal a +% withprescript "tr_transparency=" & decimal t +% enddef ; + +def withtransparency expr t = if pair t : withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t) withprescript "tr_transparency=" & decimal ypart t else : mfun_with_transparency (transparency_alternative_to_number(t)) - fi rest + fi enddef ; def mfun_with_transparency (expr a) expr t = @@ -198,6 +212,17 @@ enddef ; rgbcolor mfun_tt_r ; +newinternal inicatcoderegime ; inicatcoderegime := runscript("return catcodes.numbers.ctxcatcodes") ; +newinternal texcatcoderegime ; texcatcoderegime := runscript("return catcodes.numbers.texcatcodes") ; +newinternal luacatcoderegime ; luacatcoderegime := runscript("return catcodes.numbers.luacatcodes") ; +newinternal notcatcoderegime ; notcatcoderegime := runscript("return catcodes.numbers.notcatcodes") ; +newinternal vrbcatcoderegime ; vrbcatcoderegime := runscript("return catcodes.numbers.vrbcatcodes") ; +newinternal prtcatcoderegime ; prtcatcoderegime := runscript("return catcodes.numbers.prtcatcodes") ; +newinternal ctxcatcoderegime ; ctxcatcoderegime := runscript("return catcodes.numbers.ctxcatcodes") ; +newinternal txtcatcoderegime ; txtcatcoderegime := runscript("return catcodes.numbers.txtcatcodes") ; + +newinternal catcoderegime ; catcoderegime := ctxcatcoderegime ; + vardef rawtextext(expr s) = if s = "" : nullpicture @@ -206,7 +231,7 @@ vardef rawtextext(expr s) = mfun_tt_c := nullpicture ; mfun_tt_o := nullpicture ; addto mfun_tt_o doublepath origin _op_ ; % save drawoptions - mfun_tt_r := lua.mp.mf_some_text(mfun_tt_n,s) ; + mfun_tt_r := lua.mp.mf_some_text(mfun_tt_n,s,catcoderegime) ; addto mfun_tt_c doublepath unitsquare xscaled wdpart mfun_tt_r yscaled (htpart mfun_tt_r + dppart mfun_tt_r) -- cgit v1.2.3