[metapost] Trying to use MT1 to make outline fonts... (again)

mskala at ansuz.sooke.bc.ca mskala at ansuz.sooke.bc.ca
Tue Jun 19 19:48:22 CEST 2012

On Tue, 19 Jun 2012, Shriramana Sharma wrote:
> 1) define a rotatable elliptical pen
> 2) tell it to hold the pen in a specified orientations at specific
> locations on the path
> 3) draw a stroke through these locations (or rather draw an outline
> through the points defined by the penpos commands and then fill it)

You can do all those things.  However:

* The syntax for doing it is different between METATYPE1 and METAFONT; the
syntax and data structures described in the Metafont Book simply will not
work because Metapost doesn't have an underlying bitmap representation.
Instead of "picking up" a pen and stroking a path with it, you define a
path and pass it through a macro that creates a new path, which you can
then send to the output.  The data type that the METAFONT language calls a
"pen" isn't involved at all; the METATYPE1 macros have their own concept
of a "nib" which is internally a path itself.  Similar concepts, different
syntax and underlying data structures.

* The result will not look the same between METATYPE1 and METAFONT,
because METATYPE1 uses its own "simplified" stroke algorithm which only
approximates, not exactly matches, the results of the METAFONT stroke
algorithm.  METAFONT draws the pen freshly at every location along the
path, which is possible because in a bitmap there are only a finite number
of locations along the path.  When we're talking about vector outlines,
there would be an infinite number of locations along the path so that
doesn't work.  METATYPE1 draws the pen only at the nodes on the stroke
path, and then connects them with smooth curves to form an envelope.  As a
result, if the pen changes in a complicated way from node to node, the
"smooth curves" may not well approximate the results METAFONT would have
gotten.  A partial workaround is to add extra nodes to force a more
accurate interpolation in places where the METATYPE1 algorithm doesn't
give the desired result.

> I wish to know whether the same is equally possible in MP/MT1. All
> that ../.../--/--- things, tension/curl operators, {up} {dir} {angle}
> stuff which is attractive  -- all that is possible here too? This is

Those things are aspects of the METAFONT-language "path" syntax and not
directly anything to do with strokes; you can use them freely in the
Metapost/METATYPE1 context and they work just fine.  The issue is with the
details of the appearance of the stroked path.
Matthew Skala
mskala at ansuz.sooke.bc.ca                 People before principles.

More information about the metapost mailing list