Open Bug 844643 Opened 11 years ago Updated 2 years ago

advance width of missing-glyphs in canvas text does not account for DPI correctly

Categories

(Core :: Graphics: Text, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: jfkthame, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

When there are missing glyphs (characters not supported by any font) in canvas text, the gap left for the missing glyphs is scaled incorrectly with DPI changes due to hidpi support and/or scaling of the canvas transform.

This is more obvious now that bug 808288 part 2 has been re-landed, so that ".notdef" boxes are rendered instead of just blank space, but the incorrect scaling of the missing-glyph advance existed even before this.

The attached testcase demonstrates the behavior. On a Retina display, the missing-glyph advances are twice what they should be; and the second set of three lines (where "scale(5, 5)" is applied to the canvas) the advances are multiplied to 5x the expected width.
The advance calculation was wrong even before bug 808288 part 1 is landed.
This bug is not even limited to canvas.
Component: Canvas: 2D → Graphics: Text
Attached file unscaled testcase
This is not even related with scaling.
gfxFontMissingGlyphs tries to ensure the minimum width for hex micro-glyphs.
But if the font-size is too small, hexes will not be rendered anyway because there's no enough height. We should stop to ensure the minimum width (or should ensure the minimum width based on a more reasonable value).
Ugh, yes, that looks pretty bad.

Also, zooming in on your testcase shows that once we start drawing the hex digits, they're way oversized for the available height of the box. So we're not handling zoom properly there. (Requires a hidpi display to reproduce with your testcase as it stands, but if you change the font size to 5px it will reproduce with non-hidpi as well.)
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: