W3C home > Mailing lists > Public > www-svg@w3.org > September 2009

Re: Rendering arbitrary SVG content in SVG font glyphs

From: Jeff Schiller <codedread@gmail.com>
Date: Thu, 10 Sep 2009 18:28:39 -0500
Message-ID: <da131fde0909101628l69fb5ec4pbd6512bc7381f947@mail.gmail.com>
To: robert@ocallahan.org
Cc: www-svg <www-svg@w3.org>
I'm afraid I still didn't understand the use case for allowing TRULY
arbitrary SVG content as children of the <glyph> element.  Can we just
limit the elements that can be included as children of a <glyph>?  I
would say any <path>, <g> as well as any "basic shape" as defined
here: http://www.w3.org/TR/SVG11/intro.html#Terminology and that these
elements cannot reference any content outside the <glyph> (for
example, masks, etc).

I just can't see any valid reason to allow <text>, <a>,
<foreignObject> among others as content of a <glyph>


On Thu, Sep 10, 2009 at 4:55 PM, Robert O'Callahan <robert@ocallahan.org> wrote:
> It seems to me that no major Web browser supports rendering arbitrary SVG
> content for an SVG Font glyph. For example, this testcase displays nothing
> in Webkit and Opera:
> <svg xmlns="http://www.w3.org/2000/svg" >
>   <font id="Font">
>     <font-face font-family="Test" units-per-em="2048"/>
>     <glyph unicode="@" horiz-adv-x="1000">
>       <rect x="0" y="0" width="1000" height="1000" fill="cyan"/>
>     </glyph>
>   </font>
>   <text x="0" y="100" style="font-family:Test; font-size:80px;">@@@</text>
> </svg>
> A completely general implementation of this feature in a Web browser would
> be very difficult. For example, the SVG content for a glyph could be
>   <foreignObject x="0" y="0" width="1000" height="1000"><html:iframe
> src="http://mozilla.com"/></foreignObject>
> The SVG 1.1 spec requires you to create anonymous cloned iframe objects for
> each glyph, which have to be associated with the text in some way. Because
> these objects are stateful, the spec would need to define exactly when this
> binding happens. For example, if I append a character to the text node, are
> all the anonymous nodes recreated or is one just appended? The problem is
> especially acute if you want to support this for non-SVG text.
> The requirement that CSS inherit from the text, to the <font> element, to
> the <glyph>, may also be hard to implement. As noted in the spec it can also
> produce very unintuitive results because SVG styles like stroke-width will
> be interpreted in the glyph's coordinate space, which the text author may
> know nothing about.
> Chris Lilley pointed out in a Mozilla newsgroup that one-off decorative
> glyphs for a particular page are a good use case for this: it's just like
> producing artwork except your text is searchable, accessible, etc. Is that
> the only use-case? Could we satisfy that use-case in some other way? One
> possibility that seems attractive to me is to redefine the way glyph content
> is rendered so that it's treated like a pattern instead of a <use>. Not
> having to manage anonymous content for text would make this far easier to
> implement, for Gecko anyway, and it would also perform much better. It would
> mean losing the ability to inherit style from the text itself. However, as
> far as I can tell, the main need is to be able to use the text color in the
> glyph content. We could support that in fill and stroke by defining a new
> paint server "textColor" which magically extracts the color from the text
> the glyph belongs to.
> Rob
> --
> "He was pierced for our transgressions, he was crushed for our iniquities;
> the punishment that brought us peace was upon him, and by his wounds we are
> healed. We all, like sheep, have gone astray, each of us has turned to his
> own way; and the LORD has laid on him the iniquity of us all." [Isaiah
> 53:5-6]
Received on Thursday, 10 September 2009 23:29:20 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 March 2017 09:47:18 UTC