Page MenuHomePhabricator

[BUG] Word missing in rendered image
Closed, ResolvedPublic5 Estimated Story Points

Description

Current behavior

SVG Translate renders image with the word "Sustainable" missing in the image. The api does return the correct image at some point but it seems like the cached version is missing that word. It could also be related to the fact that that word has weird formatting in the original file.

Expected behavior

File renders exactly as in Commons.

Note: See parent ticket for other image rendering related tickets.

Event Timeline

Niharika triaged this task as Medium priority.Feb 11 2019, 7:30 PM
Niharika created this task.

@Jinoytommanjaly @KCVelaga I also created this ticket which is related to the issue you raised.

When the page loads, "sustainable" appears on the image over the radial fill, but then the image is overwritten and "sustainable" disappears.

Niharika set the point value for this task to 5.Feb 13 2019, 12:32 AM
Niharika moved this task from Needs Discussion to Up Next (June 3-21) on the Community-Tech board.

The sustainable text starts out as

<switch transform="translate(320,277.5) scale(0.7,1.0)" font-size="24" font-style="italic" fill="black">
  <text systemLanguage="en">Sustainable</text>
  <text systemLanguage="ca">Sostenible</text>
  <text systemLanguage="de">nachhaltig</text>
  <text systemLanguage="eo">Daŭriva</text>
  <text systemLanguage="es">Sostenible</text>
  <text systemLanguage="eu">Iraunkorra</text>
  <text systemLanguage="fr">Durable</text>
  <text systemLanguage="it">Sostenibile</text>
  <text systemLanguage="lv">Ilgtspējīga</text>
  <text systemLanguage="no">Bærekraftig</text>
  <text systemLanguage="pl">Zrównoważenie</text>
  <text systemLanguage="uk">Стійкий</text>
  <text systemLanguage="zh-hans" transform="scale(1.4,1)">可持续的</text>
  <text>Sustainable</text>
</switch>

I add a stupid lang=ang translation and download the file. The switch turned into

<switch transform="scale(1.4,1)" font-size="24" font-style="italic" fill="black">
  <text systemLanguage="en" id="trsvg155"><tspan id="trsvg57">Sustainable</tspan></text>
  <text systemLanguage="ca" id="trsvg156"><tspan id="trsvg58">Sostenible</tspan></text>
  <text systemLanguage="de" id="trsvg157"><tspan id="trsvg59">nachhaltig</tspan></text>
  <text systemLanguage="eo" id="trsvg158"><tspan id="trsvg60">Daŭriva</tspan></text>
  <text systemLanguage="es" id="trsvg159"><tspan id="trsvg61">Sostenible</tspan></text>
  <text systemLanguage="eu" id="trsvg160"><tspan id="trsvg62">Iraunkorra</tspan></text>
  <text systemLanguage="fr" id="trsvg161"><tspan id="trsvg63">Durable</tspan></text>
  <text systemLanguage="it" id="trsvg162"><tspan id="trsvg64">Sostenibile</tspan></text>
  <text systemLanguage="lv" id="trsvg163"><tspan id="trsvg65">Ilgtspējīga</tspan></text>
  <text systemLanguage="no" id="trsvg164"><tspan id="trsvg66">Bærekraftig</tspan></text>
  <text systemLanguage="pl" id="trsvg165"><tspan id="trsvg67">Zrównoważenie</tspan></text>
  <text systemLanguage="uk" id="trsvg166"><tspan id="trsvg68">Стійкий</tspan></text>
  <text systemLanguage="zh-hans" id="trsvg167"><tspan id="trsvg69">可持续的</tspan></text>
  
<text id="trsvg168-ang" systemLanguage="ang"><tspan id="trsvg70-ang">b</tspan></text><text id="trsvg168"><tspan id="trsvg70">Sustainable</tspan></text></switch>

notice that transform="translate(320,277.5) scale(0.7,1.0)" was changed to transform="scale(0.7,1.0)". That means the text was moved to start at (0,0) rather than (320,277.5). That paints the text outside of the viewBox, so it is not visible.

Therefore, the code mishandles concatenated transforms.

In another test, text with a text-anchor="middle" attribute briefly flashed as centered but was immediately replaced with text-anchor="start" text. I suspect that attribute is also munged.

Samwilson moved this task from Ready to In Development on the Community-Tech-Sprint board.
Samwilson subscribed.

What if we don't bother with special-handling for transform? The comment in the code at the moment is "Transforms on individual texts are particular problematic", but it seems that not doing anything still works okay on the images I've tested.

What if we don't bother with special-handling for transform? The comment in the code at the moment is "Transforms on individual texts are particular problematic", but it seems that not doing anything still works okay on the images I've tested.

Sounds good to me. This good to go to QA?