Page MenuHomePhabricator

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

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
image.png (926×1 px, 713 KB)
image.png (1×2 px, 911 KB)

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 created this task.
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 New & TBD Tickets to Needs Discussion on the Community-Tech board.

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?

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?