Qianqian Fang | 4 Feb 2012 05:44
Picon

draw a single-stroke curve

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?

thanks

Qianqian
--
http://tug.org/metapost/

luigi scarso | 4 Feb 2012 23:27
Picon

Re: draw a single-stroke curve

On Sat, Feb 4, 2012 at 5:44 AM, Qianqian Fang <fangqq <at> gmail.com> 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?
What about svg export ?

--

-- 
luigi
--
http://tug.org/metapost/

Reinhard Kotucha | 5 Feb 2012 00:14
Picon

Re: draw a single-stroke curve

On 2012-02-03 at 23:44:11 -0500, Qianqian Fang 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.

You can't use arbitrary PostScript code in fonts.  Fonts always
require outlines.  Seems that FontForge does exactly the right thing.
Without this conversion FontForge cannot create fonts.

I wasn't aware that FontForge supports this conversion, I always
thought that it's only supported by MetaType1.  But good to know.

Or do you intend to create a Type 3 font?  In this case you have to
configure FontForge accordingly.  Don't know whether it's supported.

Maybe you could tell us what you want to achieve finally.

Regards,
  Reinhard

--

-- 
(Continue reading)

Qianqian Fang | 5 Feb 2012 01:16
Picon

Re: draw a single-stroke curve

On 02/04/2012 06:14 PM, Reinhard Kotucha wrote:
> On 2012-02-03 at 23:44:11 -0500, Qianqian Fang 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.
>
> You can't use arbitrary PostScript code in fonts.  Fonts always
> require outlines.  Seems that FontForge does exactly the right thing.
> Without this conversion FontForge cannot create fonts.

hi Reinhard

In fontforge, you can draw a non-closed curve, and
save it to SVG or SFD files. But it seems that you can
not create these non-closed splines by importing.
Because it always expand a spline object to outlines
with certain width.

> I wasn't aware that FontForge supports this conversion, I always
> thought that it's only supported by MetaType1.  But good to know.
>
(Continue reading)

Dan Luecking | 5 Feb 2012 08:23
Picon
Favicon

Re: draw a single-stroke curve

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
(Continue reading)

luigi scarso | 5 Feb 2012 09:54
Picon

Re: draw a single-stroke curve

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.
(Continue reading)

Qianqian Fang | 5 Feb 2012 17:36
Picon

Re: draw a single-stroke curve

On 02/04/2012 05:27 PM, luigi scarso wrote:
> What about svg export ? 

excellent suggestion! I tried an eps2svg script found
online, and the result is exactly what I need.

The "stroke-expand-to-contour" issue I mentioned
in the first post was indeed a pstoedit/fontforge issue.

thanks for the input

Qianqian

--
http://tug.org/metapost/

luigi scarso | 5 Feb 2012 18:44
Picon

Re: draw a single-stroke curve

On Sun, Feb 5, 2012 at 5:36 PM, Qianqian Fang <fangqq <at> gmail.com> wrote:
> On 02/04/2012 05:27 PM, luigi scarso wrote:
>>
>> What about svg export ?
>
>
> excellent suggestion! I tried an eps2svg script found
> online, and the result is exactly what I need.
>
> The "stroke-expand-to-contour" issue I mentioned
> in the first post was indeed a pstoedit/fontforge issue.
>
> thanks for the input
you can also use metapost to output svg with

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

--

-- 
luigi
--
http://tug.org/metapost/

Carlos Mallen | 7 Feb 2012 17:33
Picon
Favicon

Problem using LaTeX in MetaPost

Hi,

I'm using MiKTeX version 2.9 and MetaPost version 1.504. I'm no longer able to use LaTeX in MetaPost. The file

verbatimtex
%&latex
\documentclass{article}
\begin{document}
etex

input latexMP;

filenametemplate "%j-%3c.mps";

beginfig(1);

  draw (0, 0)--(150, 150);
  label(btex $A$ etex, (0, 0));
  show mpversion;

endfig;

verbatimtex
\end{document}
etex

end

fails because LaTeX commands aren't recognized. The error file is

This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 2012.2.7)  7 FEB 2012 10:28
**mp632087.tex
(C:\Personal\MetaPost-Manual\1.005\Graphics\mp632087.tex
! Undefined control sequence.
l.2 \documentclass
                  {article}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

! Undefined control sequence.
l.3 \begin
          {document}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

[1] [1] )
Output written on mp632087.dvi (2 pages, 340 bytes).

What should I do?
 
Carlos Mallén
--
http://tug.org/metapost/
Karel | 7 Feb 2012 19:06
Picon

Re: Problem using LaTeX in MetaPost

Carlos Mallen napsal(a):
> Hi,
> 
> I'm using MiKTeX version 2.9 and MetaPost version 1.504. I'm no longer 
> able to use LaTeX in MetaPost. The file
> 
> verbatimtex
> %&latex
> \documentclass{article}
> \begin{document}
> etex
> 
> input latexMP;
> 
> filenametemplate "%j-%3c.mps";
> 
> beginfig(1);
> 
>   draw (0, 0)--(150, 150);
>   label(btex $A$ etex, (0, 0));
>   show mpversion;
> 
> endfig;
> 
> verbatimtex
> \end{document}
> etex
> 
> end
> 
> fails because LaTeX commands aren't recognized. The error file is
> 
> This is TeX, Version 3.1415926 (MiKTeX 2.9) (preloaded format=tex 
> 2012.2.7)  7 FEB 2012 10:28
> **mp632087.tex
> (C:\Personal\MetaPost-Manual\1.005\Graphics\mp632087.tex
> ! Undefined control sequence.
> l.2 \documentclass
>                   {article}
> The control sequence at the end of the top line
> of your error message was never \def'ed. If you have
> misspelled it (e.g., `\hobx'), type `I' and the correct
> spelling (e.g., `I\hbox'). Otherwise just continue,
> and I'll forget about whatever was undefined.
> 
> ! Undefined control sequence.
> l.3 \begin
>           {document}
> The control sequence at the end of the top line
> of your error message was never \def'ed. If you have
> misspelled it (e.g., `\hobx'), type `I' and the correct
> spelling (e.g., `I\hbox'). Otherwise just continue,
> and I'll forget about whatever was undefined.
> 
> [1] [1] )
> Output written on mp632087.dvi (2 pages, 340 bytes).
> 
> What should I do?
>  
Maybe version 1.504 of MP does not write the texfile correctly.
Try to look in the corresponding file (you will find its name in 
the log file), if %&latex would not be at the first line, then 
perhaps try to find older MikTeX version of MP (1.212 works fine, 
I hope).
Karel Horak

--
http://tug.org/metapost/


Gmane