Hi,

Currently it is not possible to individually set the thickness of the different borders of a frame. A typical use-case is typesetting a table row where the top frame is double the thichness of the bottom frame. Having to resort to metapost for something as simple as this is a bit annoying.

Attached is a metapost library that defines "local" fences and allows you to set border individually. For example

\defineframed[...][frame=off, topframe=local, topframethickness=1pt, bottomframe=local, bottomframethickness=0.5pt]

sets the top frame to be 1pt and the bottomframe to be 0.5pt.

Does it make sense to include this (appropriately modified) in the core? Or is it better to distribute such enhancements as a user module.

Aditya
%D \module
%D   [       file=meta-imp-local-fences,
%D        version=2012.05.23,
%D          title=\METAPOST\ Graphics,
%D       subtitle=Fences,
%D         author=Aditya Mahajan,
%D           date=\currentdate,
%D      copyright={Aditya Mahajan}]
%C

%D This module allows one to set the thickness and color of each side of a
%D frame.

\unprotect
\def\insall_local_fence_handler#1#2%
    {\startuniqueMPgraphic {#1_local_fence}
        draw #1boundary OverlayBox 
          withpen pensquare scaled 
(\the\dimexpr\framedparameter{#2\c!rulethickness}\relax) 
          withcolor \MPcolor{\framedparameter{#2\c!framecolor}} ;
        
        setbounds currentpicture to OverlayBox ;
      \stopuniqueMPgraphic
      \setupframed[#2\c!rulethickness=\c!rulethickness, 
#2\c!framecolor=\c!framecolor]
      \getvalue{install#1framerenderer}\v!local 
{\uniqueMPgraphic{#1_local_fence}}}


\insall_local_fence_handler {top}    \v!top
\insall_local_fence_handler {bottom} \v!bottom
\insall_local_fence_handler {left}   \v!left
\insall_local_fence_handler {right}  \v!right


\protect

\continueifinputfile{meta-imp-local-fences.mkiv}

% Typo in pack-fen.mkiv
\unprotected
\let\setinstalledframedimensions\pack_framed_overlay_initialize_indeed

\defineframed
  [colorful]
  [
    toprulethickness=1pt,
    topframecolor=red,
    bottomrulethickness=2pt,
    bottomframecolor=blue,
    leftrulethickness=3pt,
    leftframecolor=green,
    rightrulethickness=4pt,
    rightframecolor=yellow,
    frame=off,
    topframe=local,
    bottomframe=local,
    rightframe=local,
    leftframe=local,
  ]

\colorful{Hello world}

\stoptext
_______________________________________________
dev-context mailing list
dev-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/dev-context

Reply via email to