Open Bug 1677988 Opened 4 years ago Updated 2 years ago

SVG image with text distorted with a minimum font size in Firefox preferences

Categories

(Core :: SVG, defect)

defect

Tracking

()

Tracking Status
firefox-esr78 --- affected
firefox82 --- wontfix
firefox83 --- wontfix
firefox84 --- affected
firefox85 --- affected

People

(Reporter: pascalc, Unassigned)

References

Details

Attachments

(2 files)

I don't know if this bug belongs to fonts, SVG or another component, feel free to move it to a better component.

Using any version of Firefox (tested 78, 83, 85), the svg animation at https://github.com/sharkdp/fd is broken with gigantic text if you set a minimum font size in Firefox.

I checked in Chrome and with the same minimum font size, the svg animation remains unaffected.

The svg file is at https://raw.githubusercontent.com/sharkdp/fd/master/doc/screencast.svg

I am attaching a screencast of the difference in behaviour between Nightly 85 on the left and Chome 86 on the right.

Hmm. https://bug358032.bmoattachments.org/attachment.cgi?id=243486 is unaffected by minimum font size. bug 935056 fixed that case. I wonder what the difference is.

If you take the simplified testcase and move the font-size attribute to the text element then the minimum font size issue goes away. Any ideas Cameron?

Flags: needinfo?(cam)

We apply the internal -x-text-zoom: false property to SVG text elements (which we also use for disabling minimum font size):

https://searchfox.org/mozilla-central/rev/1d34bd022de0b55c81d9db6026f69bda1d4a86d2/servo/components/style/gecko/wrapper.rs#1708-1712

and the minimum size is applied at computed value time:

https://searchfox.org/mozilla-central/rev/1d34bd022de0b55c81d9db6026f69bda1d4a86d2/servo/components/style/properties/cascade.rs#931-960

We have code that undoes the effect of text zoom, if that is enabled:

https://searchfox.org/mozilla-central/rev/1d34bd022de0b55c81d9db6026f69bda1d4a86d2/servo/components/style/properties/cascade.rs#962-988

We don't do anything similar for undoing the effect of the minimum font size, nor can we, unless we stored what the original unclamped value was.

Not sure what the best way to solve this is. We could move the -x-text-zoom rule to apply to svg elements, which would fix this case, but wouldn't fix other cases where a font-size is inherited in from some containing HTML, for example. (It'd also disabling text zoom and minimum font sizes for content inside a foreignObject, too.)

Severity: -- → S3
Flags: needinfo?(cam)
Version: Firefox 85 → Trunk

Still an issue here on Firefox 99 with a minimum font size of 13 set. On Linux I need to set this minimum to deal with font scaling issues on hidpi screens.

I found the text large and seemingly corrupted with release-it's svg animation and reported it to them before finding this existing bug.

Testing the svg workaround of setting font-size attribute to every text element did resolve the issue.

As a practical note, many people generate SVGs of their code in action and place them in their GitHub repo Readme's. Here's one of the many tickets with screenshots I've filed with repos about this. At my minimum font size of 20 these SVG screencasts are literally unreadable (not because of low vision issues, because they text size is completely screwed up).

This is a very real accessibility issue for people with low vision needs.

I'd add the screenshot here but i don't seem to have that option.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: