W3C home > Mailing lists > Public > www-svg@w3.org > March 2010

Re: Why embedded fonts when they are not used?

From: Erik Dahlstrom <ed@opera.com>
Date: Mon, 15 Mar 2010 10:54:52 +0100
To: overunity <ffmpeg@thepixel.net>, "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <op.u9lshqodgeuyw5@localhost>
On Sat, 13 Mar 2010 15:06:05 +0100, overunity <ffmpeg@thepixel.net> wrote:

> Hello all,
>
> yesterday I tried something of which I thought would be the most logical  
> thing to do.
> I converted a ttf font to a svg font using batik ttf2svg.
> Then I included those glyphs in my SVG file and wrote some text with it.
>
> First I thought everything works well until I noticed that every  
> application displaying the SVG
> used the TTF font in the system instead of the embedded one.
>
> I did some research on the web but I couldn´t find at least one example  
> that really uses the embedded
> font. All SVG on the web use system fonts or replace the font in the SVG  
> by something else
> if the font is not installed as ttf.

That's not my experience. What viewers did you try? See  
http://treebuilder.de/svg/SVGFonts/chain.svg for example. Batik and Opera  
shows it just fine, and Chrome seems to almost get it right apart from  
some text-path positioning issues. Firefox doesn't support svgfonts yet  
however, and the firefox builds I tried froze on that example.

> Now my question: What is the point of embedded font glyphs?

It can be useful in a number of cases, mostly for keeping text as text  
when you have something that's not usually covered by fonts, or when you  
need only a few glyphs for a logo and it's a non-standard font. Any time  
you need to generate a custom font in javascript without having to rely on  
a server to do stuff for you it can also be handy.

Note for example that gordon (the SWF interpreter) can use svgfonts:

   http://github.com/tobeytailor/gordon/blob/master/src/svg_renderer.js

> Is there a way to force the SVG to use
> the glyphs (apart from putting and positioning each glyph manually) ?

Well, you can "force the SVG" to use a particular font by making sure it's  
using correct markup, and that it has all the glyphs needed for the text  
it's used for. However, forcing an SVG viewer to display it correctly,  
that's something else. Asking for the functionality to be added and  
writing nice examples is one way I suppose.

There are at least half a dozen implementations[2] that should be  
conforming at least to the level of SVGFont support specified in SVG Tiny  
1.2 [1], which is a subset of the SVGFont functionality specified in SVG  
1.1.

> I don´t get the point if thats not possible because I could simply  
> flatten the font of my desire to SVG shapes
> and put them in my SVG. Which makes the existence of glyphs totally  
> useless ?

Sure, you can of course do that if you only want the visual aspect of it.  
It hurts accessibility and editability though. You can do both by using  
<switch> though.

> Anyone who can push me in the right direction or can confirm that using  
> the glyphs as font doesn´t work -
> so I don´t need to trial and error any further ?

It usually helps if you post your example (on pastebin or elsewhere). Just  
a suggestion.

Cheers
/Erik

[1] http://www.w3.org/TR/SVGTiny12/fonts.html
[2] http://www.w3.org/Graphics/SVG/1.2/Tiny/ImpReport.html

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Monday, 15 March 2010 09:49:07 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:44 GMT