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

Re: letter-spacing with text-anchor middle

From: Erik Dahlstrom <ed@opera.com>
Date: Fri, 09 Jul 2010 13:37:20 +0200
To: "Tavmjong Bah" <tavmjong@free.fr>
Cc: "www-svg@w3.org" <www-svg@w3.org>
Message-ID: <op.vfkqkgubgeuyw5@localhost>
On Fri, 09 Jul 2010 13:00:27 +0200, Tavmjong Bah <tavmjong@free.fr> wrote:

>
>> Opera supports letter-spacing, however the unit (px in this case) must  
>> be
>> specified if it's in a stylesheet or style attribute. Chrome seems to  
>> not
>> require the unit to be specified though, which is a bit odd.
>
> I am having trouble seeing why Opera requires a unit in the case of a
> style attribute.

Not just Opera, it's the same in Gecko too. It's easily testable by  
inspecting the browser's error console to see if the declaration was  
dropped.

> The spec explicitly discusses what to do if no unit is
> given for letter-spacing.

In CSS the only <length> value that is allowed to not have a unit is 0.

> Also, 7.10 (Units) gives an example in the
> case of font-size where a unit is not given.

Yes.

> Inkscape always puts a unit on 'font-size'. There is a comment in the
> output code for 'font-size':
>
> 	// must specify px, see inkscape bug 1221626, mozilla bug 234789

It's the same for any property that uses CSS <length>, e.g  
'letter-spacing'.

> I can't find Inkscape bug 1221626 (Inkscape's changed the bug keeping
> system since that bug was submitted) and the Mozilla bug refers to a
> 2004 discussion where they grapple with how to resolve CSS and SVG spec
> differences. It wouldn't be hard for Inkscape to add the unit to avoid
> problems but that doesn't answer the question of why Opera requires it.

The contents of a style attribute is CSS, and CSS requires units, see:

     http://www.w3.org/TR/css-style-attr/

For external stylesheets and the content of <svg:style> elements it's the  
same thing, CSS defines the syntax, not SVG.

Cheers
/Erik

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Friday, 9 July 2010 11:37:56 GMT

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