Open Bug 818236 Opened 12 years ago Updated 2 years ago

SVG render differences Inkscape vs. Firefox - font is wider in Firefox

Categories

(Core :: SVG, defect)

17 Branch
x86
Windows XP
defect

Tracking

()

UNCONFIRMED

People

(Reporter: mathog, Unassigned)

References

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/17.0 Firefox/17.0 SeaMonkey/2.14 Build ID: 20121118021014 Steps to reproduce: The attached file was created in Inkscape. It uses 18 pt Arial text. In the SVG file everything is in px, so 22.5px font, as inkscape is 90dpi internally. On each line a red boundary box was drawn manually from the leading edge of the first period to the trailing edge of the last "A". When this SVG is viewed in Firefox the text is slightly wider than the boundary, but the height is correct. (Zoom in to see this clearly.) So inkscape is apparently doing something different with this text than firefox is, otherwise the text would be exactly in the box in Firefox too. One possibility is that the browser is using some font other than Arial, which is a bit wider (but the same height). Is there some way to make the unmodified browser cough up this information? If this is the case, is there something that can be added to SVG to force it to use the specified font? Or is something else going on?
Cross reference to same bug filed in Inkscape: https://bugzilla.mozilla.org/show_bug.cgi?id=818236
Component: Untriaged → SVG
Product: Firefox → Core
what does the Graphics section of about:support say? Try toggling gfx.font_rendering.directwrite.enabled using about:config too could be Inkscape is using GDI+ while Firefox is using DirectWrite font rendering or vice versa.
Flags: needinfo?(mathog)
(In reply to David Mathog from comment #1) > Cross reference to same bug filed in Inkscape: > > https://bugzilla.mozilla.org/show_bug.cgi?id=818236 No, that's just this bug right here!
oops, sorry. The cross reference is: https://bugs.launchpad.net/inkscape/+bug/1086126 Graphics section of "about:support" Adapter Description NVIDIA Quadro FX 1400 Vendor ID0x10de Device ID0x00ce Adapter RAM Unknown Adapter Drivers nv4_disp Driver Version 6.14.13.593 Driver Date8-18-2012 WebGL Renderer Google Inc. -- ANGLE (NVIDIA Quadro FX 1400) -- OpenGL ES 2.0 (ANGLE 1.0.0.1242) GPU Accelerated Windows1/1 Direct3D 9 AzureCanvasBackend cairo AzureFallbackCanvasBackend none AzureContentBackend none toggling gfx.font_rendering.directwrite.enabled did not change anything. (Neither did toggling any of the other true/false settings that I tried.) Do these take effect immediately or must Firefox be restarted between each one? Note, the problem is seen on firefox on both linux and windows, so GDI(+) cannot be the issue. Is there a way to turn on some sort of logging so that firefox will say which font it actually used?
Flags: needinfo?(mathog)
Could it be for example that we are applying kerning information from the font and Inkscape isn't?
Both programs use kerning, as shown in this example. Open it in Inkscape and the final "P" is in a different position in each line, while the initial "W"'s are aligned. It looks like that in Firefox too, but the text is, again, outside the text boundary box drawn in Inkscape.
This is another test case made with lp988601 inkscape. The red boxes were not redrawn for each set, but the font was changed. The idea being that if this was just a case of the font "Arial" in inkscape being a different font in Firefox, then one of the others would have lined up in Firefox. However none did, so that is less likely to be the problem. (Still could be if it was some other obscure font I did not try.) However, this turned up another problem. Look at the "SANS" font in this example in Firefox - whatever it is it is not Sans, since it is a Serif font. The other sans-serif fonts stayed that way.
Do you have a font named "Sans" installed locally? It sounds like Inkscape is mapping font names to fonts differently from Firefox.
Inkscape uses Fontconfig. There is no font on the test system(s) named simply "Sans". It is most likely using DejaVu Sans because: % fc-match sans DejaVuSans.ttf: "DejaVu Sans" "Book" Not sure how firefox is doing it, but if it is through fontconfig then it must be using its own, different, set of fontconfig rule files, since whatever that Serif font is that it filled in for "Sans", it certainly is not "DejaVu Sans". The simplest hypothesis for all of this is that the two font substitution systems are using different fonts - except none of the obvious contenders from the system font directory matched. Does Firefox use its own fonts???
Firefox does not use its own fonts.
I think this is due the fact browsers unlike SVG renderers don't recognize "sans" alias but they like "sans-serif" instead. I guess if you use both, "font-family: sans-serif, sans;", both would be happy.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: