ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Peter Rolf <indiego@gmx.net>
Subject: cropping with \limitatefirstline
Date: Wed, 07 Sep 2005 16:33:31 +0200	[thread overview]
Message-ID: <431EFA3B.8090706@gmx.net> (raw)

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

Sorry to bother you Hans, but the macro is not working as expected...

I can see the cropped text (\underbar + special symbols) and there is an
hyphen symbol in the text only example.

I've added the example code I used for tests with \limitatetext and
\doboundtext.

Peter



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

% interface=en output=pdftex
% Time-stamp: <Mittwoch, 07 September 2005 16:25:40; crop.tex>
%

\setupcolors[state=start]

\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#1}%
    \setbox\scratchbox\vsplit\scratchbox to \lineheight
    \vbox{\unvbox\scratchbox}%
    #3%
  \else
    #1%
  \fi
  \egroup}

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

\starttext

\setupframed[offset=overlay, height=\struttotal, framecolor=lightgray]

\framed[width=8ex,background=color,backgroundcolor=black]{\white 8ex}
\framed{\limitatefirstline{\underbar{Text dummy}}{8ex}{\CropSymbol}}
\framed{\limitatetext{\underbar{Text dummy}}{8ex}{\CropSymbol}}

\blank

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

\blank

\framed[width=110pt,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}}

\blank

\framed[width=100pt,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

             reply	other threads:[~2005-09-07 14:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-07 14:33 Peter Rolf [this message]
2005-09-07 15:55 ` Hans Hagen
2005-09-07 16:18   ` Peter Rolf
2005-09-08 14:24   ` Peter Rolf
2005-09-08 15:28     ` Hans Hagen
2005-09-08 15:56       ` Peter Rolf
2005-09-08 17:22         ` Patrick Gundlach
2005-09-08 16:34       ` Peter Rolf
2005-09-08 17:21         ` Hans Hagen
2005-09-08 17:32           ` Peter Rolf
2005-09-08 18:55         ` Hans Hagen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=431EFA3B.8090706@gmx.net \
    --to=indiego@gmx.net \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).