From: Marco Patzer <lists@homerow.info>
To: ntg-context@ntg.nl
Subject: Re: Calling \followtokens from with in metapost
Date: Tue, 15 Oct 2013 00:27:46 +0200 [thread overview]
Message-ID: <20131014222746.GV18324@homerow> (raw)
In-Reply-To: <20131013221114.GS18324@homerow>
[-- Attachment #1.1: Type: text/plain, Size: 3292 bytes --]
On 2013–10–14 Marco Patzer wrote:
> On 2013–10–13 Hans Hagen wrote:
>
> > >inbetween the arcs, that should alsó be drawn). The text should not be
> > >stretched but center on the top, flowing evenly distributed on each
> > >side. This link will give you an idea:
> > >
> > >http://www.heilsuefling.is/heilsuefling/upload/images/whp_in_general/determinants_of_health/determinants_of_health.jpg
> > >
> > >How can this achieved?
Here is a slightly modified version of the \followtokens macro with
centres the text without stretching it to the path size.
\useMPlibrary [txt]
\unexpanded\def\followtokenscentred#1%%
{\vbox\bgroup
\forgetall
\dontcomplain
\startMPenvironment
\doifundefined{RotFont}{\definefont[RotFont][RegularBold]}
\stopMPenvironment
\MPtoks\emptytoks
\resetMPdrawing
\startMPdrawing
\includeMPgraphic{followtokenscentred} ;
picture pic[] ; numeric len[], n ; n := 0 ;
\stopMPdrawing
\handletokens#1\with\processfollowingtoken
\startMPdrawing
if unknown RotPath : path RotPath ; RotPath := origin ; fi ;
if unknown RotColor : color RotColor ; RotColor := black ; fi ;
if unknown TraceRot : boolean TraceRot ; TraceRot := false ; fi ;
if unknown ExtraRot : numeric ExtraRot ; ExtraRot := 0 ; fi ;
numeric al, at, pl, wid, pos ; pair ap, ad ;
al := arclength RotPath ;
if al=0 :
al := len[n] + ExtraRot ;
RotPath := origin -- (al,0) ;
fi ;
if al<len[n]:
RotPath := RotPath scaled ((len[n]+ExtraRot)/al) ;
al := arclength RotPath ;
fi ;
pl := (al-len[n])/(if n>1 : (n-1) else : 1 fi) ;
pl := 0cm;
if TraceRot :
draw RotPath withpen pencircle scaled 1pt withcolor blue ;
fi ;
for i=1 upto n :
wid := abs(xpart urcorner pic[i] - xpart llcorner pic[i]) ;
pos := len[i]-wid/2 + (i-1)*pl + arclength RotPath/2 - len[n]/2 ;
at := arctime pos of RotPath ;
ap := point at of RotPath ;
ad := direction at of RotPath ;
draw pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap
withcolor RotColor ;
if TraceRot :
draw boundingbox
pic[i] shifted (-wid/2,0) rotated(angle(ad)) shifted ap
withpen pencircle scaled .25pt withcolor red ;
draw ap
withpen pencircle scaled .50pt withcolor green ;
fi ;
endfor ;
\stopMPdrawing
\MPdrawingdonetrue
\getMPdrawing
\resetMPdrawing
\egroup}
\def\followtokengraphicscale#1{%%
\startuseMPgraphic {followtokenscentred}
path RotPath; RotPath := reverse halfcircle scaled #1 ;
setbounds currentpicture to boundingbox fullcircle scaled 12cm ;
\stopuseMPgraphic}
\starttext
\startoverlay
{\followtokengraphicscale{10cm}%%
\followtokenscentred{General socioeconomic cultural and environmental conditions}}
{\followtokengraphicscale{8cm}%%
\followtokenscentred{Living and working conditions}}
{\followtokengraphicscale{6cm}%%
\followtokenscentred{Social and community influences}}
{\followtokengraphicscale{4cm}%%
\followtokenscentred{Individual lifestyle factors}}
\stopoverlay
\stoptext
Marco
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]
[-- Attachment #2: Type: text/plain, Size: 485 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
next prev parent reply other threads:[~2013-10-14 22:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-13 7:59 Magnus J
2013-10-13 21:46 ` Hans Hagen
2013-10-13 22:11 ` Marco Patzer
2013-10-14 22:27 ` Marco Patzer [this message]
2013-10-15 8:20 ` Hans Hagen
2013-10-14 19:29 Magnus J
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=20131014222746.GV18324@homerow \
--to=lists@homerow.info \
--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).