Comment 13 for bug 1655483

Tavmjong Bah (tavmjong-free) wrote :


I downloaded one of your files. The source of the problem you are having is that in 0.91 the 'line-height' property is set to a % value:

  <flowRoot style="font-size:12px;line-height:125%;...">

According to CSS, the line spacing for a % line-height value is calculated once and then applied to all inner elements (which don't have their own 'line-height' value). So in this case, the line spacing should be 16px (12px * 1.25). Inkscape 0.91 is incorrectly recalculating the line spacing for each 'flowPara' element inside the 'flowRoot'. In the file the flowPara has a font size of 48px:

  <flowPara style="font-size:48px;...">

thus 0.91 is applying a line spacing of 60px (48px * 1.25). 0.92 is following the CSS spec and not recalculating the line spacing for each flowPara where the 'line-height' property is not given in the flowPara style attribute.

There are a number of ways to fix this depending on how consistent your files are and how backwards compatible you wish to be:


1. One can change the 'line-height' from a percent value to a unitless value. I've attached a perl script that will do that. Changing the line spacing in 0.91 will break the fix.

2. One can look at the font-size in the first flowPara and apply it to the flowRoot element. This is backwards compatible with 0.91 but is a bit more difficult to do in perl.

3. One can add a 'line-height' property to the style attribute of each flowPara element so the line spacing is recalculated for each flowPara. This is also backwards compatible with 0.91. This might be the best solution.

It is possible that a fix could be automated in 0.92.2 (probably too late for 0.92.1) but it would require quite a bit of testing.