Page MenuHomePhabricator

SVG renderer text layout problems with nested attributes
Closed, ResolvedPublic

Description

Details

Reference
bz32197

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:00 AM
bzimport set Reference to bz32197.
bzimport added a subscriber: Unknown Object (MLST).

Looks fine offhand; can you point out what's wrong specifically?

(In reply to comment #1)

Looks fine offhand; can you point out what's wrong specifically?

  1. Line 3 in headlines: "维基百科" and "," after it are swapped
  2. Line 5 in "不是程序员?" box: "支持" and "其他用户" are swapped
  3. Line 6 in "不是程序员?" box: "传播" and "消息" are swapped

Looks like something's going awry with the nested <tspan> elements. Trimmed down:

<text>

<tspan>
  MediaWiki
  <tspan>
    ,
  </tspan>
  维基百科
  <tspan>
    上
  </tspan>
</tspan>
<tspan>
  <tspan>
    运行的软件,正在寻找
  </tspan>
  贡献者
</tspan>

</text>

I'm seeing the same buggy mislayout using rsvg on my local dev box: Ubuntu 11.10 with rsvg 2.34.1.

I don't know much about XML structure of SVG files but Iceweasel generated that file. Is it a bug there?

ie. Are nested <tspan>s invalid?

No, they're perfectly valid -- there's an upstream bug in Gnome bugzilla on what looks like the same issue seen in other files:
https://bugzilla.gnome.org/show_bug.cgi?id=581108

Upstream bug has a provisional patch someone posted in 2010, which with a slight update appears to resolve the issue.

librsvg maintainers seem to not be very active, I'll see if we can find someone to push it...

I've posted updates on the bug & emailed the original patch author and one of the current librsvg maintainers; hopefully we'll get a good communication channel going for this & other svg bugs... \o/

Patch has been committed to master upstream; if it holds ok ought to make it into the Gnome 3.4 release but not promised yet. :)