summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/core-rul.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/core-rul.tex')
-rw-r--r--Master/texmf-dist/tex/context/base/core-rul.tex160
1 files changed, 89 insertions, 71 deletions
diff --git a/Master/texmf-dist/tex/context/base/core-rul.tex b/Master/texmf-dist/tex/context/base/core-rul.tex
index 696f3f01cb3..5ede142bbe5 100644
--- a/Master/texmf-dist/tex/context/base/core-rul.tex
+++ b/Master/texmf-dist/tex/context/base/core-rul.tex
@@ -482,7 +482,7 @@
%D by \TEX\ itself, the latter one depends on the driver. This
%D macro also support a negative offset.
-\def\dooutlinebox
+\def\dooutlinebox % we needed to move the color command in order to apply attributes properly
{\setbox\framebox\vbox % rules on top of box
{\scratchdimen \framedparameter\c!frameoffset\relax
\frameddimenwd\dimexpr\wd\framebox+2\scratchdimen\relax
@@ -496,18 +496,15 @@
\scratchdimen\zeropoint
\fi
\setbox\extraframebox\hbox
- {\dostrokedbox}%
+ {\doifsomething{\framedparameter\c!framecolor}{\color[\framedparameter\c!framecolor]}{\dostrokedbox}}%
\setbox\extraframebox\hbox
{\raise\scratchdimen\vbox
- {\moveleft\framedparameter\c!frameoffset\box\extraframebox}}%
+ {\moveleft\framedparameter\c!frameoffset
+ \box\extraframebox}}%
\wd\extraframebox\wd\framebox
\ht\extraframebox\ht\framebox
\dp\extraframebox\dp\framebox
- \hbox
- {\box\framebox\hskip-\wd\extraframebox
- \doifsomething{\framedparameter\c!framecolor}% no else needed,
- {\color[\framedparameter\c!framecolor]}% %
- {\box\extraframebox}}}} % but {} here
+ \hbox{\box\framebox\hskip-\wd\extraframebox\box\extraframebox}}}
\def\dostrokedbox
{\doifelse{\framedparameter\c!framecorner}\v!rectangular
@@ -539,23 +536,78 @@
\def\@@frame@@{@@frame@@}
-\setvalue{t\@@frame@@\v!on \v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{t\@@frame@@\v!off\v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{t\@@frame@@\v!on }{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{b\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
-\setvalue{b\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
-\setvalue{b\@@frame@@\v!on }{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
-\setvalue{l\@@frame@@\v!on \v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{l\@@frame@@\v!off\v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{l\@@frame@@\v!on }{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
-\setvalue{r\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
-\setvalue{r\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
-\setvalue{r\@@frame@@\v!on }{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+% \setvalue{t\@@frame@@\v!on \v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{t\@@frame@@\v!off\v!on}{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{t\@@frame@@\v!on }{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{b\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+% \setvalue{b\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+% \setvalue{b\@@frame@@\v!on }{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+% \setvalue{l\@@frame@@\v!on \v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{l\@@frame@@\v!off\v!on}{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{l\@@frame@@\v!on }{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+% \setvalue{r\@@frame@@\v!on \v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+% \setvalue{r\@@frame@@\v!off\v!on}{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+% \setvalue{r\@@frame@@\v!on }{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+
+\def\@@frame@@trule{\hrule\!!height\ruledlinewidth\kern-\ruledlinewidth}
+\def\@@frame@@brule{\kern-\ruledlinewidth\hrule\!!height\ruledlinewidth}
+\def\@@frame@@rrule{\kern-\ruledlinewidth\vrule\!!width\ruledlinewidth}
+\def\@@frame@@lrule{\vrule\!!width\ruledlinewidth\kern-\ruledlinewidth}
+
+\letvalue{t\@@frame@@\v!on \v!on}\@@frame@@trule
+\letvalue{t\@@frame@@\v!off\v!on}\@@frame@@trule
+\letvalue{t\@@frame@@\v!on }\@@frame@@trule
+
+\letvalue{b\@@frame@@\v!on \v!on}\@@frame@@brule
+\letvalue{b\@@frame@@\v!off\v!on}\@@frame@@brule
+\letvalue{b\@@frame@@\v!on }\@@frame@@brule
+
+\letvalue{l\@@frame@@\v!on \v!on}\@@frame@@lrule
+\letvalue{l\@@frame@@\v!off\v!on}\@@frame@@lrule
+\letvalue{l\@@frame@@\v!on }\@@frame@@lrule
+
+\letvalue{r\@@frame@@\v!on \v!on}\@@frame@@rrule
+\letvalue{r\@@frame@@\v!off\v!on}\@@frame@@rrule
+\letvalue{r\@@frame@@\v!on }\@@frame@@rrule
+
+\def\@@frame@@trules{\hbox{\kern\ruledlinewidth\vrule\!!width\dimexpr\frameddimenwd-2\ruledlinewidth\relax\!!height\ruledlinewidth}\nointerlineskip\kern-\ruledlinewidth}
+\def\@@frame@@brules{\kern-\ruledlinewidth\nointerlineskip\hbox{\kern\ruledlinewidth\vrule\!!width\dimexpr\frameddimenwd-2\ruledlinewidth\relax\!!height\ruledlinewidth}}
+\def\@@frame@@rrules{\kern-\ruledlinewidth\vrule\!!height\dimexpr\frameddimenht-\ruledlinewidth\relax\!!depth-\ruledlinewidth\!!width\ruledlinewidth}
+\def\@@frame@@lrules{\vrule\!!height\dimexpr\frameddimenht-\ruledlinewidth\relax\!!depth-\ruledlinewidth\!!width\ruledlinewidth\kern-\ruledlinewidth}
+
+\letvalue{t\@@frame@@\v!small\v!small}\@@frame@@trules
+\letvalue{t\@@frame@@\v!off \v!small}\@@frame@@trules
+\letvalue{t\@@frame@@\v!small }\@@frame@@trules
+
+\letvalue{b\@@frame@@\v!small\v!small}\@@frame@@brules
+\letvalue{b\@@frame@@\v!off \v!small}\@@frame@@brules
+\letvalue{b\@@frame@@\v!small }\@@frame@@brules
+
+\letvalue{l\@@frame@@\v!small\v!small}\@@frame@@lrules
+\letvalue{l\@@frame@@\v!off \v!small}\@@frame@@lrules
+\letvalue{l\@@frame@@\v!small }\@@frame@@lrules
+
+\letvalue{r\@@frame@@\v!small\v!small}\@@frame@@rrules
+\letvalue{r\@@frame@@\v!off \v!small}\@@frame@@rrules
+\letvalue{r\@@frame@@\v!small }\@@frame@@rrules
%D I condidered using the low level support command
%D \type{\ruledhbox}, but this would slow down processing by a
%D factor~3.
+% \framed
+% [width=4cm,height=3cm,rulethickness=3mm,
+% frame=off,rightframe=on,leftframe=on,topframe=on,bottomframe=on]
+% {}
+% \framed
+% [width=4cm,height=3cm,rulethickness=3mm,
+% frame=off,rightframe=small,leftframe=small,topframe=small,bottomframe=small]
+% {}
+% \framed
+% [width=4cm,height=3cm,rulethickness=3mm,
+% frame=off,rightframe=small,leftframe=small,topframe=small,bottomframe=on]
+% {}
+
%D Before we come to using these macros we yet have to define
%D the rounded corner alternative, which after all is not that
%D hard because it uses the previously defined macro \type
@@ -779,8 +831,6 @@
\fi
% new, experimental dirty hook
\framedparameter\c!extras
- % we need to register the (outer) color
- \startregistercolor[\framedparameter\c!foregroundcolor]%
% to get the right spacing
\doifvaluesomething{\@@framed\c!foregroundstyle}
{\@EA\doconvertfont\csname\@@framed\c!foregroundstyle\endcsname\empty}%
@@ -912,9 +962,9 @@
\else\ifx\localstrut\v!local
\setfontstrut
\else
+ \setstrut
\fi\fi\fi
\ifboxhasstrut
- \setstrut
\let\localbegstrut\begstrut
\let\localendstrut\endstrut
\let\localstrut \strut
@@ -977,6 +1027,8 @@
{\ifdim\!!framedwidth >\zeropoint\the\!!framedwidth \else\zeropoint\fi}%
\edef\framedheight% a new feature, visible for user
{\ifdim\!!framedheight>\zeropoint\the\!!framedheight\else\zeropoint\fi}%
+ % we need to register the (outer) color
+ \startregistercolor[\framedparameter\c!foregroundcolor]%
% first alternative
%\def\dowithframedbox%
% {\let\postprocessframebox\relax %new
@@ -989,7 +1041,6 @@
% \let\postprocessframebox\relax %new
% \stoplocalframed}
% \next}
- % third alternative
\@@startframedorientation
\afterassignment\dodowithframebox
\setbox\framebox\next}
@@ -1039,6 +1090,7 @@
\def\stoplocalframed
{\dontshowcomposition
\@@stopframedorientation % hm, wrong place ! should rotatethe result (after reshape)
+ \stopregistercolor
\handleframedlocator\c!before\@@locallocation
\ifboxhasformat
\ifx\@@localautowidth\v!force
@@ -1071,7 +1123,6 @@
\ht\scratchbox\ht\framebox
\dp\scratchbox\dp\framebox
\setbox\framebox\box\scratchbox}%
- \stopregistercolor
\docolorframebox
\ifboxhasoffset
\dooffsetframebox
@@ -1702,6 +1753,10 @@
%D of a centered box automatically (\type {fit}). When
%D doing so, we need to reshape the box:
+% The next implementation is frozen! It preserves the depth,
+% otherwise we get problems with framed display math and auto
+% width.
+
\newcount\framednoflines
\newdimen\framedlastlength
@@ -1709,53 +1764,16 @@
{\framednoflines \zerocount
\framedlastlength\zeropoint}
-% The next implementation is frozen! It preserves the depth,
-% otherwise we get problems with framed display math and auto
-% width.
-
-% \def\doreshapeframedbox % frozen
-% {\beginofshapebox
-% \unvcopy\framebox
-% \endofshapebox
-% \global\@@globalwidth\zeropoint
-% \resetshapeframebox
-% \reshapebox
-% {\setbox0\hbox
-% {\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}%
-% \global\advance\framednoflines \plusone
-% \ifdim\framedlastlength>\zeropoint\else
-% \global\framedlastlength\wd0
-% \fi
-% \ifdim\wd0>\@@globalwidth
-% \global\@@globalwidth\wd0
-% \fi}%
-% \dosetraggedcommand\localformat
-% \raggedcommand
-% \ifboxhasheight
-% \setbox\framebox\vbox to \localheight
-% {\hsize\@@globalwidth
-% \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
-% \dobeforeframedbox
-% \innerflushshapebox
-% \doafterframedbox}%
-% \else
-% \scratchdimen\dp\framebox
-% \setbox\framebox\vbox to \ht\framebox
-% {\hsize\@@globalwidth
-% \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
-% \innerflushshapebox}%
-% \dp\framebox\scratchdimen % \strutdp otherwise problem with math
-% \fi
-% \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi
-% \ifcase\framednoflines\global\framednoflines\plusone\fi}
-
\chardef\reshapeframeboxmethod\plusone % 0=no flush, 1=old method 2=no depth messing
\let\framedboxwidth \!!zeropoint
\let\framedboxheight\!!zeropoint
\let\framedboxdepth \!!zeropoint
-\def\doreshapeframedbox % frozen
+\def\shapeboxstrut % put this in front if needed !
+ {\vrule\!!width\zeropoint\!!height\ht\shapebox\!!depth\dp\shapebox}
+
+\def\doreshapeframedbox % frozen, that is ... \shapeboxstrut added
{\beginofshapebox
\unvcopy\framebox
\endofshapebox
@@ -1766,7 +1784,7 @@
\resetshapeframebox
\reshapebox
{\setbox0\hbox
- {\strut\ifhbox\shapebox\unhbox\else\box\fi\shapebox}%
+ {\strut\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}%
\global\advance\framednoflines \plusone
\ifdim\framedlastlength>\zeropoint\else
\global\framedlastlength\wd0
@@ -1782,14 +1800,14 @@
\ifboxhasheight
\setbox\framebox\vbox to \localheight
{\hsize\@@globalwidth
- \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
+ \reshapebox{\hbox to \hsize{\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}}%
\dobeforeframedbox
\innerflushshapebox
\doafterframedbox}%
\else
- \setbox\framebox\vbox to \ht\framebox
+ \setbox\framebox\vbox to \framedboxheight % \ht\framebox
{\hsize\@@globalwidth
- \reshapebox{\hbox to \hsize{\ifhbox\shapebox\unhbox\else\box\fi\shapebox}}%
+ \reshapebox{\hbox to \hsize{\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}}%
\ifcase\reshapeframeboxmethod
\or \innerflushshapebox \or \innerflushshapebox
\fi}%
@@ -1797,7 +1815,7 @@
\dp\framebox\framedboxdepth % \strutdp otherwise problem with math
\fi
\fi
- \ifdim\framedlastlength=\zeropoint\global\framednoflines\wd\framebox\fi
+ \ifdim\framedlastlength=\zeropoint\global\framedlastlength\wd\framebox\fi
\ifcase\framednoflines\global\framednoflines\plusone\fi
\fi}