Issue 122524

Summary: [SVG import] sub-/superscript is rendered wrongly
Product: Draw Reporter: datbug
Component: open-importAssignee: Armin Le Grand <Armin.Le.Grand>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3 CC: Armin.Le.Grand, issues
Version: 4.0.0-dev   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
image showing the behaviour
none
test file
none
Overlay of Mozilla and AOO40 SVG
none
Compare with three major SVG importers none

Description datbug 2013-06-12 14:39:30 UTC
Created attachment 80831 [details]
image showing the behaviour

XP, AOO400m2(Build:9701) - Rev. 1489073 2013-06-03 13:48:37 (Mo, 03 Jun 2013)
Insert->Picture->From File
Text with sub-/superscript is cut where the sub-/superscript is and the sub-/superscript is shown as
a single letter/sign with a much bigger textsize
Comment 1 datbug 2013-06-12 14:39:51 UTC
Created attachment 80832 [details]
test file
Comment 2 Armin Le Grand 2013-06-14 08:53:47 UTC
ALG: Confirmed, created overlay file. Grepping.
Comment 3 Armin Le Grand 2013-06-14 08:54:23 UTC
Created attachment 80847 [details]
Overlay of Mozilla and AOO40 SVG
Comment 4 Armin Le Grand 2013-06-17 13:57:47 UTC
This one is two-folded, too:
(a) The font-size is given as font-size="75%". The SVG1.1. spec says in http://www.w3.org/TR/SVG/text.html 10.10 Font selection properties: '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.'.

This is done, but obviously wrong in this case. It also says (one line below): 'Except for any additional information provided in this specification, the normative definition of the property is in CSS2 ([CSS2], section 15.2.4).'. This leads to http://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#propdef-font-size where in 15.2.4 Font size: the 'font-size' and 'font-size-adjust' properties is explained: '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. '.

Thus, font-size="75%" should be interpreted relative to the parent font size, but this is not clearly stated in SVG1.1. Looks as if I have to change this. This would count as defect.

(b) The attributes described in '10.9.2 Baseline alignment properties' are not yet supported. These are ‘dominant-baseline’, ‘alignment-baseline’ and ‘baseline-shift’ (which is used here). This would count as Enhancement.
Comment 5 Armin Le Grand 2013-06-18 08:46:54 UTC
ALG: (a) is not too hard to do, works well after adapting. For (b) adding and working on 'alignment-baseline' works well. Created a test doc with Mozilla, Safari and Inkscape compare (will add it).
Comment 6 Armin Le Grand 2013-06-18 08:50:21 UTC
Created attachment 80877 [details]
Compare with three major SVG importers
Comment 7 Armin Le Grand 2013-06-18 08:57:25 UTC
ALG: (b) looks good so far, just the whitespace handling looks different.
- Mozilla 'SO' '2' 'CL' seems to not add a space after 'SO', but after '2'
- Safari and Inkscape seems to add nop spaces at all
I checked our current Whitespace handling (looking at 10.15 White space handling in SVG1.1, also the example at the end of '10.5 The ‘tspan’ element'), it is correct to add one space after each 'word' which is not the last, thus the result is 'SO ' '2 ' 'CL' is correct. Seems as if others add an exception for super/subscript, but I found no reference in the net for doing so.
Comment 8 Armin Le Grand 2013-06-18 09:41:38 UTC
ALG: Decided to adapt whitespace handling with super/sub-script on empirical base (lloks as the others do). Preparing checkin.
Comment 9 Armin Le Grand 2013-06-18 09:45:35 UTC
ALG: Okay, done. Happy assimilation, guys ;-)