Re: SVG Fonts inside of OpenType fonts? [Cross-post from www-font@w3.org]

On Wed, 29 Jun 2011 12:01:44 +0200, Robert O'Callahan  
<robert@ocallahan.org> wrote:

> On Wed, Jun 29, 2011 at 8:03 PM, Erik Dahlstrom <ed@opera.com> wrote:
>
>> The reason why I like SVG Fonts is because they're different to the  
>> other
>> formats. It's easy to build a new SVG Font using javascript and to use  
>> it
>> directly in the browser. If an SVG Font is stored in an OFF container I  
>> take
>> it that would mean that it's not possible to change it dynamically?
>>
>
> Not directly, but it would still be possible to generate new fonts on the
> fly --- use a JS library that wraps SVG glyphs in an OpenType container,  
> and
> load the result using Blob URL. JS engines are good at manipulating  
> binary
> data these days.

Sounds cumbersome compared to just using the svgfont without the OpenType  
container.

...
>> Out of
>> curiosity I'd be interested in hearing if there are any other use-cases  
>> that
>> would be helped by having script support in the font itself.
>>
>
> Having script run in the font itself has all the same issues that having
> script run in SVG images would have --- and more. Just a taste: what  
> would
> you do if your font does "document.location = 'http://google.com';"  
> (i.e.,
> replaces the font document with some HTML document)? Get script turned  
> on in
> SVG images in Opera, then we can talk again :-).

So (intentionally or not) you just misrepresented what I wrote. I asked  
about possible use-cases. That is all.

> I don't see how having script run in the font itself even helps your
> use-case.

Right, the script would by necessity have to run in the document that uses  
the font in order to insert altGlyph elements into the text (noting that  
that would only work in SVG content). AltGlyph is decoupled from the font  
format but with some extra provisions for svg fonts.

Let me try to be a bit more clear, the only allowed scenario (in Opera,  
and I believe Webkit) in which a script can build and use an svgfont with  
script and do DOM operations on the SVG Font itself is if the script runs  
in the context of the svg document that contains the svgfont markup  
(inline).


-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed

Received on Wednesday, 29 June 2011 14:17:49 UTC