Re: text-to-path method RE: Allow getTotalLength() and getPointAtLength() for <circle>, <rect> etc

(see comments below)

On 28 April 2015 at 08:52, David Dailey <ddailey@zoominternet.net> wrote:
>
> For purposes of animating and morphing between glyphs, having access, as
> well, to the “inner-shape” , namely the filled part of the glyph could be
> very handy as well.  So for example, while “L” might be defined as “M 0,0 L
> 10,0 10,90 50,90 50,100 0,100 z”, the inner shape of it might just be a
> path with d= “M 5,5 L 5,95 45,95” and stroke-width=”10”. It seems like the
> browsers have to do these calculations anyhow to draw the glyph, so
> exposing that data to authors could simplify our task as
> authors/programmers/animators a good deal, since a shape with three
> coordinates is easier to animate than one with six.
>

Unfortunately, it isn't true that browsers do these calculations anyway.
All the fonts used in browsers (with the exception of bitmapped fonts) are
outline vector fonts: the font data is stored as the outline.  The only
exception (that is supported in a dwindling number of browsers) would be
SVG fonts that have been manually created to use strokes to draw the
letters.  Converting the outline of an L to an open-ended path is actually
a complex task.  In many fonts (particularly serif fonts), there is no easy
way to accurately depict the shape of an L as a single open-ended path.

What you are thinking of would be called a stroke font format, in which the
paths of the letters are stored as the movements you'd use when
hand-writing.  The most established is the MetaFont format created by
Donald Knuth and supported in LaTeX.  However, MetaFont includes
instructions on the shape and angle of the brush that is stroking the path,
which aren't currently supported in SVG.  (I'd love to eventually get that
type of calligraphic stroking into SVG, but that's a whole other topic!)
 It also uses a complex system of mathematical constraint equations to
define the paths themselves, but that could probably be converted to SVG
path data with the right algorithms.

In contrast, getting the basic outline path data from outline vector fonts
should be fairly straightforward.  There are already lots of tools that can
do the conversion to SVG path data.

ABR

Received on Tuesday, 28 April 2015 15:12:59 UTC