Closed Bug 1655364 Opened 5 years ago Closed 5 years ago

Consolas text above a certain size does not get right-aligned properly

Categories

(Core :: Layout: Text and Fonts, defect)

defect

Tracking

()

RESOLVED FIXED
81 Branch
Tracking Status
firefox81 --- fixed

People

(Reporter: heycam, Assigned: heycam)

References

Details

Attachments

(1 file, 1 obsolete file)

I'm experimenting with Consolas as the default monospace font on Windows, and I find that layout/reftests/text/1522857-1.html fails. (It also fails if I modify the test to use Consolas instead of monospace.) It only fails, on my machine, when the font-size is at least 125px. This feels like a return of bug 1522857 but I couldn't reproduce this with various other fonts on my system.

So it seems like we have a similar issue here, where the CompressedGlyph is not being marked as CHAR_IS_SPACE. When the text run is initially created, we do correctly set that flag, under gfxShapedText::SetupClusterBoundaries, but when we got to shape it, we overwrite the CompressedGlyph with a new value without CHAR_IS_SPACE. That's done by gfxHarfBuzzShaper::SetGlyphsFromRun calling gfxShapedText::SetGlyphs.

Assignee: nobody → cam
Status: NEW → ASSIGNED

I think most (but not all) callers of gfxShapedText::SetGlyphs do want to preserve the character type flags.

Maybe the CAN_BREAK_BEFORE flags too?

Here's a try push of the alternative approach I'd like to suggest.... let's see how it goes:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=40388e844f187637f22c701c25f16dd315f3ee06

Looking at gfxShapedText::SetGlyphs and how it's used by the various callers, I think we should rework it so that it doesn't touch any of the character flags, and is only responsible for setting the DetailedGlyph data for the given index. In most cases, callers don't want to touch the other flags, and currently in some cases we have go to extra effort e.g. to read the existing IsClusterStart flag only so as to pass it back again as part of the CompressedGlyph.

So I propose renaming SetGlyphs to SetDetailedGlyphs, and passing in not a CompressedGlyph record (with flags that the caller probably didn't want to deal with at all) but just a glyph count and pointer to the DetailedGlyph records. I'll post a patch for your consideration.

Attachment #9166209 - Attachment is obsolete: true
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/3c88adc13a06 Rename gfxShapedText::SetGlyphs to SetDetailedGlyphs and make it just set glyph information, not clobber character-type flags. r=heycam

Ahh... reftests managed to find a case where I tripped over my own assertion; well, that's what it's there for! Now fixed.

Flags: needinfo?(jfkthame)
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/07f5cb328a10 Rename gfxShapedText::SetGlyphs to SetDetailedGlyphs and make it just set glyph information, not clobber character-type flags. r=heycam
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 81 Branch
Regressions: 1663230
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: