ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* baseline alignment
@ 2004-07-22  8:59 Vit Zyka
  2004-08-09 22:39 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Vit Zyka @ 2004-07-22  8:59 UTC (permalink / raw)


Hallo,

for text positioning in a layer I needed alignment to baseline. I do not 
known if I missed something but I did not find it in the current 
ConTeXt. So I did that. Baseline is choosen by capital 'B' in the 
position parameter. ('B' is adopted from grahicx LaTeX/plain package.)

Also I add \ctop, \ltop, and \rtop in sence of \cbox, \lbox, and rbox, 
respectively.

I suggest to add the macros to core-box and supp-box.

Vit Zyka

%-------------------------------------------- baseline alignment
\setvalue{\??ab\??ab  B}{\baselinebox}
\setvalue{\??ab\??ab  Bl}{\baselineleftbox}
\setvalue{\??ab\??ab  Bc}{\baselinecenterbox}
\setvalue{\??ab\??ab  Br}{\baselinerightbox}
\setvalue{\??ab\??ab  lB}{\leftbaselinebox}
\setvalue{\??ab\??ab  cB}{\centerbaselinebox}
\setvalue{\??ab\??ab  rB}{\rightbaselinebox}
\def\baselinecenterbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement-.5\wd0
       \global\advance\boxhdisplacement-\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\def\baselineleftbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement-\wd0
       \global\advance\boxhdisplacement-\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\def\baselinerightbox#1%
   {\normalhbox
      {\setbox0\placedbox{#1}%
       \global\boxhdisplacement\boxoffset
       \global\boxvdisplacement-\boxoffset
       \boxcursor\hskip\boxhdisplacement\raise-\boxvdisplacement\box0}}
\let\baselinebox=\baselinecenterbox
\let\leftbaselinebox=\baselineleftbox
\let\rightbaselinebox=\baselinerightbox

%------------------------------ \ltop, \rtop, \ctop
\def\lrctop#1#2#%
   {\vtop#2\bgroup
    \let\\=\endgraf
    \forgetall#1\let\next=}
\def\ltop{\lrctop\raggedleft}
\def\rtop{\lrctop\raggedright}
\def\ctop{\lrctop\raggedcenter}

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-09 14:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-22  8:59 baseline alignment Vit Zyka
2004-08-09 22:39 ` Hans Hagen
2004-09-09 14:36   ` Vit Zyka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).