Hi all,

I've tested the latest version of \limitatefirstline and it still
doesn't work as expected. This is really a complex story (problem).

- the clip mechanism cuts off the lowest part of some special chars
  (clipping graphics is easy, but I don't understand what happens here)
- text is sometimes cropped at word boundaries (example 110pt),
  instead of beeing clipped

The example file is appended and I use the latest beta. There is no
timeline, so fixing is not that urgent.

And yes, I've cancelled my hollidays and will live for the wiki only
from now on :)

wiki, wiki, wiki,....

Greetings,

Peter
% interface=en output=pdftex
% Time-stamp: <Freitag, 09 September 2005 11:40:17; crop.tex>
%

\setupcolors[state=start]

\unprotect

\def\limitatefirstline#1#2#3%
{\hbox\bgroup\strut
 \setbox\scratchbox\hbox{#1}%
 \ifdim\wd\scratchbox>#2\relax
   \setbox\scratchbox\hbox{#3}%
   \hsize#2\relax
   \advance\hsize-\wd\scratchbox
   \setbox\scratchbox\vbox{\forgetall\veryraggedright#1}%
   \setbox\scratchbox\vsplit\scratchbox to \lineheight
   \vbox
     {\unvbox\scratchbox
      \global\setbox\plusone\lastbox
      \global\setbox\plusone\hbox{\unhbox\plusone}%
      \hbox to #2
        {\ifx\clip\undefined
           \box\plusone
         \else\ifdim\wd\plusone>\hsize
           
\clip[\c!width=\hsize,\c!height=\lineheight,\c!voffset=-4pt]{\box\plusone}%
         \else
           \box\plusone
         \fi\fi
         \removeunwantedspaces\hss#3}}%
 \else
   #1%
 \fi
 \egroup} 

\protect


\def\CropSymbol{\red...}%

\starttext

% blue for the limitatetext case

\setupframed[offset=overlay, framecolor=lightgray]

\framed[width=8ex,height=\struttotal,background=color,backgroundcolor=black]{\white
 8ex}
\framed{\limitatefirstline{\underbar{WqTextdummy}}{8ex}{\CropSymbol}}
\framed{\limitatetext{\blue\underbar{WqTextdummy}}{8ex}{\CropSymbol}}

\blank

\framed[width=120pt,height=\struttotal,background=color,backgroundcolor=black]{\white
 120 pt}
\framed{\limitatefirstline{\textbar \_\textcircumflex\texttilde 
\%\$\#\textbraceleft \textbraceright \textpm \copyright \registered \pi 
\textdegree <>\&}{120pt}{\CropSymbol}}
\framed{\limitatetext{\blue\textbar \_\textcircumflex\texttilde 
\%\$\#\textbraceleft \textbraceright \textpm \copyright \registered \pi 
\textdegree <>\&}{120pt}{\CropSymbol}}

\blank

\framed[width=110pt,height=\struttotal,background=color,backgroundcolor=black]{\white
 110 pt}
\framed{\limitatefirstline{\textbar \_\textcircumflex\texttilde 
\%\$\#\textbraceleft \textbraceright \textpm \copyright \registered \pi 
\textdegree <>\&}{110pt}{\CropSymbol}}
\framed{\limitatefirstline{This text is definitely too long to fit this 
frame.}{110pt}{\CropSymbol}}
\framed{\limitatetext{\blue This text is definitely too long to fit this 
frame.}{110pt}{\CropSymbol}}

\blank

\framed[width=100pt,height=\struttotal,background=color,backgroundcolor=black]{\white
 100 pt}
\framed{\limitatefirstline{\textbar \_\textcircumflex\texttilde 
\%\$\#\textbraceleft \textbraceright \textpm \copyright \registered\space \pi 
\textdegree <>\&}{100pt}{\CropSymbol}}

\stoptext

%%% Local Variables:
%%% mode: context
%%% TeX-master: ""
%%% End:
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to