ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \limitatefirstline (or slave to the wiki)
@ 2005-09-09 11:19 Peter Rolf
  2005-09-11 12:39 ` Peter Rolf
  2005-09-11 15:57 ` Hans Hagen
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Rolf @ 2005-09-09 11:19 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 612 bytes --]

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

[-- Attachment #2: crop.tex --]
[-- Type: text/plain, Size: 2548 bytes --]

% 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:

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

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

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

end of thread, other threads:[~2005-09-12 10:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-09 11:19 \limitatefirstline (or slave to the wiki) Peter Rolf
2005-09-11 12:39 ` Peter Rolf
2005-09-11 15:57 ` Hans Hagen
2005-09-11 16:30   ` Peter Rolf
2005-09-11 16:48     ` Peter Rolf
2005-09-11 17:28     ` Hans Hagen
2005-09-11 17:38     ` Hans Hagen
2005-09-12 10:31       ` Peter Rolf

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).