summaryrefslogtreecommitdiff
path: root/tex/context/base/core-rul.mkii
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/core-rul.mkii')
-rw-r--r--tex/context/base/core-rul.mkii73
1 files changed, 73 insertions, 0 deletions
diff --git a/tex/context/base/core-rul.mkii b/tex/context/base/core-rul.mkii
new file mode 100644
index 000000000..c480bffbc
--- /dev/null
+++ b/tex/context/base/core-rul.mkii
@@ -0,0 +1,73 @@
+%D \module
+%D [ file=core-rul,
+%D version=1998.10.16,
+%D title=\CONTEXT\ Core Macros,
+%D subtitle=Ruled Stuff Handling,
+%D author=Hans Hagen,
+%D date=\currentdate,
+%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
+%C
+%C This module is part of the \CONTEXT\ macro||package and is
+%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
+%C details.
+
+\unprotect
+
+% The next implementation is frozen! It preserves the depth,
+% otherwise we get problems with framed display math and auto
+% width.
+
+\def\shapeboxstrut % put this in front if needed !
+ {\vrule\!!width\zeropoint\!!height\ht\shapebox\!!depth\dp\shapebox}
+
+\let\framedboxwidth \!!zeropoint
+\let\framedboxheight\!!zeropoint
+\let\framedboxdepth \!!zeropoint
+
+\def\doreshapeframedbox % frozen, that is ... \shapeboxstrut added
+ {\beginofshapebox
+ \unvcopy\framebox
+ \endofshapebox
+ \global\@@globalwidth\zeropoint
+ \edef\framedboxwidth {\the\wd\framebox}%
+ \edef\framedboxheight{\the\ht\framebox}%
+ \edef\framedboxdepth {\the\dp\framebox}%
+ \resetshapeframebox
+ \reshapebox
+ {\setbox0\hbox
+ {\strut\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}%
+ \global\advance\framednoflines \plusone
+ \ifdim\framedlastlength>\zeropoint\else
+ \global\framedlastlength\wd0
+ \fi
+ \ifdim\wd0>\@@globalwidth
+ \global\@@globalwidth\wd0
+ \fi}%
+ \ifreshapingfailed
+ % no need for anothr pass or finalizer
+ \else
+ \dosetraggedcommand\localformat
+ \raggedcommand
+ \ifboxhasheight
+ \setbox\framebox\vbox to \localheight
+ {\hsize\@@globalwidth
+ \reshapebox{\hbox to \hsize{\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}}%
+ \dobeforeframedbox
+ \innerflushshapebox
+ \doafterframedbox}%
+ \else
+ \setbox\framebox\vbox to \framedboxheight % \ht\framebox
+ {\hsize\@@globalwidth
+ \reshapebox{\hbox to \hsize{\ifhbox\shapebox\shapeboxstrut\unhbox\else\box\fi\shapebox}}%
+ \ifcase\reshapeframeboxmethod
+ \or \innerflushshapebox \or \innerflushshapebox
+ \fi}%
+ \ifcase\reshapeframeboxmethod \or
+ \dp\framebox\framedboxdepth % \strutdp otherwise problem with math
+ \fi
+ \fi
+ \ifdim\framedlastlength=\zeropoint\global\framedlastlength\wd\framebox\fi
+ \ifcase\framednoflines\global\framednoflines\plusone\fi
+ \fi}
+
+\protect \endinput