Page MenuHomePhabricator

Fonts are off in rasterized SVG images on wikimedia sites
Closed, ResolvedPublic

Description

Author: avarab

Description:
Images like the one in the url component that are supposed to have the letter(s)
in them fit exactly to the image have those letters overflow the image, this is
probably a problem with the font(s) at Wikimedia sites as I've been been unable
to reproduce this with both rsvg 2.9.5 and 2.12.7 on my local install, rendering
attached.


Version: unspecified
Severity: normal
OS: Windows XP
Platform: PC
URL: http://commons.wikimedia.org/wiki/Image:Rhetorical_question_mark.svg

Details

Reference
bz3769

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 8:53 PM
bzimport set Reference to bz3769.
bzimport added a subscriber: Unknown Object (MLST).

avarab wrote:

The image in the URL component rendered on a local install with rsvg 2.12.7

Attached:

rqm-2.12.7.png (498×300 px, 6 KB)

and we have problem with cyrillic letters in rasterized SVG.

This is SVG with latin labels
http://commons.wikimedia.org/wiki/Image:Rhetorical_question_mark.svg

Same figure with Russian translation:
http://ru.wikipedia.org/wiki/Image:Orbita.svg (black boxes)

The font rasterizer should have a better default font, and should also be able
to do the Serif vs Sans serif difference between font:
ex: http://fr.wiktionary.org/wiki/Image:Wiki_logo.svg
The text "Wiktionnaire" should be Serif and "/wik.sjɔ.nɛr/" is missing two
characters.

No difference after upgrading to 2.14.0.

shimmin wrote:

See http://en.wikipedia.org/wiki/Image:Vanillin-ex-eugenol.svg

The subscript 3's are rendered huge. This image renders correctly in Inkscape,
or if opened in Mozilla, but the Mediawiki rasterizer is mangling it.

shimmin wrote:

(In reply to comment #5)

See http://en.wikipedia.org/wiki/Image:Vanillin-ex-eugenol.svg

The subscript 3's are rendered huge. This image renders correctly in Inkscape,
or if opened in Mozilla, but the Mediawiki rasterizer is mangling it.

Diagnosis: font-size="75%" fails to be understood as 75% of the parent's size,
but instead appears to be taken as 75% of the canvas height! I'll fix this
particular image by specifying the font-size in point terms, but the parser
still needs to be fixed.

The problems of missing letters and the lack of serif fonts appear to be fixed.
The inconsistency in font sizes between rsvg and Inkscape remains. If the
handling of font-size="75%" really is incorrect in rsvg, it needs to be reported
upstream.

I learned (painfully) that the rasterizer does not properly handle spacing in fonts. Specifically, it seems to treat multiple spaces as a single space in certain cases. The only workaround is to separate the spaced text into separate elements, which is awkward.

feroflo wrote:

In the same subject, there is a problem with the font "NSimSun" in this file: [http://commons.wikimedia.org/wiki/Image:Euro2008_venues_wu.svg] some Chinese characters had been changed from the file made with Inkscape 0.46.

*** Bug 19182 has been marked as a duplicate of this bug. ***

To add another image where this is very pronounced, http://commons.wikimedia.org/wiki/Image:Planetary_transit_sr.svg

The image, if rendered at normal size is rendered perfectly: http://upload.wikimedia.org/wikipedia/commons/thumb/5/59/Planetary_transit_sr.svg/800px-Planetary_transit_sr.svg.png - actually the arrows are not rendered but this is a known rsvg bug.

However, if rendered at a reduced size, the text gets strange spaces at random places: http://upload.wikimedia.org/wikipedia/commons/thumb/5/59/Planetary_transit_sr.svg/300px-Planetary_transit_sr.svg.png - for example the text at bottom right that reads "Светлосна крива" becomes something like "Св ет лосн а кри".

I don't think this is a rsvg bug b/c on my computer rsvg (2.18.2) renders the image in reduced size just fine, and I don't see how it could be a MediaWiki bug. My guess is that this is caused by bad fonts installed on the servers.

Also very interesting: image history thumbnails. http://upload.wikimedia.org/wikipedia/commons/thumb/archive/5/59/20080129224211!Planetary_transit_sr.svg/120px-Planetary_transit_sr.svg.png is mangled, http://upload.wikimedia.org/wikipedia/commons/thumb/5/59/Planetary_transit_sr.svg/120px-Planetary_transit_sr.svg.png is just fine.

Assigning SVG bugs to Ariel -- need a cleanup pass to see what's fixed up by a librsvg upgrade, what can be resolved with fixes to our font configuration, what can be fixed on our end, and what still needs to be pushed upstream.

giving SVG bugs back to the pool.

The rethorical question mark issue seems fixed. There are still many other issues with fonts, some exhibit in some of the files reported here, but these effects all seem to have individual reports.