Page MenuHomePhabricator

[BUG] Font doesn't render on SVG Translate
Closed, ResolvedPublic5 Story PointsBug

Description

A specific font seems to be missing on Toolforge.

Steps to reproduce:

Go to this image

Expected behavior: Preview displays Malayalam.
Actual behavior: Preview is missing the font.

As seen on Safari and Chrome.

Event Timeline

Niharika triaged this task as Normal priority.Apr 9 2019, 10:29 PM
Niharika created this task.
Restricted Application added a project: Community-Tech. · View Herald TranscriptApr 9 2019, 10:29 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Niharika changed the subtype of this task from "Task" to "Bug Report".Apr 9 2019, 10:30 PM
Niharika moved this task from Untriaged to To be estimated/discussed on the Community-Tech board.
Niharika changed the point value for this task from 0 to 5.Apr 9 2019, 11:15 PM
Niharika moved this task from To be estimated/discussed to Estimated on the Community-Tech board.

This file only specified font-family:Arial in the text elements, so I added a serif fallback font family (font-family:Arial serif), and the file now renders correctly: https://tools.wmflabs.org/svgtranslate-test/File:Mosquito_gender_ml.svg

Arial is a proprietary font and we'll not be able to install it, I think.

aezell added a subscriber: aezell.Apr 10 2019, 1:11 PM

Nice. It's a bummer we can't install it but I'm glad we didn't have to delve into a bunch of parsing issues.

Is it possible for our application to catch if the font isn't installed? It might be a cool future feature to prompt the user with something like: "This file might be using a commercial font and there is no appropriate fallback provided by the file."

Nice. It's a bummer we can't install it but I'm glad we didn't have to delve into a bunch of parsing issues.
Is it possible for our application to catch if the font isn't installed? It might be a cool future feature to prompt the user with something like: "This file might be using a commercial font and there is no appropriate fallback provided by the file."

+1. Even better if we can automatically fallback. Is that possible?

We can't easily detect that the font isn't installed, but we can check for the five fallback families: "serif", "sans-serif", "cursive", "fantasy", and "monospace". One of those is supposed to always be the last term in a font-family specification.

I would've thought that most SVG authoring tools would do this themselves, but the above image was created with Illustrator so I guess not. I'm pretty sure Inkscape does, unless you manually override it.

It's hard to know how widespread this problem is. I think it might not be that hard to just tack on sans-serif to any font-family that doesn't already end with one of the above — aren't we already inspecting that value in the Transformations class? I'll have a look...

TheDJ added a subscriber: TheDJ.Apr 12 2019, 8:03 AM

Hmmm, no fontconfig integration in librsvg to handle fontsubstitution ?

MaxSem claimed this task.Apr 16 2019, 9:00 PM
MaxSem moved this task from Ready to In Development on the Community-Tech-Sprint board.

I've moved the webservice from containers to gridengine and the image renders now - gridengine hosts have lots of packages to satisfy all possible tool needs while containers contain a fairly limited set.

That sounds like a good move to me! Thanks.

dom_walden added a subscriber: dom_walden.

Checked the image in the description and a couple of others I have seen this problem with previously (here, here and here).

Fonts all rendered on production.

Niharika closed this task as Resolved.Apr 18 2019, 8:39 PM
Niharika moved this task from Product sign-off to Done on the Community-Tech-Sprint board.
Niharika moved this task from Backlog to Done on the SVG Translate Tool board.Apr 30 2019, 6:46 PM