with directwrite, vertical positioning of text depends on opacity

ASSIGNED
Assigned to

Status

()

Core
Graphics
ASSIGNED
8 years ago
6 years ago

People

(Reporter: jfkthame, Assigned: bas)

Tracking

(Blocks: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

8 years ago
Created attachment 452255 [details]
sample demonstrating vertical-position discrepancy

Possibly related to bug 550431, or another symptom of the same underlying issue.

With DirectWrite enabled, the vertical positioning of text changes slightly, depending on the particular HTML elements in use, when using the canvas painting path rather than an actual browser window. One way to trigger this is if opacity is used to make the text semi-transparent.

This is the cause of a number of reftest failures with dwrite, including layout/reftests/bidi/413928-*. These work correctly in the browser window, but fail under the reftest framework, because of the different painting paths used.

The attached sample based on reftest 413928 demonstrates the issue; it allows you to flip between a "testcase" using an ordered list, and a "reference" that uses simple <div>s. Without the 50% opacity option, the two display identically; but when 50% opacity is enabled, the testcase and reference no longer match.
(Reporter)

Updated

8 years ago
Blocks: 549832
(Assignee)

Comment 1

8 years ago
This is related to the fact that for non-opaque glyphs (or rendering to non-opaque surfaces) our code applies intermediate surfaces that cause us to render using a fallback path. I'm currently investigating and fixing some things in our fallback in the meanwhile.
(Assignee)

Comment 2

8 years ago
If we set the fallback path to : 'DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL' (we lose sub-pixel vertical anti-aliasing). This problem indeed disappears. Currently we're forcing the fallback to enable vertical anti-aliasing, but we're not forcing the normal path to. This is because for the normal path we're allowed to use DWRITE_RENDERING_MODE_DEFAULT, which switches rendering modes based on font sizes. For the font size of the test cases vertical AA will be disabled.

The RENDERING_MODE_DEFAULT is not available for the CreateGlyphRunAnalysis we're using to get the alpha texture for our fallback path.
(Assignee)

Comment 3

8 years ago
Created attachment 455495 [details] [diff] [review]
Use recommended rendering mode in fallback path

This will use the recommended rendering mode for the current font configuration in the fallback path. This will provide the results most similar to the normal rendering path. Some follow-up patches will come to properly handle subpixel-AA in the fallback path.
Assignee: nobody → bas.schouten
Status: NEW → ASSIGNED
Attachment #455495 - Flags: review?(jmuizelaar)
Attachment #455495 - Flags: review?(jmuizelaar) → review+
You need to log in before you can comment on or make changes to this bug.