Page MenuHomePhabricator

[BUG] Fix issues with skewed translation labels
Open, NormalPublic

Description

This bug is reproducible in at least one image: Anatomy of the Human Ear. Obviously that image is like a cornerstone for this project, so we should fix it.

The problem is that the label "Malleus" appears in a weird position in the PNG we generate in SVG Translate but the Commons file has the label positioned correctly. You can note that the problem is with the PNG by changing the To language dropdown to be non-English and see that the PNG still retains the odd positioning of the label. Screenshots below:

SVG Translate versionCommons version

Acceptance criteria:

Figure out what's causing this anomaly and fix it so it does not cause this issue for other similar files. Our images should always match up exactly with the Commons versions.

Event Timeline

Niharika triaged this task as Normal priority.Jan 16 2019, 3:48 PM
Niharika created this task.
Restricted Application added a project: Community-Tech. · View Herald TranscriptJan 16 2019, 3:48 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Niharika renamed this task from [BUG] Fix issue(s) with skewed translation label(s) to [BUG] Fix issues with skewed translation labels.Jan 16 2019, 3:48 PM
Niharika updated the task description. (Show Details)
Niharika moved this task from Untriaged to To be estimated/discussed on the Community-Tech board.
Glrx added a subscriber: Glrx.EditedFeb 14 2019, 6:46 PM

The bug looks like the tool scanned the switch element:

<switch transform="translate(222 162)">
  <text systemLanguage="de">Hammer</text>
  <text systemLanguage="en">Malleus</text>
  <text systemLanguage="eo">martelo</text>
  <text systemLanguage="fa">چکشی</text>
  <text systemLanguage="fi">Vasara</text>
  <text systemLanguage="fr">Marteau</text>
  <text systemLanguage="he">מאליוס</text>
  <text systemLanguage="ne">हथौडा</text>
  <text systemLanguage="ru">молоточек</text>
  <text systemLanguage="ta" transform="rotate(56.201)" x="80" y="-54" text-anchor="end">சம்மட்டியுருவெலும்பு</text>
  <text>Malleus</text>
</switch>

noticed the Tamil (systemLanguage="ta") clause with its transform attribute, and then promoted that attribute for the entire switch/all clauses. Consequently, "Malleus" would be painted at (0,0) with a rotation of 56.201 degrees. IIRC, SVGTranslate v 2.0 did such over-enthusiastic promotions.

@Glrx Do you recommend overlooking transforms entirely if they apply on one element in a switch but not others? Can we?

Glrx added a comment.Feb 14 2019, 7:52 PM

No, you should not overlook any transform.

Transforms and other properties in switch clauses should only be promoted (aka hoisted) if they appear on each and every clause of the switch. Such promotions must concatenate with any existing transforms rather than replace the existing transforms. Do not assume that properties on one clause exist on all other clauses. That was the mistake that SVGTranslate 2.0 was doing.

SVG files are programs, and any manipulations of the SVG should be done with the same care as optimizing compilers.

No, you should not overlook any transform.
Transforms and other properties in switch clauses should only be promoted (aka hoisted) if they appear on each and every clause of the switch. Such promotions must concatenate with any existing transforms rather than replace the existing transforms. Do not assume that properties on one clause exist on all other clauses. That was the mistake that SVGTranslate 2.0 was doing.
SVG files are programs, and any manipulations of the SVG should be done with the same care as optimizing compilers.

Thanks @Glrx. @MaxSem @Samwilson Thoughts on this?