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

font-size in percentage ambiguous?

From: Ondrej Bojar <bojar@ufal.mff.cuni.cz>
Date: Thu, 25 Sep 2008 12:41:28 +0200
Message-ID: <48DB6AD8.10909@ufal.mff.cuni.cz>
To: www-svg@w3.org

Dear all,

I'm rather new to SVG, so please correct me on any clear misconceptions.

I'm confused by the specification of font-size expressed in percentages, 
and various viewers indeed render my documents differently.

The specification of font-size links to two relevant documents 'Units' 
and 'CSS2-font-size':

http://www.w3.org/TR/SVG/text.html#FontSizeProperty

If a <length> is provided with one of the unit identifiers (e.g., 12pt 
or 10%), then the SVG user agent converts the <length>  into a 
corresponding value in the current user coordinate system by applying 
the rules described in Units.

Except for any additional information provided in this specification, 
the normative definition of the property is in [ CSS2-font-size].


The specification for percentage values in the 'Units' 
(http://www.w3.org/TR/SVG/coords.html#Units) section says:

....
For any other length value expressed as a percentage of the viewport, 
the percentage is calculated as the specified percentage of 
sqrt((actual-width)**2 + (actual-height)**2))/sqrt(2)
....


The specification of CSS2-font-size 
(http://www.w3.org/TR/REC-CSS2/fonts.html#propdef-font-size) says:

A percentage value specifies an absolute font size relative to the 
parent element's font size. Use of percentage values, or values in 
'em's, leads to more robust and cascadable style sheets.


If I am not mistaken, these definitions can (and often do) lead to a 
different outcome.

The latest working draft for SVG Tiny 
(http://www.w3.org/TR/2008/WD-SVGMobile12-20080915/single-page.html#text-TextElement)
seems to have noticed that:

[font-size]
This property refers to the size of the font from baseline to baseline 
when multiple lines of text are set solid in a multiline layout 
environment. The SVG user agent processes the <length> as a height value 
in the current user coordinate system. Percentage values are not supported.


Best regards,
   Ondrej.

-- 
Ondrej Bojar (mailto:obo@cuni.cz / bojar@ufal.mff.cuni.cz)
http://www.cuni.cz/~obo
Received on Friday, 26 September 2008 08:56:47 GMT

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