ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Ian Lawrence <physics.wanderer@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Speech bubbles
Date: Thu, 3 Feb 2011 15:09:32 +0000	[thread overview]
Message-ID: <B201EEB1-B5F3-4C1A-BC1A-DB48742A3F07@gmail.com> (raw)
In-Reply-To: <BF09E91D-3C2B-4537-AE47-73C0C045D4DD@gmail.com>

Thanks Wolfgang..

In case there are any others who are in need.. Here is one with curvy speech bubbles, left and right, and wrapped up so they don't overhang any text.
__

\startuseMPgraphic{speechL}
z1 = (0.25cm,0) ; z2=(1 cm,0) ; z3 = (0,-1cm) ; z4 = (2cm,0);z5 = (OverlayWidth-0.25cm,0) ; z6 = (OverlayWidth,0.25cm) ; z7 = (OverlayWidth,OverlayHeight-0.25cm) ; z8 = (OverlayWidth-0.25cm,OverlayHeight) ; z9 = (0.25 cm,OverlayHeight);z10=(0,OverlayHeight-0.25cm) ; z11=(0,0.25cm)  ;
path p ; p = z1--z2{down}..{dir 270}z3{dir 30}..{dir 70}z4--z5{right}..{up}z6--z7{up}..{left}z8--z9{left}..{down}z10--z11{down}..{right}z1--cycle ;
fill p withcolor blue ;
draw p withpen pencircle scaled 1 ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{speechR}
z1 = (0.25cm,0) ; z2=(5 cm,0) ; z3 = (7cm,-1cm) ; z4 = (6cm,0);z5 = (OverlayWidth-0.25cm,0) ; z6 = (OverlayWidth,0.25cm) ; z7 = (OverlayWidth,OverlayHeight-0.25cm) ; z8 = (OverlayWidth-0.25cm,OverlayHeight) ; z9 = (0.25 cm,OverlayHeight);z10=(0,OverlayHeight-0.25cm) ; z11=(0,0.25cm)  ;
path p ; p = z1{left}..{up}z11--z10{up}..{right}z9--z8{right}..{down}z7--z6{down}..{left}z5--z4{down}..{dir 270}z3{dir 150}..{dir 110}z2--cycle ;
fill p withcolor blue ;
draw p withpen pencircle scaled 1 ;
setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic


\defineoverlay[speechL][\useMPgraphic{speechL}]

\define [1] \speechbubbleL
{\blank
\framedtext[frame=off,background=speechL, width=7cm]{#1}
\blank[1 cm]}]

\defineoverlay[speechR][\useMPgraphic{speechR}]

\define [1] \speechbubbleR
{\blank
\framedtext[frame=off,background=speechR, width=7cm]{#1}
\blank[1 cm]}]



\starttext
Some text

\speechbubbleL {'Who needs highlighter pens, anyway?'}

If all three are satisfied then then sound radiates from the source to the detector. The source-medium-detector model was central to the model of sound. The vibrations, because of their nature, travel as variations in physical density, so rely on a medium made of particles connecting the source to the detector. Other vibrations, very similar in nature, could still travel out from the source, but not be detected. 

\speechbubbleR  {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.}

More and more dog latin for beginners.. And so on...... And so on
\stoptext
__
Sorry the metapost is not parameterised...I should have variables in to set up the offsets and curvature of the corners. But I have not go that far yet...my floor is only a little higher, thanks to Wolfgang.

On 3 Feb 2011, at 08:39, Wolfgang Schuster wrote:

> 
> Am 02.02.2011 um 18:12 schrieb Ian Lawrence:
> 
>> Evening all:
>> 
>> Has anyone got a nicer \speechbubble definition up their sleeve?
>> 
>> Here is not-nice one, so you know the floor:
>> 
>> \define [1] \speechBubble 
>> {\blank
>> \framed [width=.6\textwidth ,autowidth=force,align={flushleft}, background=color, backgroundcolor=darkblue,
>>  foreground=color, foregroundcolor=white,
>> frame=off,corner=0,backgroundoffset=5pt,]  {#1}
>> ~~~ \tfd \startcolor[darkblue]{'} \stopcolor \tfa
>> \blank}
>> 
>> 
>> Called with things like:
>> 
>> \speechBubble {They could be above or below the frequency we can hear, so called infra-sound or ultra-sound, or the amplitude could be just too small: so not enough power in the radiating pathway for the detector to respond.}
>> 
>> 
>> I guess there are some people with xs metapost skills out there... But is there as simple way to get a nice curved pointer left or right from the bottom of that rounded rectangle frame?
> 
> \startuseMPgraphic{speechbubble}
> z1 = (0,0) ; z2 = (OverlayWidth,0) ; z3 = (OverlayWidth,OverlayHeight) ; z4 = (0,OverlayHeight) ;
> 1/2[x1,x2] = x8 + 2cm = x7 + 1cm = x9 - 1cm ; y7 = y9 = 0cm ; y8 = -2cm ;
> path p ; p = z1--z7--z8--z9--z2--z3--z4--cycle ;
> fill p withcolor blue ;
> draw p withpen pencircle scaled 5 ;
> setbounds currentpicture to OverlayBox ;
> \stopuseMPgraphic
> 
> \defineoverlay[speechbubble][\useMPgraphic{speechbubble}]
> 
> \starttext 
> 
> \framedtext[frame=off,background=speechbubble]{\input ward }
> 
> \blank[4cm]
> 
> \framedtext[frame=off,background=speechbubble,width=6cm]{\input ward }
> 
> \stoptext
> 
> Wolfgang
> 
> ___________________________________________________________________________________
> 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:[~2011-02-03 15:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-02 17:12 Ian Lawrence
2011-02-03  8:39 ` Wolfgang Schuster
2011-02-03 15:09   ` Ian Lawrence [this message]
2011-02-03 17:38     ` Philipp A.
2011-02-03 21:16       ` Wolfgang Schuster
2011-02-03 22:49         ` Philipp A.
2011-02-08 12:09           ` Philipp A.
2011-02-08 15:44             ` Wolfgang Schuster
2011-02-08 16:08               ` Andreas Harder
2011-02-08 16:38                 ` Wolfgang Schuster
2011-02-08 20:06                   ` Otared Kavian
2011-02-08 20:14                     ` Wolfgang Schuster
2011-02-10  4:57                       ` Otared Kavian
2011-02-10 10:23                 ` Otared Kavian
2011-02-10 13:06                   ` Wolfgang Schuster

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=B201EEB1-B5F3-4C1A-BC1A-DB48742A3F07@gmail.com \
    --to=physics.wanderer@gmail.com \
    --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).