[metapost] draw a single-stroke curve

luigi scarso luigi.scarso at gmail.com
Sun Feb 5 09:54:17 CET 2012


On Sun, Feb 5, 2012 at 8:23 AM, Dan Luecking <luecking at uark.edu> wrote:
> At 10:44 PM 2/3/2012, you wrote:
>>
>> hi list
>>
>> I want to produce a single-stroke curve in
>> metapost and import to fontforge, a vector
>> font editor.
>>
>> I used the "draw" command and output to
>> a ps file, then import the ps file to fontforge.
>> I realize that, even I set the pen width to 0, the
>> imported ps graph is always an outline object:
>> every stroke is a thin closed contour.
>>
>> what command I should use in metapost to
>> produce a ps file that can have single-stroke
>> one-directional curves?
>
>
> I can't tell what you want. If you want a penstroke
> to be visible, you can't set its width to 0. If you
> set the width to 0, then you need to make a closed
> contour and use the "fill" command, not "draw".
>
> If you want the effect of a calligrapher's penstroke,
> metapost has a "penpos" command to determine a shape
> followed by a "penstroke" command to produce that shape.
> Despite the name, "penstroke" actually outputs a filled
> contour emulating the sroke of a calligrapher's pen.
>
> It would be useful to see an example of what you are doing
> (i.e., the actual metapost code) to produce a picture of a
> "single-stroke, one-directional curve".
>
> Dan
>
>
> Daniel H. Luecking
> Department of Mathematical Sciences
> Fayetteville, Arkansas
> http://www-cs-faculty.stanford.edu/~knuth/iaq.html
> --
> http://tug.org/metapost/

With this code
%%%%%%%
outputformat:="eps";
outputtemplate:="%j-%c.eps";
beginfig(1);
pickup pencircle scaled 2pt;
draw (100,0) .. (0,100) .. (-100,0) .. (0,-100) ..cycle shifted (100,100);
endfig;
end
%%%%%%%

fontforge show the pen effect (and it's also slow)

With this one
%%%%%%%%%
outputformat:="svg";
outputtemplate:="%j-%c.svg";
beginfig(1);
pickup pencircle scaled 2pt;
draw (100,0) .. (0,100) .. (-100,0) .. (0,-100) ..cycle shifted (100,100);
endfig;
end
%%%%%%%%%
the pen effect disappear.


-- 
luigi


More information about the metapost mailing list