ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Olivier Binda <olivier.binda@wanadoo.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Struggling with ConTeXt
Date: Wed, 22 Aug 2012 12:31:00 +0200	[thread overview]
Message-ID: <5034B4E4.40601@wanadoo.fr> (raw)
In-Reply-To: <alpine.LNX.2.02.1208220434200.13214@ybpnyubfg.ybpnyqbznva>

On 22/08/2012 10:42, Aditya Mahajan wrote:
> On Wed, 22 Aug 2012, Olivier Binda wrote:
>
>> Thank you for the tips.
>>
>> Here, I cleaned up the code some more (sorry to have left stuff over 
>> last time),.
>>
>> I added some explanations to make my issue clearer
>>
>>
>> \startusableMPgraphic{myFrame}
>>   draw OverlayBox withpen pencircle scaled 1pt withcolor green;
>>   draw (currentpicture enlarged 2cm) withcolor red withpen pencircle 
>> scaled 2pt;
>> \stopusableMPgraphic
>>
>> \defineoverlay[myOverlay][\useMPgraphic{myFrame}]
>> \defineframedtext[myStatement][frame=off]
>> \setupframedtexts[myStatement][background=myOverlay,offset=overlay,autowidth=force] 
>>
>> \starttext
>> \framed[strut=no]{\startmyStatement FIRST TEST\stopmyStatement}
>> In the first test, I would like the black box to have the dimensions 
>> of the red box.
>
> \defineframed[myStatement][background=myOverlay, 
> offset=overlay,width=fit]
> \dontleavehmode\framed[strut=no, offset=2cm]{\myStatement{FIRST TEST}}
> In the first test, I would like the black box to have the dimensions 
> of the red box.
>
>> \blank[big,big,big,big,big,big,big,big,big,big]
>>
>> \placefigure[left,none]{}{\startmyStatement SECOND TEST\stopmyStatement}
>> In the second test, I'm going to demonstrate the issue by flowing 
>> text around the framed text, the green color {\em and the red color} 
>> shouldn't touch the flowing text as I want the float box to include 
>> the text box {\em and the overlay box.}
>
> \placefigure[left,none]{}{\framed[strut=no,


> offset=2cm

Thanks for the help. But I'm affraid that this won't do as I won't 
know/I am not supposed to know the dimensions of the bounding box of the 
overlay I'll use.
:/

For the sake of the minimal example, I only enlarged the picture by 2cm, 
but in real production situations,
the bounding box is going to be enlarged by random offset, because the 
overlay will have various parts with weird shapes (super ellipse, 
squeezed rectangles) that go beyond the original text boundaries (like 
in the Zapf frametext example of the Context manual : the title is 
protruding out of the main box and if you put weird stuff in there, you 
won't know the dimensions).

I don't want to manually calculate those offsets, I would like metapost 
to pass it's bounding box dimensions for the overlay to context so that 
it automatically applies the correct offset to the text+overlay




> ]{\myStatement{SECOND TEST}}}
> ....
>
> If needed, you can hide this behind macros:
>
> \def\startmyStatement
>     {\framed[struct=no, offset=2cm]\bgroup\myStatement\bgroup}
>
> \def\stopmyStatement
>    {\egroup\egroup}
>
> Aditya
> ___________________________________________________________________________________ 
>
> If your question is of interest to others as well, please add an entry 
> to the Wiki!
>
> maillist : ntg-context@ntg.nl / 
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________ 
>
>

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


      reply	other threads:[~2012-08-22 10:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-02 15:29 Olivier Binda
2012-08-02 15:43 ` Aditya Mahajan
2012-08-02 15:47   ` Aditya Mahajan
2012-08-03  6:35   ` Olivier Binda
2012-08-03 10:10     ` Hans Hagen
2012-08-03 14:50       ` Sietse Brouwer
2012-08-03 16:14         ` Hans Hagen
2012-08-05  9:35         ` Thomas A. Schmitz
2012-08-20 22:27   ` Olivier Binda
2012-08-22  4:54     ` Aditya Mahajan
2012-08-22  8:21       ` Olivier Binda
2012-08-22  8:42         ` Aditya Mahajan
2012-08-22 10:31           ` Olivier Binda [this message]

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=5034B4E4.40601@wanadoo.fr \
    --to=olivier.binda@wanadoo.fr \
    --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).