Vertical Kerning disregards Tspans ends when rendering

Bug #516216 reported by ScislaC
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
High
Tavmjong Bah

Bug Description

In a text block with multiple lines, if text is vertically kerned in one of the upper lines, the lines beneath it are rendered in the wrong place (they are moved along with the kerned text from different lines).

I have attached a file displaying the problem. Compare in Inkscape & Batik or Opera 10 (they render the same).

Checked with Inkscape bzr9042 against batik 1.7 & Opera 10.10.

Tags: renderer text

Related branches

Revision history for this message
ScislaC (scislac) wrote :
Revision history for this message
su_v (suv-lp) wrote :

reproduced with Inkscape 0.47+devel r9040 on OS X 10.5.8,
checked against Batik 1.7 and Safari 4.0.4

Changed in inkscape:
status: New → Confirmed
ScislaC (scislac)
Changed in inkscape:
importance: Undecided → Medium
ScislaC (scislac)
Changed in inkscape:
importance: Medium → High
jazzynico (jazzynico)
tags: added: renderer
removed: rendering
Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

I've tracked down the problem to lines 532-3 in sp-text.cpp. The "x" and "y" attributes are being stripped from the <tspan>s before the data is sent to the layout engine. As a result, the running total "dy" does not get reset to zero in Layout-TNG-compute.cpp.

According to SVG 1.1 spec:
    An absolute position adjustment occurs in the following circumstances:
    * At the start of a 'text' element
    * At the start of each 'textPath' element
    * For each character within a 'text', 'tspan', 'tref' and 'altGlyph' element which has an x or y attribute value assigned to it explicitly

So it is wrong to ignore the "x" and "y" attributes.

I don't want to change the code without checking with the authors to find out why it is written the way it is. This layout code is quite complicated due to the implementation of flowed text.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

In retrospect, I think Inkscape's current behavior is consistent with what one would naively expect: if a section of text is selected, only that text moves, if no text is selected, the characters following the text cursor all shift (even if they are in different lines). The problem is that on writing out the SVG, the first "dy" attribute in a <tspan> must be written correctly so other SVG viewers render the text in the same way.

I have modified Layout-TNG-Compute.cpp to ensure that the first <tspan> of each line is offset only by the line-spacing. This fixes the immediate problem of ensuring Inkscape's rendering is the same as other viewers. Until more work is done, only vertical kerning within one line will work properly.

Changed in inkscape:
assignee: nobody → Tavmjong Bah (tavmjong-free)
status: Confirmed → Fix Committed
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.48
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.