* question about MPpositiongraphic
@ 2009-01-03 14:02 Thomas A. Schmitz
2009-01-03 14:26 ` Wolfgang Schuster
0 siblings, 1 reply; 3+ messages in thread
From: Thomas A. Schmitz @ 2009-01-03 14:02 UTC (permalink / raw)
To: mailing ConTeXt users list for
Hi all,
first, best wishes for the New Year to all of you - may 2009 bring
peace and fortune and world domination for ConTeXt!
And my little question - trivial for the resident experts, I guess,
but I can't find a solution: I want to write a little macro that will
allow me to place a thin curved line under letters (metrical symbol
for synizesis). Now that metafun is so fast in mkiv, I thought I'd use
a MPpositiongraphic for that purpose, but my problem is that I can't
make the graphic really local - when it is used more than once in a
document, Metafin uses the last values for all occurrences. I tried
grouping and the "save" command, but to no avail. Here's an example
that shows the problem:
\startMPpositiongraphic{placesynizesis}
StartPage ;
begingroup ; save a ;
initialize_box(\MPpos{\MPvar{self}}) ;
numeric a ; a = ExHeight/6 ;
z1 = llxy ;
z2 = lrxy ;
z3 = 1/2[z1,z2] ;
z4 = ((x1 + 2a),(y1 - 2a)) ;
z5 = (x3, (y3 - 4a)) ;
z6 = ((x2 - 2a),(y2 - 2a)) ;
path syn ; syn := z4 .. z5 .. z6 ;
pickup pencircle scaled a ;
draw syn ;
anchor_box(\MPanchor{\MPvar{self}}) ;
endgroup ;
StopPage ;
\stopMPpositiongraphic%
\setMPpositiongraphic{POS}{placesynizesis}
\define[1]\synizesis
{\hpos{POS}{#1}}
\starttext
\switchtobodyfont[25pt]
test: \synizesis{au} and \synizesis{aeiou}
\stoptext
Any solution to this conundrum?
All best
Thomas
___________________________________________________________________________________
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about MPpositiongraphic
2009-01-03 14:02 question about MPpositiongraphic Thomas A. Schmitz
@ 2009-01-03 14:26 ` Wolfgang Schuster
2009-01-04 12:59 ` Thomas A. Schmitz
0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster @ 2009-01-03 14:26 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 03.01.2009 um 15:02 schrieb Thomas A. Schmitz:
> Hi all,
>
> first, best wishes for the New Year to all of you - may 2009 bring
> peace and fortune and world domination for ConTeXt!
>
> And my little question - trivial for the resident experts, I guess,
> but I can't find a solution: I want to write a little macro that
> will allow me to place a thin curved line under letters (metrical
> symbol for synizesis). Now that metafun is so fast in mkiv, I
> thought I'd use a MPpositiongraphic for that purpose, but my problem
> is that I can't make the graphic really local - when it is used more
> than once in a document, Metafin uses the last values for all
> occurrences. I tried grouping and the "save" command, but to no
> avail. Here's an example that shows the problem:
>
> \startMPpositiongraphic{placesynizesis}
> StartPage ;
> begingroup ; save a ;
> initialize_box(\MPpos{\MPvar{self}}) ;
> numeric a ; a = ExHeight/6 ;
> z1 = llxy ;
> z2 = lrxy ;
> z3 = 1/2[z1,z2] ;
> z4 = ((x1 + 2a),(y1 - 2a)) ;
> z5 = (x3, (y3 - 4a)) ;
> z6 = ((x2 - 2a),(y2 - 2a)) ;
> path syn ; syn := z4 .. z5 .. z6 ;
> pickup pencircle scaled a ;
> draw syn ;
> anchor_box(\MPanchor{\MPvar{self}}) ;
> endgroup ;
> StopPage ;
> \stopMPpositiongraphic%
> \setMPpositiongraphic{POS}{placesynizesis}
>
> \define[1]\synizesis
> {\hpos{POS}{#1}}
>
> \starttext
>
> \switchtobodyfont[25pt]
>
> test: \synizesis{au} and \synizesis{aeiou}
>
> \stoptext
>
> Any solution to this conundrum?
\newcount\synizesisnumber
\define[1]\synizesis
{\advance\synizesisnumber\plusone
\setMPpositiongraphic{POS-\number\synizesisnumber}{placesynizesis}
\hpos{POS-\number\synizesisnumber}{#1}}
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: question about MPpositiongraphic
2009-01-03 14:26 ` Wolfgang Schuster
@ 2009-01-04 12:59 ` Thomas A. Schmitz
0 siblings, 0 replies; 3+ messages in thread
From: Thomas A. Schmitz @ 2009-01-04 12:59 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Jan 3, 2009, at 3:26 PM, Wolfgang Schuster wrote:
> \newcount\synizesisnumber
>
> \define[1]\synizesis
> {\advance\synizesisnumber\plusone
> \setMPpositiongraphic{POS-\number\synizesisnumber}{placesynizesis}
> \hpos{POS-\number\synizesisnumber}{#1}}
>
> Wolfgang
Wow - so simple, and so efficient! Wolfgang, you were my hero in 2008,
and you'll be my hero in 2009!
Thanks a lot!
Thomas
___________________________________________________________________________________
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 : https://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-01-04 12:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-03 14:02 question about MPpositiongraphic Thomas A. Schmitz
2009-01-03 14:26 ` Wolfgang Schuster
2009-01-04 12:59 ` Thomas A. Schmitz
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).