-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using cleartype anti aliasing makes dark foreground invisible on light background. #5098
Comments
Yikes okay, I'm reading more about this problem and this is sounding harder the more I read about it. Basically, if you want to use cleartype text, you want to make sure to give the DX target a background behind the cleartext text. Otherwise, it can't really figure out how to blend the cleartype text. We're currently not giving the text a background for the default background color, as to support acrylic. So our dx render target will have a transparent BG, and the entire swapchain is drawn on top of the acrylic background. I think I can patch this, but I think this basically means that if you want cleartype text, you can't have acrylic, and vice-versa. Since we're able to hot-reload and dynamically change acrylic opacity, but not the antialiasing mode, I think this means we'll need to have cleartype disable acrylic opacity entirely. Unless there were some way to have the transparent parts of the swapchain not added to the underlying surface, but that's still not the right solution. DWrite just really doesn't want to let us have cleartype on a target where there's no BG already. It also seems like we can't get the rendered acrylic surface before we paint a DX frame to try and manually set that as the background for the target. Or maybe there's something else I can do with |
## Summary of the Pull Request When we're on acrylic, we can't have cleartype text unfortunately. This PR changes the DX renderer to force cleartype runs of text that are on a non-opaque background to use grayscale AA instead. ## References Here are some of the URLS I was referencing as writing this: * https://stackoverflow.com/q/23587787 * https://docs.microsoft.com/en-us/windows/win32/direct2d/supported-pixel-formats-and-alpha-modes#cleartype-and-alpha-modes * https://devblogs.microsoft.com/oldnewthing/20150129-00/?p=44803 * https://docs.microsoft.com/en-us/windows/win32/api/d2d1/ne-d2d1-d2d1_layer_options * https://docs.microsoft.com/en-us/windows/win32/direct2d/direct2d-layers-overview#d2d1_layer_parameters1-and-d2d1_layer_options1 * https://docs.microsoft.com/en-us/windows/win32/api/dcommon/ne-dcommon-d2d1_alpha_mode?redirectedfrom=MSDN#cleartype-and-alpha-modes * https://stackoverflow.com/a/26523006 Additionally: * This was introduced in #4711 ## PR Checklist * [x] Closes #5098 * [x] I work here * [ ] Tests added/passed * [n/a] Requires documentation to be updated ## Detailed Description of the Pull Request / Additional comments Basically, if you use cleartype on a light background, what you'll get today is the text foreground color _added_ to the background. This will make the text look basically invisible. So, what I did was use some trickery with `PushLayer` to basically create a layer where the text would be forced to render in grayscale AA. I only enable this layer pushing business when both: * The user has enabled cleartype text * The background opacity < 1.0 This plumbs some information through from the TermControl to the DX Renderer to make this smooth. ## Validation Steps Performed Opened both cleartype and grayscale panes SxS, and messed with the opacity liberally.
🎉This issue was addressed in #5277, which has now been successfully released as Handy links: |
Environment
Steps to reproduce
Setting profile settings to following:
and theme settings to:
Expected behavior
Black text
F:\>
is visible. When antialiasingMode is set to cleartype.Actual behavior
Black text
F:\>
is invisible after setting antialiasingMode to cleartype (on the right):Same issue with cmd ("acrylicOpacity" : 0.75):
The text was updated successfully, but these errors were encountered: