Skip to content

Fix CGlyphRunResource::GetDWriteRenderingMode to choose correct DWriteRenderingMode under ClearType - #2668

Merged
rladuca merged 6 commits into
dotnet:masterfrom
rladuca:cleartype_fix
Mar 6, 2020
Merged

rladuca merged 6 commits into
dotnet:masterfrom
rladuca:cleartype_fix

Conversation

@rladuca

@rladuca rladuca commented Feb 28, 2020

Copy link
Copy Markdown
Member

Fixes #2025

…on of the suggested rendering mode from DWrite when TextRenderingMode is set to ClearType.
@rladuca rladuca added this to the 5.0 milestone Feb 28, 2020
@rladuca rladuca self-assigned this Feb 28, 2020
@ghost ghost added the PR metadata: Label to tag PRs, to facilitate with triage label Feb 28, 2020
@vatsan-madhavan

vatsan-madhavan commented Feb 28, 2020 •

Copy link
Copy Markdown
Member

~Do we still support Windows Server 2008 R2? ~

Never mind - GetRecommendedRenderingMode is supported there anyway.

@rladuca

rladuca commented Feb 28, 2020

Copy link
Copy Markdown
Member Author

Do we still support Windows Server 2008 R2?

Can you explain what that has to do with this change? We will only choose symmetric if DWrite itself chooses symmetric. It's not obvious, but DWRITE_RENDERING_MODE_NATURAL_SYMMETRIC and DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC are the same. As in, they have the exact same value in the enumeration.

@vatsan-madhavan

Copy link
Copy Markdown
Member

Can you explain what that has to do with this change?

I rushed into the question thinking it was new call and may not be supported on some platforms; and then realized it has been used before all along.

@rladuca

rladuca commented Feb 28, 2020

Copy link
Copy Markdown
Member Author

Can you explain what that has to do with this change?

I rushed into the question thinking it was new call and may not be supported on some platforms; and then realized it has been used before all along.

All good, there are other things I am looking into that actually do have a Win8+ requirement. But those would have to be a separate PR and would be much more extensive and invasive. If that actually becomes a thing we need to have a discussion about what we're willing to change in the rendering process to fully support them. I'll file a different issue altogether.

@vatsan-madhavan

Copy link
Copy Markdown
Member

LGTM; low pri - can you add some comments about how a sample app might exercise each of the branches in GetDWriteRenderingMode (including the last dangling else with just an assert)? It would be helpful when writing tests for this, I think (or debugging problems...)

@rladuca

rladuca commented Feb 28, 2020

Copy link
Copy Markdown
Member Author

Sure, I can add that.

@rladuca

rladuca commented Feb 28, 2020

Copy link
Copy Markdown
Member Author

I am going to wait on merging this anyway until I get some more info on how effective this change will be.

@rladuca rladuca added the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Feb 28, 2020
@rladuca rladuca removed the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Feb 28, 2020

@SamBent SamBent left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your code calls DWrite and ignores the result in many cases. I'd prefer only calling DWrite if there's a chance of using the result, to avoid needless perf and risk. It should be easy enough to do, starting with changing old line 970-1 to
if ( (textRenderingMode == Grayscale) ||
((textRenderingMode == ClearType && IsDisplayMeasured()))

@rladuca

rladuca commented Mar 2, 2020

Copy link
Copy Markdown
Member Author

I did a run of all text DRTs and microsuites and everything passed. I'm suspicious that we don't have certain parts of this coverage ported for .NET Core. Before I merge this I am going to make the equivalent changes to .NET Framework and get a full pass done there.

@rladuca rladuca added the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 2, 2020
@vatsan-madhavan vatsan-madhavan changed the title Fix CGlyphRunResource::GetDWriteRenderingMode to choose correct DWriteRenderingMode under ClearType WIP: Fix CGlyphRunResource::GetDWriteRenderingMode to choose correct DWriteRenderingMode under ClearType Mar 5, 2020
@vatsan-madhavan

Copy link
Copy Markdown
Member

@rladuca changing title to WIP to prevent accidental merge.

@rladuca

rladuca commented Mar 6, 2020

Copy link
Copy Markdown
Member Author

Full test run is back and everything looks good, merging.

@rladuca rladuca removed the * NO MERGE * metadata: The PR is not ready for merge yet (see discussion for detailed reasons) label Mar 6, 2020
@rladuca rladuca changed the title WIP: Fix CGlyphRunResource::GetDWriteRenderingMode to choose correct DWriteRenderingMode under ClearType Fix CGlyphRunResource::GetDWriteRenderingMode to choose correct DWriteRenderingMode under ClearType Mar 6, 2020
@rladuca
rladuca merged commit 4e16591 into dotnet:master Mar 6, 2020
@SamBent SamBent mentioned this pull request Sep 24, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Apr 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ClearType TextRenderingMode uses incorrect DWrite rendering mode

3 participants