question about followtext in MP
Dear list, I have the following sample: \starttext \startMPcode path p ; p := reverse halfcircle scaled 5cm; path q ; q := reverse halfcircle rotatedaround (origin, 180) scaled 5cm ; draw p; draw q; draw followtext(p, "·Just follow the tokens") ; draw followtext(q, "Just follow the tokens·") ; draw followtext(reverse q, "Just follow the tokens·") ; \stopMPcode \stoptext Is there any way to followtext in q without changing text direction? I need to write the text counter-clockwise, but on outside of the path. Reverse changes both text direction and side of the text (related to the path) and I don’t want to change text direction. Many thanks for your help, Pablo -- http://www.ousia.tk
On 5/22/2018 9:05 PM, Pablo Rodriguez wrote:
Dear list,
I have the following sample:
\starttext \startMPcode path p ; p := reverse halfcircle scaled 5cm; path q ; q := reverse halfcircle rotatedaround (origin, 180) scaled 5cm ; draw p; draw q; draw followtext(p, "·Just follow the tokens") ; draw followtext(q, "Just follow the tokens·") ; draw followtext(reverse q, "Just follow the tokens·") ; \stopMPcode \stoptext
Is there any way to followtext in q without changing text direction?
I need to write the text counter-clockwise, but on outside of the path.
Reverse changes both text direction and side of the text (related to the path) and I don’t want to change text direction. it will probably always look bad
\startMPcode path p ; p := reverse halfcircle scaled (5cm + 0.5LineHeight); path q ; q := reverse halfcircle rotatedaround (origin, 180) scaled (5cm +1.3LineHeight); draw fullcircle scaled 5cm;; draw followtext(p, "\strut just follow the tokens\enspace") ; draw followtext(reverse q, "\strut just follow the tokens\enspace") ; \stopMPcode ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On 05/22/2018 10:22 PM, Hans Hagen wrote:
On 5/22/2018 9:05 PM, Pablo Rodriguez wrote:
Dear list, [...] Is there any way to followtext in q without changing text direction?
I need to write the text counter-clockwise, but on outside of the path.
Reverse changes both text direction and side of the text (related to the path) and I don’t want to change text direction. it will probably always look bad
\startMPcode path p ; p := reverse halfcircle scaled (5cm + 0.5LineHeight); path q ; q := reverse halfcircle rotatedaround (origin, 180) scaled (5cm +1.3LineHeight); draw fullcircle scaled 5cm;; draw followtext(p, "\strut just follow the tokens\enspace") ; draw followtext(reverse q, "\strut just follow the tokens\enspace") ; \stopMPcode
Many thanks for your reply, Hans. Is there any way to set origin to another value than (0, 0) in MP? I realize it might sound weird, but it would make things easier in an example that I’m working on. Many thanks for your help, Pablo -- http://www.ousia.tk
On 5/23/2018 5:50 PM, Pablo Rodriguez wrote:
On 05/22/2018 10:22 PM, Hans Hagen wrote:
On 5/22/2018 9:05 PM, Pablo Rodriguez wrote:
Dear list, [...] Is there any way to followtext in q without changing text direction?
I need to write the text counter-clockwise, but on outside of the path.
Reverse changes both text direction and side of the text (related to the path) and I don’t want to change text direction. it will probably always look bad
\startMPcode path p ; p := reverse halfcircle scaled (5cm + 0.5LineHeight); path q ; q := reverse halfcircle rotatedaround (origin, 180) scaled (5cm +1.3LineHeight); draw fullcircle scaled 5cm;; draw followtext(p, "\strut just follow the tokens\enspace") ; draw followtext(reverse q, "\strut just follow the tokens\enspace") ; \stopMPcode
Many thanks for your reply, Hans.
Is there any way to set origin to another value than (0, 0) in MP?
I realize it might sound weird, but it would make things easier in an example that I’m working on. redefining origin is a bad idea (don't expect help if you do that)
you can alway sdo currentpicture := currentpicture shifted - center currentpicture; ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------
On Wed, 23 May 2018 18:05:07 +0200
Hans Hagen
Is there any way to set origin to another value than (0, 0) in MP?
I realize it might sound weird, but it would make things easier in an example that I’m working on. redefining origin is a bad idea (don't expect help if you do that)
pair origin ; origin = (0,0) ; is used in many places in the MP macros, and redefining this "constant" would cause all sorts of problems, as Hans indicates.
you can alway sdo
currentpicture := currentpicture shifted - center currentpicture;
I do this a lot, but recognize that it only makes a difference with respect to subsequent drawing actions: The MP graphic, when "sent back" to ConTeXt is treated as a box (defined by its bounding box) and placed by ConTeXt according to its context (no pun intended)! One could always play with this bounding box for interesting effects: setbounds currentpicture to ((bbox currentpicture) shifted (xx,yy)) ; for example. Alan
On 05/23/2018 06:05 PM, Hans Hagen wrote:
On 5/23/2018 5:50 PM, Pablo Rodriguez wrote:
Many thanks for your reply, Hans.
Is there any way to set origin to another value than (0, 0) in MP?
I realize it might sound weird, but it would make things easier in an example that I’m working on.
redefining origin is a bad idea (don't expect help if you do that)
you can alway sdo
currentpicture := currentpicture shifted - center currentpicture;
Many thanks for your replies, Hans and Alan. Geometry isn’t one of my strengths (and this is almost my first contact with MP). I have the following sample: \starttext \edef\TextInside{Just follow the tokens} \startMPpage path p ; p := reverse halfcircle scaled .6TextWidth; path q ; q := halfcircle rotatedaround (origin, 180) scaled (.6TextWidth + .75LineHeight); %~ draw fullcircle scaled .6TextWidth; draw followtext(p, "·\TextInside") ; draw followtext(q, "\TextInside·") ; path c ; c := (origin -- (6, 0) -- (0.5, -4) -- (3, 2) -- (5.5, -4) -- cycle) scaled 1.25cm ; %~ c := c shifted (-3,-3) ; draw followtext(c, "\dorecurse{500}{\utfchar{"EB09}}") ; \stopMPpage \stoptext How can I shift the path c (I mean, the one that draws a star? I have tried to add the shifted option to the path definition and drawing and there was no shift in the MP page. Many thanks for your help, Pablo -- http://www.ousia.tk
On Wed, 23 May 2018 18:40:14 +0200
Pablo Rodriguez
I have the following sample:
\starttext \edef\TextInside{Just follow the tokens} \startMPpage path p ; p := reverse halfcircle scaled .6TextWidth; path q ; q := halfcircle rotatedaround (origin, 180) scaled (.6TextWidth + .75LineHeight); %~ draw fullcircle scaled .6TextWidth; draw followtext(p, "·\TextInside") ; draw followtext(q, "\TextInside·") ; path c ; c := (origin -- (6, 0) -- (0.5, -4) -- (3, 2) -- (5.5, -4) -- cycle) scaled 1.25cm ; %~ c := c shifted (-3,-3) ; draw followtext(c, "\dorecurse{500}{\utfchar{"EB09}}") ; \stopMPpage \stoptext
How can I shift the path c (I mean, the one that draws a star?
I have tried to add the shifted option to the path definition and drawing and there was no shift in the MP page.
(If you only have one MPpage, then there is no need for \starttext\stoptext). \edef\TextInside{Just follow the tokens} \startMPpage path p ; p := reverse halfcircle scaled .6TextWidth; path q ; q := halfcircle rotatedaround (origin, 180) scaled (.6TextWidth + .75LineHeight); %~ draw fullcircle scaled .6TextWidth; draw followtext(p, "·\TextInside") ; draw followtext(q, "\TextInside·") ; path s ; s := (dir30--dir150--dir315--dir90--dir225--cycle) scaled .3TextWidth ; for i=0 upto 500 : draw textext("\utfchar{"EB09}") scaled .5 shifted point (i/500*length s) of s ; endfor \stopMPpage
On 05/23/2018 07:19 PM, Alan Braslau wrote:
On Wed, 23 May 2018 18:40:14 +0200 Pablo Rodriguez wrote:
I have tried to add the shifted option to the path definition and drawing and there was no shift in the MP page.
(If you only have one MPpage, then there is no need for \starttext\stoptext).
\edef\TextInside{Just follow the tokens} \startMPpage path p ; p := reverse halfcircle scaled .6TextWidth; path q ; q := halfcircle rotatedaround (origin, 180) scaled (.6TextWidth + .75LineHeight); %~ draw fullcircle scaled .6TextWidth; draw followtext(p, "·\TextInside") ; draw followtext(q, "\TextInside·") ; path s ; s := (dir30--dir150--dir315--dir90--dir225--cycle) scaled .3TextWidth ; for i=0 upto 500 : draw textext("\utfchar{"EB09}") scaled .5 shifted point (i/500*length s) of s ; endfor \stopMPpage
Many thanks for your help, Alan. I didn’t know that dir even existed. So I get a much better star that the one I tried before. Many thanks for your help, Pablo -- http://www.ousia.tk
On Wed, 23 May 2018 21:06:42 +0200
Pablo Rodriguez
On 05/23/2018 07:19 PM, Alan Braslau wrote:
On Wed, 23 May 2018 18:40:14 +0200 Pablo Rodriguez wrote:
I have tried to add the shifted option to the path definition and drawing and there was no shift in the MP page.
(If you only have one MPpage, then there is no need for \starttext\stoptext).
\edef\TextInside{Just follow the tokens} \startMPpage path p ; p := reverse halfcircle scaled .6TextWidth; path q ; q := halfcircle rotatedaround (origin, 180) scaled (.6TextWidth + .75LineHeight); %~ draw fullcircle scaled .6TextWidth; draw followtext(p, "·\TextInside") ; draw followtext(q, "\TextInside·") ; path s ; s := (dir30--dir150--dir315--dir90--dir225--cycle) scaled .3TextWidth ; for i=0 upto 500 : draw textext("\utfchar{"EB09}") scaled .5 shifted point (i/500*length s) of s ; endfor \stopMPpage
Many thanks for your help, Alan.
I didn’t know that dir even existed.
So I get a much better star that the one I tried before.
Many thanks for your help,
Pablo
If you are going to use MP, why not read the manual (mpman.pdf) or better yet, refer to the MetaFun manual that is even available in printed form at http://www.h2o-books.com/catalog/context/metafun Alan
On 05/23/2018 11:24 PM, Alan Braslau wrote:
On Wed, 23 May 2018 21:06:42 +0200 [...] If you are going to use MP, why not read the manual (mpman.pdf) or better yet, refer to the MetaFun manual that is even available in printed form at http://www.h2o-books.com/catalog/context/metafun?
Alan, paging through the manuals, Metafun seems easier than MetaPost. I think it will take me a while to understand the basics of it. Many thanks for your advice, Pablo -- http://www.ousia.tk
On Thu, 24 May 2018 18:11:05 +0200
Pablo Rodriguez
paging through the manuals, Metafun seems easier than MetaPost.
I think it will take me a while to understand the basics of it.
Metafun is an extension to MetaPost, providing some useful tools and improving on some "standard" MetaPost macros. But it *is* MetaPost, and the basic syntax is unchanged. Perhaps you are praising the MetaFun manual - that would please Hans as he has put a lot of effort into this documentation. Alan P.S. MetaFun/MetaPost tends to grow upon you. I learn new things every day, and am constantly in awe...
On 05/24/2018 06:30 PM, Alan Braslau wrote:
On Thu, 24 May 2018 18:11:05 +0200 Pablo Rodriguez wrote:
paging through the manuals, Metafun seems easier than MetaPost.
I think it will take me a while to understand the basics of it.
Metafun is an extension to MetaPost, providing some useful tools and improving on some "standard" MetaPost macros. But it *is* MetaPost, and the basic syntax is unchanged.
Perhaps you are praising the MetaFun manual - that would please Hans as he has put a lot of effort into this documentation.
The Metafun manual is much clearer (way than the MetaPost manual) for a newbie such as me. I must confess that I don’t have the background to understand it, either in math, or in coding. But the manual makes me wonder how could I get some of the graphics shown there.
P.S. MetaFun/MetaPost tends to grow upon you. I learn new things every day, and am constantly in awe...
I have to learn a lot about ConTeXt and Lua before. And I agree with you, it is addictive even for an ignorant such as myself. I have another question (for a new thread). Many thanks for your help, Pablo -- http://www.ousia.tk
On Wed, 23 May 2018 17:50:27 +0200
Pablo Rodriguez
Is there any way to set origin to another value than (0, 0) in MP?
What does this mean, mathematically that is? Of course, you can always shift an image anywhere (or in general apply any transformation), thus effectively changing the origin: currentpicture := currentpicture shifted (xx,yy) ; Alan
participants (3)
-
Alan Braslau
-
Hans Hagen
-
Pablo Rodriguez