Closed Bug 546813 Opened 10 years ago Closed 10 years ago

nsSVGGlyphFrame should get the language from the style of its frame, not the prescontext

Categories

(Core :: SVG, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(2 files)

When we create textruns for SVG text, we should use the lang of the appropriate style, not simply the lang of the prescontext.

The attached testcase shows runs of text within <div> elements tagged with various lang attributes; in each case, there is a line of HTML text and then a line of SVG text. Assuming that the default fonts for Chinese (traditional), Chinese (simplified), and Japanese are set to different fonts, the HTML text will correctly reflect these preferences, but the SVG text ignores them.
With this patch, the fonts selected for the SVG text match those selected in HTML.
Assignee: nobody → jfkthame
Attachment #427496 - Flags: review?(jwatt)
Can the test be turned into a reftest, or does the dependency on fonts make that hard?
(In reply to comment #2)
> Can the test be turned into a reftest, or does the dependency on fonts make
> that hard?

I was wondering about that - it may depend on what our default font prefs are like on the various platforms, and what's present on the tinderboxes. I'll give it a try and see how it looks....
I've tried a reftest for this and it works fine locally, but on tryserver it only works as intended on OS X; both the Linux and Windows boxes seem to be severely font-challenged (e.g, no Chinese fonts), and end up resolving generics to the same real fonts regardless of the language.

I suppose it should be possible to do a mochitest that explicitly modifies the preferences in such a way that the language does lead to a font difference even on those boxes.
Comment on attachment 427496 [details] [diff] [review]
patch, v1: use language from the frame's styleContext

Well r=jwatt on the patch, and I'll leave it up to you to decide if the effort that you'd need to go to to create a test is the best use of your time. This seems like it's something that we're unlikely to break in future.
Attachment #427496 - Flags: review?(jwatt) → review+
Well, if nothing else I could land a reftest that's marked random on Windows and Linux; at least we'd have a little bit of test coverage, though only on one platform for now.

Eventually we should have unit tests running on Win7, I presume, at which point the reftest ought to work there too, as I think adequate fonts will be present by default.
Sounds good to me.
Pushed to m-c:
http://hg.mozilla.org/mozilla-central/rev/dc0a12049204

Also pushed a reftest that works for Mac and Windows:
http://hg.mozilla.org/mozilla-central/rev/9d933626f72d
This test fails under Linux on the tryserver due to lack of appropriate fonts, although it works for me locally. So marked as random on Linux for now.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.