marionebl / svg-term-cli

Share terminal sessions via SVG and CSS
MIT License
3.48k stars 116 forks source link

Incorrect display on FF 66a with "Minimum font size" set #39

Open pabuisson opened 5 years ago

pabuisson commented 5 years ago

Hey,

Following up on this. Here's what I get when I display a term SVG in Firefox 66 (nightly), on macOS :

capture d ecran 2019-01-09 a 21 30 32

The image is animated alright, but font size and spacing and everything seems broken. Same svg is displayed nicely on the same machine with a blink-based browser or an old FF-56.

I tried to turn off every ad-blocking and tracker-blocking and content-blocking addon and it's still the same.

marionebl commented 5 years ago

Thanks for reporting @pabuisson! I use FF 64 and can not reproduce the issue either. Test with FF Nightly pending.

marionebl commented 5 years ago

@pabuisson:

Using FF 66.0a1 (2019-01-11) I could not reproduce the issue. Are all the svg images on Darren's post affected for you?

pabuisson commented 5 years ago

Yes all images. It might be an issue with an addon of mine, I'll try to find what could lead to this. Maybe in a few hours though. I'll keep you posted.

pabuisson commented 5 years ago

Found it! It was not related to any addon. Actually, in my Firefox, I got the "Minimum font size" setting set to 9. That's what's making the SVG looks like the screenshot of the first post. If I set "Minimum font size" to "None", then I get the expected result :

capture d ecran 2019-01-12 a 10 17 43

I checked my chrome-based browsers, they also have this "Minimum font size" setting set to 9 but it has no impact on the SVG rendering.

Hope it helped!

marionebl commented 5 years ago

Thank you for the analysis! I'll see what svg-term-cli can do to mitigate the issue.

jwhitley commented 5 years ago

This appears to be the current and correct tracking issue in Bugzilla. Sadly there was a whole run of attempts to fix this, which all got backed out due to causing other intermittent regressions:

https://bugzilla.mozilla.org/show_bug.cgi?id=935056

But it does contain some info on what causes the regression, essentially Firefox applying minimum size clamping too early in SVG text size computation. E.g. FF applies minimum size clamping to "5px" in the SVG file's coordinate system, not the actual on-screen rendered text size due factoring in the SVG viewport. That suggests a possible solution where manipulating/scaling the coordinate system in the generated SVGs, but leaving the final on-screen size the same, may produce a fix.

jwhitley commented 5 years ago

For posterity's sake, I also found this comment on a nearly identical Chromium issue, before a fix was landed there:

https://bugs.chromium.org/p/chromium/issues/detail?id=232332#c11

The minimal font size restriction can be bypassed in SVG by setting text-rendering="geometricPrecision" on the text element or parent elements[...]

Unfortunately, that attribute appears to have zero effect on the Firefox bug. I manually edited the svg-term-cli parrot example to test this, but it's not a workaround.

jwhitley commented 5 years ago

See also this SO post on this exact issue.

jonathanlermitage commented 2 years ago

Thx for the font.minimum-size workaround! I faced this issue with Firefox 98, I can show animated SVG correctly now :partying_face: