Page MenuHomePhabricator

[BUG] Fix weird color changing issues with PNGs generated in SVG Translate
Closed, ResolvedPublicBUG REPORT

Description

This is a very fun bug!

Steps to reproduce:

  1. Go to https://tools.wmflabs.org/svgtranslate-test/File:Ear-anatomy-text-small-en.svg
  2. Wait a few seconds for the file to load.
  3. While initially the file loads correctly (red labels), the labels change color a second later -
SVG Translate fileCommons file

Acceptance criteria:

Fix the issue and make sure it does not happen for any other files either.

Event Timeline

Niharika triaged this task as Normal priority.Jan 16 2019, 4:05 PM
Niharika created this task.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 16 2019, 4:05 PM

The file that loads initially is also being produced by our invocation of rsvg, so it seems like that the error is being introduced by our manipulation of the SVG. (This is good.)

We should be able to add a test based a minimal part of the above SVG file to confirm that we're modifying all the tspan's attributes correctly. I wonder if some part of the style attribute is malformed?

Glrx added a subscriber: Glrx.EditedFeb 14 2019, 7:07 PM

The file has text element stroke and fill properties countermanded by tspan elements. Generally, text should not be stroked in an SVG file unless one is looking for special effects. The "Pinna" rendering is the most dramatic for the bug. Look at "Pinna" in the tool's rendering; only the strokes are visible and the fill is none. On Commons, the text is not stroked but filled with saturated red.

<text
   x="121.01102"
   y="329.13699"
   id="text4209"
   xml:space="preserve"
   style="font-size:60px;fill:none;stroke:#000000;stroke-width:1px"><tspan
     x="121.01102"
     y="329.13699"
     id="tspan4211"
     style="font-size:60px;fill:#ff0000;stroke:none">Pinna</tspan></text>

The tool is using the text element paint context when it should be using the tspan context.

Other text has the red fill in the text element; text looks darker and bolder in the tool due to the black 1px stroke.

MBinder_WMF changed the subtype of this task from "Task" to "Bug Report".Mar 26 2019, 11:04 PM
dom_walden added a subscriber: dom_walden.

I was not able to reproduce this on staging or production, using the svg in the description. I also compared the SVG downloaded from svgtranslate with the one from Commons. The <tspan> style attribute is being preserved correctly.

Lots of visual comparisons of svgtranslate and Commons was done in T215580#5115279 (and incidentally as part of other testing). While there can sometimes be differences in font rendering (probably due to rsvg), nothing like described here.

Suggesting this is fixed.

dom_walden closed this task as Resolved.Apr 16 2019, 4:07 PM
dom_walden claimed this task.
dom_walden moved this task from Backlog to Done on the SVG Translate Tool board.
dom_walden moved this task from Ready to Done on the Community-Tech-Sprint board.