summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2015-08-02 21:30:11 +0000
committerKarl Berry <karl@freefriends.org>2015-08-02 21:30:11 +0000
commit008ccd78c7a2d5abf3e17cb872cf1536f6192ecb (patch)
treecb695f25ce68937d55251cd88fb1a6060c8434a8 /Master
parent4e51893dc61b666c78c79b6d8e7d62bc7db04a9d (diff)
roundrect (2aug15)
git-svn-id: svn://tug.org/texlive/trunk@38023 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/metapost/roundrect/CHANGES10
-rw-r--r--Master/texmf-dist/doc/metapost/roundrect/README8
-rw-r--r--Master/texmf-dist/doc/metapost/roundrect/roundrect.pdfbin193250 -> 184897 bytes
-rw-r--r--Master/texmf-dist/metapost/roundrect/roundrect.mp219
-rw-r--r--Master/texmf-dist/source/metapost/roundrect/roundrect.dtx601
5 files changed, 398 insertions, 440 deletions
diff --git a/Master/texmf-dist/doc/metapost/roundrect/CHANGES b/Master/texmf-dist/doc/metapost/roundrect/CHANGES
new file mode 100644
index 00000000000..60cb9ee6856
--- /dev/null
+++ b/Master/texmf-dist/doc/metapost/roundrect/CHANGES
@@ -0,0 +1,10 @@
+v2.0, released on 1 August 2015: complete rewrite. The
+code is much cleaner and works better and more consistently.
+Removed all the "titlebar" options; it's better to form such
+things out of an entirely separate rectangle. Much more
+granular control over appearance. Also several
+"convenience" macros to allow adjusting multiple, related
+settings at one time.
+
+v1.0, released on 29 July 2015: initial release. All basic
+functionality implemented.
diff --git a/Master/texmf-dist/doc/metapost/roundrect/README b/Master/texmf-dist/doc/metapost/roundrect/README
index 65e0a60e919..6cd870a7731 100644
--- a/Master/texmf-dist/doc/metapost/roundrect/README
+++ b/Master/texmf-dist/doc/metapost/roundrect/README
@@ -20,9 +20,5 @@ along with the generated files roundrect.mp and roundrect.pdf,
along with this README.
The roundrect macros for Metapost provide ways to produce
-rounded rectangles, which may or may not contain a title bar
-or text (the title bar may itself contain text). They are
-extremely configurable.
-
-v1.0, released on 29 July 2015: initial release. All basic
-functionality implemented.
+rounded rectangles, which may or may not contain or text.
+They are extremely configurable.
diff --git a/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf b/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
index f0e1bc1455b..82e897485d2 100644
--- a/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
+++ b/Master/texmf-dist/doc/metapost/roundrect/roundrect.pdf
Binary files differ
diff --git a/Master/texmf-dist/metapost/roundrect/roundrect.mp b/Master/texmf-dist/metapost/roundrect/roundrect.mp
index e14be7511e4..6dbde535544 100644
--- a/Master/texmf-dist/metapost/roundrect/roundrect.mp
+++ b/Master/texmf-dist/metapost/roundrect/roundrect.mp
@@ -26,55 +26,67 @@
%% roundrect.ins, along with the generated file roundrect.mp
%% and roundrect.pdf, and the README.
-
input TEX;
color rrinnercolor; rrinnercolor := white;
-color rrbordercolor; rrbordercolor := black;
-numeric rrborderwd; rrborderwd := 2pt;
-numeric rrborderrad; rrborderrad := 40pt;
-string rrtitlefont; rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+numeric rrtoprtborderrad; rrtoprtborderrad := 40pt;
+numeric rrbotrtborderrad; rrbotrtborderrad := 40pt;
+numeric rrbotlftborderrad; rrbotlftborderrad := 40pt;
+numeric rrtoplftborderrad; rrtoplftborderrad := 40pt;
+numeric rrtextwd; rrtextwd := 0;
string rrtextfont; rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
-color rrtitlecolor; rrtitlecolor := black;
color rrtextcolor; rrtextcolor := black;
-color rrtitlebgcolor; rrtitlebgcolor := white;
-color rrtitlebordercolor; rrtitlebordercolor := black;
-boolean rrtitlebar; rrtitlebar := false;
-string rrtitleside; rrtitleside := "top";
-numeric rrtitleht; rrtitleht := 0pt;
-string rrtitlepos; rrtitlepos := "center";
-boolean rrtitlebotborder; rrtitlebotborder := true;
-color rrtitlebotbordercolor; rrtitlebotbordercolor := black;
-string rrtitletext; rrtitletext := "";
string rrbodytext; rrbodytext := "";
-string rrbodyalign; rrbodyalign := "justify";
-string rrbodyaligncom; rrbodyaligncom := "";
+string rrtextalign; rrtextalign := "\centering";
+boolean rrnotop; rrnotop := false;
+boolean rrnobot; rrnobot := false;
+boolean rrnolft; rrnolft := false;
+boolean rrnort; rrnort := false;
+color rrtopbordercolor; rrtopbordercolor := black;
+color rrbotbordercolor; rrbotbordercolor := black;
+color rrlftbordercolor; rrlftbordercolor := black;
+color rrrtbordercolor; rrrtbordercolor := black;
+def rrbordercolor(expr x) =
+rrtopbordercolor := x;
+rrbotbordercolor := x;
+rrlftbordercolor := x;
+rrrtbordercolor := x;
+enddef;
+def rrborderrad(expr x) =
+rrtoplftborderrad := x;
+rrbotlftborderrad := x;
+rrtoprtborderrad := x;
+rrbotrtborderrad := x;
+enddef;
+pen rrtopborderpen; rrtopborderpen := pencircle scaled 1.5;
+pen rrbotborderpen; rrbotborderpen := pencircle scaled 1.5;
+pen rrlftborderpen; rrlftborderpen := pencircle scaled 1.5;
+pen rrrtborderpen; rrrtborderpen := pencircle scaled 1.5;
+def rrborderpen(expr x) =
+rrtopborderpen := x;
+rrbotborderpen := x;
+rrlftborderpen := x;
+rrrtborderpen := x;
+enddef;
def rrrestorevals =
+rrborderrad(40pt);
+rrbordercolor(black);
+rrborderpen(pencircle scaled 1.5);
rrinnercolor := white;
-rrbordercolor := black;
-rrborderwd := 2pt;
-rrborderrad := 40pt;
-rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+rrnotop := false;
+rrnobot := false;
+rrnolft := false;
+rrnort := false;
+rrtextwd := 0;
rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
-rrtitlecolor := black;
rrtextcolor := black;
-rrtitlebgcolor := white;
-rrtitlebordercolor := black;
-rrtitlebar := false;
-rrtitleside := "top";
-rrtitleht := 0pt;
-rrtitlepos := "center";
-rrtitlebotborder := true;
-rrtitlebotbordercolor := black;
-rrtitletext := "";
rrbodytext := "";
-rrbodyalign := "justify";
-rrbodyaligncom := "";
+rrtextalign; rrtextalign := "\centering";
enddef;
def roundrect(expr rrht, rrwd)(suffix name) =
TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}");
TEXPOST("\end{document}");
-if (rrtitleht = 0pt):
-rrtitleht := rrht/6;
+if (rrtextwd = 0):
+rrtextwd := rrwd - 12pt;
fi
path rra; path rrb; path rrc; path rrd;
pair a; pair b; pair c; pair d;
@@ -82,14 +94,14 @@ a := (0,0) shifted (-rrwd/2,-rrht/2);
b := (0,0) shifted (rrwd/2,-rrht/2);
c := (0,0) shifted (rrwd/2,rrht/2);
d := (0,0) shifted (-rrwd/2,rrht/2);
-rra := fullcircle scaled rrborderrad shifted (xpart a +
-(rrborderrad/2),ypart a + (rrborderrad/2));
-rrb := fullcircle scaled rrborderrad shifted (xpart b -
-(rrborderrad/2),ypart b + (rrborderrad/2));
-rrd := fullcircle scaled rrborderrad shifted (xpart d +
-(rrborderrad/2),ypart d - (rrborderrad/2));
-rrc := fullcircle scaled rrborderrad shifted (xpart c -
-(rrborderrad/2),ypart c - (rrborderrad/2));
+rra := fullcircle scaled rrbotlftborderrad shifted (xpart a +
+(rrbotlftborderrad/2),ypart a + (rrbotlftborderrad/2));
+rrb := fullcircle scaled rrbotrtborderrad shifted (xpart b -
+(rrbotrtborderrad/2),ypart b + (rrbotrtborderrad/2));
+rrd := fullcircle scaled rrtoplftborderrad shifted (xpart d +
+(rrtoplftborderrad/2),ypart d - (rrtoplftborderrad/2));
+rrc := fullcircle scaled rrtoprtborderrad shifted (xpart c -
+(rrtoprtborderrad/2),ypart c - (rrtoprtborderrad/2));
pair f; f := (a--b) intersectionpoint rra;
pair g; g := (a--b) intersectionpoint rrb;
pair h; h := (b--c) intersectionpoint rrb;
@@ -100,92 +112,49 @@ pair l; l := (d--a) intersectionpoint rrd;
pair m; m := (d--a) intersectionpoint rra;
picture name;
picture border;
-pair n; pair o; path rrtitlepath; path rrfinalline;
-name := image(fill f--g{right}..{up}h--i{up}..{left}j--
-k{left}..{down}l--m{down}..{right}f--cycle
-withcolor rrinnercolor);
-border := image(pickup pencircle scaled rrborderwd;
-draw f--g{right}..{up}h--i{up}..{left}j--
-k{left}..{down}l--m{down}..{right}f--cycle
-withcolor rrbordercolor);
-addto name also border;
-pair rrtitlestation;
-picture rrtitlelabel;
-if (rrtitlebar):
-if (rrtitleside = "top"):
-n := (xpart m,ypart k - (rrtitleht));
-o := (xpart i,ypart k - (rrtitleht));
-defaultscale := 4;
-if (ypart n > ypart l):
-n := (xpart n,ypart l);
-o := (xpart o,ypart l);
-fi
-rrtitlepath := o--i{up}..{left}j--k{left}..{down}l--n;
-if (rrtitlepos = "center"):
-rrtitlestation := 0.5[n,o] shifted (0,rrtitleht/2);
-elseif (rrtitlepos = "left"):
-rrtitlestation := n shifted (rrborderrad/4,rrtitleht/2);
-elseif (rrtitlepos = "right"):
-rrtitlestation := o shifted (-rrborderrad/4,rrtitleht/2);
+picture rrtext;
+pair n; pair o;
+path rrtoplftcorner; path rrbotlftcorner;
+path rrtoprtcorner; path rrbotrtcorner;
+path rrtopborder; path rrbotborder;
+path rrlftborder; path rrrtborder;
+rrtoplftcorner := l{up}..{right}k;
+rrtoprtcorner := j{right}..{down}i;
+rrbotrtcorner := h{down}..{left}g;
+rrbotlftcorner := f{left}..{up}m;
+rrtopborder := rrtoplftcorner--rrtoprtcorner;
+rrbotborder := rrbotrtcorner--rrbotlftcorner;
+rrlftborder := rrbotlftcorner--rrtoplftcorner;
+rrrtborder := rrtoprtcorner--rrbotrtcorner;
+name := image(fill rrtoplftcorner--rrtoprtcorner--
+rrbotrtcorner--rrbotlftcorner--cycle withcolor
+rrinnercolor);
+picture rrtmpborder;
+border := currentpicture;
+if (rrnotop = false):
+rrtmpborder := image(draw rrtopborder withcolor
+rrtopbordercolor withpen rrtopborderpen);
+addto border also rrtmpborder;
fi
-elseif (rrtitleside = "bot"):
-n := (xpart m,ypart f + (rrtitleht));
-o := (xpart i,ypart f + (rrtitleht));
-if (ypart n < ypart m):
-n := (xpart n,ypart m);
-o := (xpart o,ypart m);
+if (rrnobot = false):
+rrtmpborder := image(draw rrbotborder withcolor
+rrbotbordercolor withpen rrbotborderpen);
+addto border also rrtmpborder;
fi
-rrtitlepath := o--h{down}..{left}g--f{left}..{up}m--n;
-if (rrtitlepos = "center"):
-rrtitlestation := 0.5[n,o] shifted (0,-rrtitleht/2);
-elseif (rrtitlepos = "left"):
-rrtitlestation := n shifted (rrborderrad/4,-rrtitleht/2);
-elseif (rrtitlepos = "right"):
-rrtitlestation := o shifted (-rrborderrad/4,-rrtitleht/2);
+if (rrnolft = false):
+rrtmpborder := image(draw rrlftborder withcolor
+rrlftbordercolor withpen rrlftborderpen);
+addto border also rrtmpborder;
fi
+if (rrnort = false):
+rrtmpborder := image(draw rrrtborder withcolor
+rrrtbordercolor withpen rrrtborderpen);
+addto border also rrtmpborder;
fi
-rrfinalline = n--o;
-picture rrtitlepic;
-picture rrtitlepicb;
-picture rrtitlebotborderpic;
-rrtitlebotborderpic := image (draw rrfinalline
-withcolor rrtitlebotbordercolor);
-rrtitlepicb := image(draw rrtitlepath withcolor rrtitlebordercolor);
-if (rrtitlebotborder = true):
-addto rrtitlepicb also rrtitlebotborderpic;
-fi
-rrtitlepath := buildcycle(rrtitlepath,rrfinalline);
-rrtitlepic := image(fill rrtitlepath withcolor rrtitlebgcolor);
-if (rrtitlepos = "center"):
-rrtitlelabel := image(label(TEX(rrtitlefont&" "&rrtitletext),
-rrtitlestation) withcolor rrtitlecolor);
-elseif (rrtitlepos = "left"):
-rrtitlelabel := image(label.rt(TEX(rrtitlefont&" "&rrtitletext),
-rrtitlestation) withcolor rrtitlecolor);
-elseif (rrtitlepos = "right"):
-rrtitlelabel := image(label.lft(TEX(rrtitlefont&" "&rrtitletext),
-rrtitlestation) withcolor rrtitlecolor);
-fi
-if (rrbodyalign = "center"):
-rrbodyaligncom := "\centering ";
-elseif (rrbodyalign = "left"):
-rrbodyaligncom := "\flushleft\vskip-\baselineskip ";
-elseif (rrbodyalign = "right"):
-rrbodyaligncom := "\flushright\vskip-\baselineskip ";
-fi
-picture rrbodytextpic;
-if (rrtitleside = "top"):
-rrbodytextpic :=
-image(label.lrt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
-elseif (rrtitleside = "bot"):
-rrbodytextpic :=
-image(label.urt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
-fi
-addto name also rrtitlepic;
-addto name also rrtitlepicb;
-addto name also rrtitlelabel;
-addto name also rrbodytextpic;
-fi
+addto name also border;
+rrtext :=
+image(label(TEX("\parbox{"&decimal(rrtextwd)&"bp}{"&rrtextalign&rrtextfont&" "&rrbodytext&"}"),(0,0)) withcolor rrtextcolor;);
+addto name also rrtext;
enddef;
\endinput
%%
diff --git a/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx b/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
index 4a00a6a33b5..3ffe2344a13 100644
--- a/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
+++ b/Master/texmf-dist/source/metapost/roundrect/roundrect.dtx
@@ -56,7 +56,7 @@
\end{document}
%</driver>
% \fi
-% \title{The \texttt{roundrect} Macros, v1.0}
+% \title{The \texttt{roundrect} Macros, v2.0}
% \author{Donald P.\ Goodman III}
% \date{\today}
%
@@ -118,7 +118,8 @@
%
% \section{Basic Usage}
%
-% The core of all the action is the |roundrect| macro; this
+% The core of all the action is the
+% \DescribeMacro{roundrect}|roundrect| macro; this
% will set up your rounded rectangle in the plainest
% way possible. The first argument is the box's height, the
% second its width, and the third its name, by which you
@@ -134,348 +135,373 @@
% \end{mpost}
% }%
%
-% We have some options with this. If you want a title bar
-% in your box, say
-% \DescribeMacro{rrtitlebar}|rrtitlebar := true;|:
+% All the corners don't \emph{have} to be rounded; we can
+% make them square if we want. To do things like this, we
+% use the macro
+% \DescribeMacro{rrborderrad()}|rrborderrad()|, which takes
+% a single argument giving the border radius we want; that
+% is, how rounded we want the corners of our rectangle.
+% Higher values will be more rounded, lower values will be
+% less:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
+% \hbox{|rrborderrad(10pt);|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
+% rrborderrad(10pt);
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% By default, |roundrect| displays a lower border for the
-% title bar; if you don't like this, say
-% \DescribeMacro{rrtitlebotborder}
-% |rrtitlebotborder := false;|:
+% Notice that the corners in this, with |rrborderrad()| set
+% to |10pt|, are much less rounded than the previous
+% example. The default border radius is |40pt|, which is
+% quite rounded.
+%
+% |rrborderrad()| provides an easy way to set the border
+% radius of all four corners at once; however, we can also
+% control each corner individually, with
+% \DescribeMacro{rrtoplftborderrad}|rrtoplftborderrad|,
+% \DescribeMacro{rrbotlftborderrad}|rrbotlftborderrad|,
+% \DescribeMacro{rrtoprtborderrad}|rrtoprtborderrad|, and
+% \DescribeMacro{rrbotrtborderrad}|rrbotrtborderrad|, which
+% are parameters rather than macros; that is, we define them
+% using |:=| rather than as an argument in parentheses:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrtitlebotborder := false;|}
+% \hbox{|rrtoplftborderrad := 20pt;|}
+% \hbox{|rrbotlftborderrad := 40pt;|}
+% \hbox{|rrtoprtborderrad := 10pt;|}
+% \hbox{|rrbotrtborderrad := 60pt;|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebotborder := false;
-% rrtitlebar := true;
+% rrtoplftborderrad := 20pt;
+% rrbotlftborderrad := 40pt;
+% rrtoprtborderrad := 10pt;
+% rrbotrtborderrad := 60pt;
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% The command is called |rrtitlebotborder| because it's
-% usually on the bottom of the title bar; however, it
-% retains this name even when the title bar is elsewhere.
-%
-% Although it's impossible to tell whether this box still
-% has a title bar, we can verify it (if we don't believe it)
-% by changing the background color with
-% \DescribeMacro{rrtitlebgcolor}|rrtitlebgcolor|:
+% As you can see, this makes it possible to create a large
+% variety of shapes, including the ability to arbitrarily
+% flatten any side of the rectangle desired just by setting
+% the border radius of the appropriate corners to |0pt|:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrtitlebotborder := false;|}
-% \hbox{|rrtitlebgcolor := green;|}
+% \hbox{|rrtoplftborderrad := 0pt;|}
+% \hbox{|rrtoprtborderrad := 0pt;|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebotborder := false;
-% rrtitlebar := true;
-% rrtitlebgcolor := green;
+% rrtoplftborderrad := 0pt;
+% rrtoprtborderrad := 0pt;
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% And while we're at it, we may as well color the background
-% of the main part of the box with
-% \DescribeMacro{rrinnercolor}|rrinnercolor|:
+% Here, we've flattened the top border by setting the top
+% right and top left corners' border radii to |0pt|.
+% This ability to flatten any given side of the rectangle
+% makes it much easier to combine multiple rectangles into
+% interesting forms, which we'll see a bit more about later.
+%
+% Of course, the color of both the background and the border
+% can be controlled with
+% \DescribeMacro{rrinnercolor}|rrinnercolor| and
+% \DescribeMacro{rrbordercolor}|rrbordercolor()|,
+% respectively.
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrtitlebotborder := false;|}
-% \hbox{|rrinnercolor := blue;|}
-% \hbox{|rrtitlebgcolor := green;|}
+% \hbox{|rrbordercolor(blue);|}
+% \hbox{|rrinnercolor := red;|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
-% rrtitlebotborder := false;
-% rrinnercolor := blue;
-% rrtitlebgcolor := green;
+% rrbordercolor(blue);
+% rrinnercolor := red;
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% We can also change the colors of the border around the box
-% (\DescribeMacro{rrbordercolor}|rrbordercolor|), the colors
-% of the title bar's border
-% (\DescribeMacro{rrtitlebordercolor}|rrtitlebordercolor|),
-% and the line between the title bar and the body, if any
-% (\DescribeMacro{rrtitlebotbordercolor}|rrtitlebotbordercolor|):
+% By default, |rrinnercolor| is white and |rrbordercolor| is
+% black. Notice that |rrbordercolor| is a \emph{macro}, not
+% a parameter; that's because each border can be
+% individually colored, and this macro simply does all of
+% them at once. We'll see more about that later.
+%
+% You can also completely suppress the border by using
+% \DescribeMacro{rrnotop}|rrnotop|,
+% \DescribeMacro{rrnobot}|rrnobot|,
+% \DescribeMacro{rrnolft}|rrnolft|, and
+% \DescribeMacro{rrnort}|rrnort|, which is particularly
+% useful when you want to combine multiple rectangles
+% without making an obvious border between them. You can
+% combine these in any way you like:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrtitlebotborder := false;|}
-% \hbox{|rrinnercolor := blue;|}
-% \hbox{|rrbordercolor := (0,1,1);|}
-% \hbox{|rrtitlebordercolor := (1,1,0);|}
-% \hbox{|rrtitlebotbordercolor := red;|}
-% \hbox{|rrtitlebotbordercolor := red;|}
-% \hbox{|rrtitlebgcolor := green;|}
+% \hbox{|rrbordercolor(blue);|}
+% \hbox{|rrinnercolor := red;|}
+% \hbox{|rrnotop := true;|}
+% \hbox{|rrnobot := true;|}
+% \hbox{|rrborderrad(0pt);|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
-% rrtitlebotborder := true;
-% rrinnercolor := blue;
-% rrbordercolor := (0,1,1);
-% rrtitlebordercolor := (1,1,0);
-% rrtitlebotbordercolor := red;
-% rrtitlebgcolor := green;
+% rrbordercolor(blue);
+% rrinnercolor := red;
+% rrnotop := true;
+% rrnobot := true;
+% rrborderrad(0pt);
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% If there is no title bar, then |rrinnercolor| and
-% |rrbordercolor| will affect the entire box:
+% Here we've squared all the corners to make it easier to
+% see what's going on.
+%
+% Each border can be colored individually and separately
+% from the others, using the commands you'd expect:
%
% \demonstrate{%
-% \hbox{|rrinnercolor := red;|}
-% \hbox{|rrbordercolor := blue;|}
+% \hbox{|rrtopbordercolor := blue;|}
+% \hbox{|rrbotbordercolor := green;|}
+% \hbox{|rrlftbordercolor := red;|}
+% \hbox{|rrrtbordercolor := black;|}
+% \hbox{|rrborderrad(20pt);|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrinnercolor := red;
-% rrbordercolor := blue;
+% rrtopbordercolor := blue;
+% rrbotbordercolor := green;
+% rrlftbordercolor := red;
+% rrrtbordercolor := black;
+% rrborderrad(20pt);
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }%
%
-% We can put text in the title bar with
-% \DescribeMacro{rrtitletext}|rrtitletext| (which is colored
-% by \DescribeMacro{rrtitlecolor}|rrtitlecolor|) and
-% \DescribeMacro{rrbodytext}|rrbodytext| (which is colored
-% by \DescribeMacro{rrtextcolor}|rrbodytextcolor|):
+% There is obviously some difficulty in determining what
+% part of each rounded corner should be colored how; this
+% ability is typically more useful with a single, flattened
+% side, to help it blend in better when combined with other
+% constructs:
%
% \demonstrate{%
+% \hbox{|rrbordercolor(black);|}
+% \hbox{|rrbotbordercolor := green;|}
% \hbox{|rrinnercolor := red;|}
-% \hbox{|rrtitlebgcolor := blue;|}
-% \hbox{|rrtitlecolor := black;|}
-% \hbox{|rrtextcolor := white;|}
-% \hbox{|rrbodytext := "Checking to see what happens when lines wrap";|}
-% \hbox{|rrtitletext := "TITLE";|}
+% \hbox{|rrborderrad(20pt);|}
+% \hbox{|rrbotlftborderrad := 0pt;|}
+% \hbox{|rrbotrtborderrad := 0pt;|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
+% rrbordercolor(black);
+% rrbotbordercolor := green;
% rrinnercolor := red;
-% rrtitlebgcolor := blue;
-% rrtitlecolor := black;
-% rrtextcolor := white;
-% rrbodytext := "Checking to see what happens when lines wrap";
-% rrtitletext := "TITLE";
+% rrborderrad(20pt);
+% rrbotlftborderrad := 0pt;
+% rrbotrtborderrad := 0pt;
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
-% }%
+% }
%
-% We see we should raise the title text; the default value
-% is $\frac{1}{6}$ of the box's height, which is too large
-% for this small box. So we adjust it with
-% \DescribeMacro{rrtitleht}|rrtitleht|; this is expressed as
-% a distance up from the bottom border of the title bar:
+% Perhaps you don't like the border; you'd like it thicker,
+% or drawn with a square rather than a circular pen. You're
+% in luck; \DescribeMacro{rrborderpen()}|rrborderpen()|
+% takes the single argument of the pen you'd like to draw
+% the border with, defined like any other \MP\ pen:
%
% \demonstrate{%
-% \hbox{|rrinnercolor := red;|}
-% \hbox{|rrtitlebgcolor := blue;|}
-% \hbox{|rrtitlecolor := black;|}
-% \hbox{|rrtextcolor := white;|}
-% \hbox{|rrbodytext := "Checking to see what happens when lines wrap";|}
-% \hbox{|rrtitletext := "TITLE";|}
-% \hbox{|rrtitleht := 0.3in;|}
+% \hbox{|rrborderpen(pensquare scaled 3);|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
-% rrinnercolor := red;
-% rrtitlebgcolor := blue;
-% rrtitlecolor := black;
-% rrtextcolor := white;
-% rrbodytext := "Checking to see what happens when lines wrap";
-% rrtitletext := "TITLE";
-% rrtitleht := 0.3in;
+% rrborderpen(pensquare scaled 3);
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
-% }%
+% }
%
-% Plainly, this is terrible style; but the principles are
-% accurately shown here.
+% The default border pen is |pencircle scaled 1.5|, so this
+% results in a square pen rather than a circular one, twice
+% as thick. You can also use individual pens for each
+% border, as expected:
%
-% We can easily change the font separately for both title
-% and body with \DescribeMacro{rrtitlefont}|rrtitlefont| and
-% \DescribeMacro{rrtextfont}, with the usual font-changing
-% commands that we would use in our text. We've also been
-% using rectangles with extremely rounded borders; this
-% reflects the default ``border radius'' of |roundrect|,
-% which is |40pt|. We can change how rounded our corners
-% are with \DescribeMacro{rrborderrad}|rrborderrad|, and how
-% wide our border is with
-% \DescribeMacro{rrborderwd}|rrborderwd|:
+% \demonstrate{%
+% \hbox{|rrbotlftborderrad := 0pt;|}
+% \hbox{|rrbotrtborderrad := 0pt;|}
+% \hbox{|rrbotbordercolor := green;|}
+% \hbox{|rrbotborderpen := pensquare yscaled 6;|}
+% \hbox{|roundrect(1in,2in)(rectangle);|}
+% \hbox{|draw rectangle;|}
+% }{%
+% \begin{mpost}
+% rrbotlftborderrad := 0pt;
+% rrbotrtborderrad := 0pt;
+% rrbotbordercolor := green;
+% rrbotborderpen := pensquare yscaled 6;
+% roundrect(1in,2in)(rectangle);
+% draw rectangle;
+% \end{mpost}
+% }
+%
+% Here we've flattened the bottom border, colored it green,
+% and drawn it with a square pen scaled on the y-axis only
+% by 6. Clearly, there are huge possibilities here.
+%
+% Finally, we can put text in the rectangles; this is as
+% configurable as everything else:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrborderrad := 20pt;|}
-% \hbox{|rrborderwd := 5pt;|}
-% \hbox{|rrbodytext := "Checking to see what happens when lines wrap";|}
-% \hbox{|rrtitletext := "TITLE";|}
-% \hbox{|rrtitlefont := "$\backslash$fontsize\{14pt\}\{17pt\}$\backslash$selectfont$\backslash$ bfseries$\backslash$ sffamily";|}
-% \hbox{|rrtextfont := "$\backslash$fontsize\{14pt\}\{17pt\}$\backslash$selectfont$\backslash$itshape";|}
-% \hbox{|rrtitleht := 0.3in;|}
+% \hbox{|rrbodytext := "Let's put some text into this rectangle and see if it typesets correctly!";|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
-% rrborderrad := 20pt;
-% rrborderwd := 5pt;
-% rrbodytext := "Checking to see what happens when lines wrap";
-% rrtitletext := "TITLE";
-% rrtitlefont := "\unexpanded{\fontsize{14pt}{17pt}\selectfont\bfseries\sffamily} ";
-% rrtextfont := "\unexpanded{\fontsize{14pt}{17pt}\selectfont\itshape} ";
-% rrtitleht := 0.3in;
+% rrbodytext := "Let's put some text into this rectangle and see if it typesets correctly!";
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
-% }%
+% }
+%
+% The font and style of the text can be controlled with
+% \DescribeMacro{rrtextfont}|rrtextfont|, and the color of
+% the text can be controlled with
+% \DescribeMacro{rrtextcolor}|rrtextcolor|:
+%
+% \demonstrate{%
+% \hbox{|rrbodytext := "Text in a label";|}
+% \hbox{|rrtextcolor := green;|}
+% \hbox{|rrtextalign := "$\backslash$raggedleft";|}
+% \hbox{|rrtextfont := "$\backslash$fontsize{17pt}{19pt}$\backslash$ selectfont$\backslash$ itshape";|}
+% \hbox{|roundrect(1in,2in)(rectangle);|}
+% \hbox{|draw rectangle;|}
+% }{%
+% \begin{mpost}
+% rrbodytext := "Text in a label";
+% rrtextcolor := green;
+% rrtextalign := "\unexpanded{\raggedleft}";
+% rrtextfont := "\unexpanded{\fontsize{17pt}{19pt}\selectfont\itshape"};
+% roundrect(1in,2in)(rectangle);
+% draw rectangle;
+% \end{mpost}
+% }
%
-% Be sure, if you are calling \MP\ from \LaTeX\ via |gmp| or
-% some similar package, that you wrap any \LaTeX\ commands
-% in an |\unexpanded| environment; otherwise \LaTeX\ will
-% expand them in a way that \MP\ won't be able to process.
+% We also used, without explaining it first,
+% \DescribeMacro{rrtextalign}|rrtextalign|, which allows
+% insertion of text alignment commands. This can also be
+% inserted in the |rrtextfont| variable, but it seemed
+% logical to have a separate parameter for it. It's default
+% is |\centering|.
%
-% We can even tell |roundrect| that we want our title bar on
-% the bottom, with \DescribeMacro{rrtitleside}|rrtitleside|,
-% or aligned right or left rather than centered, with
-% \DescribeMacro{rrtitlepos}|rrtitlepos|:
+% The width of the text is governed by
+% \DescribeMacro{rrtextwd}|rrtextwd|, which defaults to the
+% same width as the rectangle with a |3pt| buffer on either
+% side. The buffer is not directly controllable, but the
+% width can be set however you like:
%
% \demonstrate{%
-% \hbox{|rrtitlebar := true;|}
-% \hbox{|rrbodytext := "Checking to see what happens when lines wrap a lot; will it overlap the title bar or not";|}
-% \hbox{|rrtitletext := "TITLE";|}
-% \hbox{|rrtitletext := "TITLE";|}
-% \hbox{|rrtitleht := 0.3in;|}
-% \hbox{|rrtitleside := "bot";|}
-% \hbox{|rrtitlepos := "right";|}
+% \hbox{|rrbodytext := "Let's put some text into this rectangle and see if it typesets correctly!";|}
+% \hbox{|rrtextwd := 80pt;|}
% \hbox{|roundrect(1in,2in)(rectangle);|}
% \hbox{|draw rectangle;|}
% }{%
% \begin{mpost}
-% rrtitlebar := true;
-% rrbodytext := "Checking to see what happens when lines wrap a lot; will it overlap the title bar or not";
-% rrtitletext := "TITLE";
-% rrtitleht := 0.3in;
-% rrtitleside := "bot";
-% rrtitlepos := "right";
+% rrbodytext := "Let's put some text into this rectangle and see if it typesets correctly!";
+% rrtextwd := 80pt;
% roundrect(1in,2in)(rectangle);
% draw rectangle;
% \end{mpost}
% }
%
-% At present, the only options for |rrtitleside| are ``top''
-% and ``bot''; ``right'' and ``left'' should be added soon,
-% once the code is refactored to make it easier. The
-% options for |rrtitlepos| are, predictably, ``left'',
-% ``right'', and ``center''.
-%
-% To restore all these values to the defaults, simply issue
-% the directive
-% \DescribeMacro{rrrestorevals}|rrrestorevals;|; this macro
-% does nothing but replace the default values in all these
-% parameters.
-%
-% And those are the |roundrect| macros; I hope they are useful
-% for someone. Happy \MP ing!
-%
-% \section{Further Work Needed}
-%
-% This really boils down to just one thing: code
-% refactoring. There's too much duplication here; that's
-% what made it hard to add in different values for
-% |rrtitleside|, where it should have been quite easy. At
-% the moment, I don't really have time, so I just put this
-% together as it was and sent it out; but once I move some
-% other projects off my plate, this will get done. But for
-% those who look at the code here and are disgusted by the
-% unnecessary duplication: I know, and I want to fix it.
-
+% Finally, the restore all these values to the default, use
+% the |rrrestorevals;| directive. This will clear
+% everything to default so you can have a completely
+% different |roundrect| in the same figure.
+%
% \section{Implementation}
%
% \begin{macrocode}
input TEX;
color rrinnercolor; rrinnercolor := white;
-color rrbordercolor; rrbordercolor := black;
-numeric rrborderwd; rrborderwd := 2pt;
-numeric rrborderrad; rrborderrad := 40pt;
-string rrtitlefont; rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+numeric rrtoprtborderrad; rrtoprtborderrad := 40pt;
+numeric rrbotrtborderrad; rrbotrtborderrad := 40pt;
+numeric rrbotlftborderrad; rrbotlftborderrad := 40pt;
+numeric rrtoplftborderrad; rrtoplftborderrad := 40pt;
+numeric rrtextwd; rrtextwd := 0;
string rrtextfont; rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
-color rrtitlecolor; rrtitlecolor := black;
color rrtextcolor; rrtextcolor := black;
-color rrtitlebgcolor; rrtitlebgcolor := white;
-color rrtitlebordercolor; rrtitlebordercolor := black;
-boolean rrtitlebar; rrtitlebar := false;
-string rrtitleside; rrtitleside := "top";
-numeric rrtitleht; rrtitleht := 0pt;
-string rrtitlepos; rrtitlepos := "center";
-boolean rrtitlebotborder; rrtitlebotborder := true;
-color rrtitlebotbordercolor; rrtitlebotbordercolor := black;
-string rrtitletext; rrtitletext := "";
string rrbodytext; rrbodytext := "";
-string rrbodyalign; rrbodyalign := "justify";
-string rrbodyaligncom; rrbodyaligncom := "";
+string rrtextalign; rrtextalign := "\centering";
+boolean rrnotop; rrnotop := false;
+boolean rrnobot; rrnobot := false;
+boolean rrnolft; rrnolft := false;
+boolean rrnort; rrnort := false;
+color rrtopbordercolor; rrtopbordercolor := black;
+color rrbotbordercolor; rrbotbordercolor := black;
+color rrlftbordercolor; rrlftbordercolor := black;
+color rrrtbordercolor; rrrtbordercolor := black;
+def rrbordercolor(expr x) =
+ rrtopbordercolor := x;
+ rrbotbordercolor := x;
+ rrlftbordercolor := x;
+ rrrtbordercolor := x;
+enddef;
+def rrborderrad(expr x) =
+ rrtoplftborderrad := x;
+ rrbotlftborderrad := x;
+ rrtoprtborderrad := x;
+ rrbotrtborderrad := x;
+enddef;
+pen rrtopborderpen; rrtopborderpen := pencircle scaled 1.5;
+pen rrbotborderpen; rrbotborderpen := pencircle scaled 1.5;
+pen rrlftborderpen; rrlftborderpen := pencircle scaled 1.5;
+pen rrrtborderpen; rrrtborderpen := pencircle scaled 1.5;
+def rrborderpen(expr x) =
+ rrtopborderpen := x;
+ rrbotborderpen := x;
+ rrlftborderpen := x;
+ rrrtborderpen := x;
+enddef;
def rrrestorevals =
+ rrborderrad(40pt);
+ rrbordercolor(black);
+ rrborderpen(pencircle scaled 1.5);
rrinnercolor := white;
- rrbordercolor := black;
- rrborderwd := 2pt;
- rrborderrad := 40pt;
- rrtitlefont := "\fontsize{14pt}{17pt}\selectfont ";
+ rrnotop := false;
+ rrnobot := false;
+ rrnolft := false;
+ rrnort := false;
+ rrtextwd := 0;
rrtextfont := "\fontsize{10pt}{12pt}\selectfont ";
- rrtitlecolor := black;
rrtextcolor := black;
- rrtitlebgcolor := white;
- rrtitlebordercolor := black;
- rrtitlebar := false;
- rrtitleside := "top";
- rrtitleht := 0pt;
- rrtitlepos := "center";
- rrtitlebotborder := true;
- rrtitlebotbordercolor := black;
- rrtitletext := "";
rrbodytext := "";
- rrbodyalign := "justify";
- rrbodyaligncom := "";
+ rrtextalign; rrtextalign := "\centering";
enddef;
def roundrect(expr rrht, rrwd)(suffix name) =
TEXPRE("%&latex" & char(10) & "\documentclass{article}\begin{document}");
TEXPOST("\end{document}");
- if (rrtitleht = 0pt):
- rrtitleht := rrht/6;
+ if (rrtextwd = 0):
+ rrtextwd := rrwd - 12pt;
fi
path rra; path rrb; path rrc; path rrd;
pair a; pair b; pair c; pair d;
@@ -483,14 +509,14 @@ def roundrect(expr rrht, rrwd)(suffix name) =
b := (0,0) shifted (rrwd/2,-rrht/2);
c := (0,0) shifted (rrwd/2,rrht/2);
d := (0,0) shifted (-rrwd/2,rrht/2);
- rra := fullcircle scaled rrborderrad shifted (xpart a +
- (rrborderrad/2),ypart a + (rrborderrad/2));
- rrb := fullcircle scaled rrborderrad shifted (xpart b -
- (rrborderrad/2),ypart b + (rrborderrad/2));
- rrd := fullcircle scaled rrborderrad shifted (xpart d +
- (rrborderrad/2),ypart d - (rrborderrad/2));
- rrc := fullcircle scaled rrborderrad shifted (xpart c -
- (rrborderrad/2),ypart c - (rrborderrad/2));
+ rra := fullcircle scaled rrbotlftborderrad shifted (xpart a +
+ (rrbotlftborderrad/2),ypart a + (rrbotlftborderrad/2));
+ rrb := fullcircle scaled rrbotrtborderrad shifted (xpart b -
+ (rrbotrtborderrad/2),ypart b + (rrbotrtborderrad/2));
+ rrd := fullcircle scaled rrtoplftborderrad shifted (xpart d +
+ (rrtoplftborderrad/2),ypart d - (rrtoplftborderrad/2));
+ rrc := fullcircle scaled rrtoprtborderrad shifted (xpart c -
+ (rrtoprtborderrad/2),ypart c - (rrtoprtborderrad/2));
pair f; f := (a--b) intersectionpoint rra;
pair g; g := (a--b) intersectionpoint rrb;
pair h; h := (b--c) intersectionpoint rrb;
@@ -501,91 +527,48 @@ def roundrect(expr rrht, rrwd)(suffix name) =
pair m; m := (d--a) intersectionpoint rra;
picture name;
picture border;
- pair n; pair o; path rrtitlepath; path rrfinalline;
- name := image(fill f--g{right}..{up}h--i{up}..{left}j--
- k{left}..{down}l--m{down}..{right}f--cycle
- withcolor rrinnercolor);
- border := image(pickup pencircle scaled rrborderwd;
- draw f--g{right}..{up}h--i{up}..{left}j--
- k{left}..{down}l--m{down}..{right}f--cycle
- withcolor rrbordercolor);
- addto name also border;
- pair rrtitlestation;
- picture rrtitlelabel;
- if (rrtitlebar):
- if (rrtitleside = "top"):
- n := (xpart m,ypart k - (rrtitleht));
- o := (xpart i,ypart k - (rrtitleht));
- defaultscale := 4;
- if (ypart n > ypart l):
- n := (xpart n,ypart l);
- o := (xpart o,ypart l);
- fi
- rrtitlepath := o--i{up}..{left}j--k{left}..{down}l--n;
- if (rrtitlepos = "center"):
- rrtitlestation := 0.5[n,o] shifted (0,rrtitleht/2);
- elseif (rrtitlepos = "left"):
- rrtitlestation := n shifted (rrborderrad/4,rrtitleht/2);
- elseif (rrtitlepos = "right"):
- rrtitlestation := o shifted (-rrborderrad/4,rrtitleht/2);
- fi
- elseif (rrtitleside = "bot"):
- n := (xpart m,ypart f + (rrtitleht));
- o := (xpart i,ypart f + (rrtitleht));
- if (ypart n < ypart m):
- n := (xpart n,ypart m);
- o := (xpart o,ypart m);
- fi
- rrtitlepath := o--h{down}..{left}g--f{left}..{up}m--n;
- if (rrtitlepos = "center"):
- rrtitlestation := 0.5[n,o] shifted (0,-rrtitleht/2);
- elseif (rrtitlepos = "left"):
- rrtitlestation := n shifted (rrborderrad/4,-rrtitleht/2);
- elseif (rrtitlepos = "right"):
- rrtitlestation := o shifted (-rrborderrad/4,-rrtitleht/2);
- fi
- fi
- rrfinalline = n--o;
- picture rrtitlepic;
- picture rrtitlepicb;
- picture rrtitlebotborderpic;
- rrtitlebotborderpic := image (draw rrfinalline
- withcolor rrtitlebotbordercolor);
- rrtitlepicb := image(draw rrtitlepath withcolor rrtitlebordercolor);
- if (rrtitlebotborder = true):
- addto rrtitlepicb also rrtitlebotborderpic;
- fi
- rrtitlepath := buildcycle(rrtitlepath,rrfinalline);
- rrtitlepic := image(fill rrtitlepath withcolor rrtitlebgcolor);
- if (rrtitlepos = "center"):
- rrtitlelabel := image(label(TEX(rrtitlefont&" "&rrtitletext),
- rrtitlestation) withcolor rrtitlecolor);
- elseif (rrtitlepos = "left"):
- rrtitlelabel := image(label.rt(TEX(rrtitlefont&" "&rrtitletext),
- rrtitlestation) withcolor rrtitlecolor);
- elseif (rrtitlepos = "right"):
- rrtitlelabel := image(label.lft(TEX(rrtitlefont&" "&rrtitletext),
- rrtitlestation) withcolor rrtitlecolor);
- fi
- if (rrbodyalign = "center"):
- rrbodyaligncom := "\centering ";
- elseif (rrbodyalign = "left"):
- rrbodyaligncom := "\flushleft\vskip-\baselineskip ";
- elseif (rrbodyalign = "right"):
- rrbodyaligncom := "\flushright\vskip-\baselineskip ";
- fi
- picture rrbodytextpic;
- if (rrtitleside = "top"):
- rrbodytextpic :=
- image(label.lrt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
- elseif (rrtitleside = "bot"):
- rrbodytextpic :=
- image(label.urt(TEX("\parbox{"&decimal(rrwd-2rrborderwd-rrborderrad/2)&"bp}{"&rrbodyaligncom&rrtextfont&rrbodytext&"}"),n) withcolor rrtextcolor) shifted (rrborderrad/4,0);
- fi
- addto name also rrtitlepic;
- addto name also rrtitlepicb;
- addto name also rrtitlelabel;
- addto name also rrbodytextpic;
+ picture rrtext;
+ pair n; pair o;
+ path rrtoplftcorner; path rrbotlftcorner;
+ path rrtoprtcorner; path rrbotrtcorner;
+ path rrtopborder; path rrbotborder;
+ path rrlftborder; path rrrtborder;
+ rrtoplftcorner := l{up}..{right}k;
+ rrtoprtcorner := j{right}..{down}i;
+ rrbotrtcorner := h{down}..{left}g;
+ rrbotlftcorner := f{left}..{up}m;
+ rrtopborder := rrtoplftcorner--rrtoprtcorner;
+ rrbotborder := rrbotrtcorner--rrbotlftcorner;
+ rrlftborder := rrbotlftcorner--rrtoplftcorner;
+ rrrtborder := rrtoprtcorner--rrbotrtcorner;
+ name := image(fill rrtoplftcorner--rrtoprtcorner--
+ rrbotrtcorner--rrbotlftcorner--cycle withcolor
+ rrinnercolor);
+ picture rrtmpborder;
+ border := currentpicture;
+ if (rrnotop = false):
+ rrtmpborder := image(draw rrtopborder withcolor
+ rrtopbordercolor withpen rrtopborderpen);
+ addto border also rrtmpborder;
+ fi
+ if (rrnobot = false):
+ rrtmpborder := image(draw rrbotborder withcolor
+ rrbotbordercolor withpen rrbotborderpen);
+ addto border also rrtmpborder;
fi
+ if (rrnolft = false):
+ rrtmpborder := image(draw rrlftborder withcolor
+ rrlftbordercolor withpen rrlftborderpen);
+ addto border also rrtmpborder;
+ fi
+ if (rrnort = false):
+ rrtmpborder := image(draw rrrtborder withcolor
+ rrrtbordercolor withpen rrrtborderpen);
+ addto border also rrtmpborder;
+ fi
+ addto name also border;
+ rrtext :=
+ image(label(TEX("\parbox{"&decimal(rrtextwd)&"bp}{"&rrtextalign&rrtextfont&" "&rrbodytext&"}"),(0,0)) withcolor rrtextcolor;);
+ addto name also rrtext;
enddef;
% \end{macrocode}