summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
committerKarl Berry <karl@freefriends.org>2021-03-06 21:58:15 +0000
commit974640d66e61e81cb197ad96fdff7b08343e4c5a (patch)
tree2e1f75f32f312b7f24ba82b4590ae230bcd6f399 /Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv
parentb4fa72e61230aca75f7f6fbf988821f71edfb6b2 (diff)
context
git-svn-id: svn://tug.org/texlive/trunk@58167 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv')
-rw-r--r--Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv41
1 files changed, 30 insertions, 11 deletions
diff --git a/Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv b/Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv
index 88bf566749a..fe00b55356d 100644
--- a/Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv
+++ b/Master/texmf-dist/metapost/context/base/mpiv/mp-mlib.mpiv
@@ -112,12 +112,14 @@ def transparent(expr a, t)(text c) = % use withtransparency instead
withcolor c
enddef ;
-% def withtransparency(expr a, t) =
-% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(a)
-% withprescript "tr_transparency=" & decimal t
-% enddef ;
+def withtransparency(expr a, t) =
+ withprescript "tr_alternative=" & decimal transparency_alternative_to_number(a)
+ withprescript "tr_transparency=" & decimal t
+enddef ;
-let transparency = pair ;
+% no, not compatible ... maybe only mpiv .. maybe withopacity
+
+% let opacity = pair ;
% def withtransparency expr t =
% withprescript "tr_alternative=" & decimal transparency_alternative_to_number(xpart t)
@@ -126,22 +128,28 @@ let transparency = pair ;
%
% withtransparency (1,.5)
% withtransparency ("normal",.5)
+%
+% withopacity (1,.5)
+% withopacity (normaltransparency,.5)
+% withopacity .5
-def withtransparency (expr t) (text rest) =
+def withopacity 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
+ mfun_with_opacity (transparency_alternative_to_number(t))
+ fi
enddef ;
-def mfun_with_transparency (expr a) expr t =
+def mfun_with_opacity (expr a) expr t =
withprescript "tr_alternative=" & decimal a
withprescript "tr_transparency=" & decimal t
enddef ;
-def cmyk(expr c, m, y, k) = % provided for downward compability
+% Provided for downward compability:
+
+def cmyk(expr c, m, y, k) =
(c,m,y,k)
enddef ;
@@ -198,6 +206,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 +225,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)