Re: SVG <glyph> element spec

On Wed, Dec 19, 2012 at 9:59 AM, Stephen Chenney <schenney@chromium.org>wrote:

> It seems that no browser supports arbitrary geometry inside a <glyph>
> element. Only path data in the "d" attribute of the glyph is supported, and
> then only on Opera and WebKit (as far as I can tell). There are no W3C
> tests for non-path glyphs that I could find.
>

I'm certain that I had tests at one time for other geometry, but perhaps
they didn't make it into the test suite.  ?


>
> I propose we drop the container aspect of glyph and insist on path data
> only. The complexity of implementing arbitrary geometry inside <glyph>
> makes it unlikely to be supported.
>

Fundamentally glyph rendering is the same as implementing the use element
with transforms.  Everyone has done that.  I expect the lack of
implementation is a chicken and egg back burner metaphor mixing thing.
Most SVG fonts that aren't hand coded to do something special, meaning
almost all of them, are generated from existing stroked fonts of other
formats.  With little content and apparently no tests it's easy to justify
putting font implementation off.  We are on the verge of adding much more
complexity to SVG than is present in fonts.  Basically fonts are use
elements with text metrics.  A very powerful concept and relatively cheap
to code.

And yes, I've done that.


>
> I also discovered that it is essential that a horiz-adv-x and related
> sizes be given for the font, otherwise the width is undefined. I think the
> spec should be explicit about this somewhere in the <glyph> discussion.
> Maybe we could also define it such that the advances, if undefined, come
> from the bounding box of the path.
>

The spec is clear on this:
http://www.w3.org/TR/SVG/fonts.html#GlyphElementHorizAdvXAttribute


>
> Example below.
>
> Cheers,
> Stephen.
>
>
> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="
> http://www.w3.org/1999/xlink">
>   <svg xmlns="http://www.w3.org/2000/svg" x="100" y="100" width="400"
> height="400">
>     <defs>
>       <font>
>         <font-face font-family="xyzzy" units-per-em="8" />
>         <glyph unicode="1" id="rect1" horiz-adv-x="12" d="M0,0 l10,0 l0,10
> l-10,0 z" />
>         <glyph unicode="2" id="rect2" horiz-adv-x="12">
>           <rect width="10" height="10" x="0" y="0" />
>         </glyph>
>       </font>
>     </defs>
>     <text x="25" y="25" font-family="xyzzy" stroke-width="1">
>       12<altGlyph xlink:href="#rect1">A</altGlyph><altGlyph
> xlink:href="#rect2">B</altGlyph>
>     </text>
>   </svg>
> </html>
>



-- 
experiri non sit cunnus

Received on Wednesday, 19 December 2012 15:25:04 UTC