[metapost] Filling complex paths
Hans Hagen
pragma at wxs.nl
Fri Oct 17 09:38:44 CEST 2014
On 10/16/2014 11:44 PM, Tobias Columbus wrote:
> Hi all,
>
> I am currently writing a piece of software that should spit out some MetaPost
> code. My input are the closed curves of a glyph and I want to produce MetaPost
> code that fills them according to Postscript rules. However, as MetaPost cannot
> handle non-contiguous closed paths, this task seems difficult at least.
>
> Note that the glyphs come from non-Postscript fonts, so that the MetaPost
> "glyph" primitive does not work for me. I also tried "graphictext" as described
> in the Metafun manual but that turned out to be too inaccurate. I traced the
> inaccuracy back to "pstoedit", which is called for "graphictext".
>
> My attempt was to fiddle around with specials and
> withprescript/withpostscript. This attempt turned out to be nonsense as
> addto always writes "stroke" or "fill" and my specials were ignored. I
> could, of course, write the whole glyph with specials, but I would
> prefer a cleaner solution.
>
> Has anybody some experience with this kind of problem? How difficult
> would it be to add filling of non-contiguous paths to MetaPost?
some of this unfilling is supported out of the box
\startMPpage
path p ; p := fullcircle scaled 10cm .. fullcircle scaled 5cm .. cycle ;
fill p ; drawarrow p withcolor red ;
currentpicture := currentpicture shifted (-11cm,0) ;
path p ; p := fullcircle scaled 10cm .. reverse fullcircle scaled 5cm ..
cycle ;
fill p ; drawarrow p withcolor red ;
\stopMPpage
> Thank you in advance,
> Tobias
> --
> http://tug.org/metapost/
>
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
More information about the metapost
mailing list