Using cleartype anti aliasing makes dark foreground invisible on light background. #7118

Closed
opened 2026-01-31 00:55:34 +00:00 by claunia · 3 comments
Owner

Originally created by @alexFrankfurt on GitHub (Mar 24, 2020).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: 10.0.18363.0
Windows Terminal version: 0.10.781.0
Powershell version: 7.0.0

Steps to reproduce

Setting profile settings to following:

{
    "useAcrylic": false,
    "closeOnExit" : true,
    "colorScheme" : "Campbell",
    "guid": "{a3c89eef-1dbe-4ac1-acc5-2412499f8619}",
    "hidden": false,
    "name": "PowerShell 7",
    "commandline" : "C:\\Program Files\\PowerShell\\7\\pwsh.exe",
    "icon" : "C:\\Program Files\\PowerShell\\7\\assets\\Powershell_av_colors.ico",
    "antialiasingMode": "grayscale",
    "cursorShape" : "bar",
    "cursorColor": "#121005",
    "fontFace" : "Consolas",
    "fontSize" : 10,
    "snapOnInput" : true,
    "historySize" : 9001
}

and theme settings to:

{
    "name" : "Campbell",

    "foreground" : "#020200",
    "background" : "#ffffff",
    "selectionBackground": "#121005",

    "black" : "#0C0C0C",
    "blue" : "#0037DA",
    "brightBlack" : "#767676",
    "brightBlue" : "#3B78FF",
    "brightCyan" : "#61D6D6",
    "brightGreen" : "#16C60C",
    "brightPurple" : "#B4009E",
    "brightRed" : "#E74856",
    "brightWhite" : "#121212",
    "brightYellow" : "#3B78FF",
    "cyan" : "#3A96DD",
    "green" : "#13A10E",
    "purple" : "#881798",
    "red" : "#C50F1F",
    "white" : "#CCCCCC",
    "yellow" : "#C19C00"
}

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):
image
Same issue with cmd ("acrylicOpacity" : 0.75):
image

Originally created by @alexFrankfurt on GitHub (Mar 24, 2020). Originally assigned to: @zadjii-msft on GitHub. # Environment ```none Windows build number: 10.0.18363.0 Windows Terminal version: 0.10.781.0 Powershell version: 7.0.0 ``` # Steps to reproduce Setting profile settings to following: ```json { "useAcrylic": false, "closeOnExit" : true, "colorScheme" : "Campbell", "guid": "{a3c89eef-1dbe-4ac1-acc5-2412499f8619}", "hidden": false, "name": "PowerShell 7", "commandline" : "C:\\Program Files\\PowerShell\\7\\pwsh.exe", "icon" : "C:\\Program Files\\PowerShell\\7\\assets\\Powershell_av_colors.ico", "antialiasingMode": "grayscale", "cursorShape" : "bar", "cursorColor": "#121005", "fontFace" : "Consolas", "fontSize" : 10, "snapOnInput" : true, "historySize" : 9001 } ``` and theme settings to: ```json { "name" : "Campbell", "foreground" : "#020200", "background" : "#ffffff", "selectionBackground": "#121005", "black" : "#0C0C0C", "blue" : "#0037DA", "brightBlack" : "#767676", "brightBlue" : "#3B78FF", "brightCyan" : "#61D6D6", "brightGreen" : "#16C60C", "brightPurple" : "#B4009E", "brightRed" : "#E74856", "brightWhite" : "#121212", "brightYellow" : "#3B78FF", "cyan" : "#3A96DD", "green" : "#13A10E", "purple" : "#881798", "red" : "#C50F1F", "white" : "#CCCCCC", "yellow" : "#C19C00" } ``` # 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): ![image](https://user-images.githubusercontent.com/11091671/77416329-cbeca780-6dd4-11ea-9e17-eb7ed07ef51b.png) Same issue with cmd ("acrylicOpacity" : 0.75): ![image](https://user-images.githubusercontent.com/11091671/77418748-626e9800-6dd8-11ea-9e9e-e4ff4b8b1dc8.png)
Author
Owner

@zadjii-msft commented on GitHub (Apr 6, 2020):

I'll be damned that repros for me immediately

Huh, seems like we're doing some weird blending for cleartype text:
image

@zadjii-msft commented on GitHub (Apr 6, 2020): I'll be damned that repros for me immediately Huh, seems like we're doing some weird blending for cleartype text: ![image](https://user-images.githubusercontent.com/18356694/78607888-86dd6200-7825-11ea-8271-f98be723715f.png)
Author
Owner

@zadjii-msft commented on GitHub (Apr 7, 2020):

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 D2D1_LAYER_OPTIONS1_IGNORE_ALPHA? I've got no idea if that'll work

@zadjii-msft commented on GitHub (Apr 7, 2020): 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 `D2D1_LAYER_OPTIONS1_IGNORE_ALPHA`? I've got no idea if that'll work
Author
Owner

@ghost commented on GitHub (May 5, 2020):

:tada:This issue was addressed in #5277, which has now been successfully released as Windows Terminal Release Candidate v0.11.1251.0 (1.0rc1).🎉

Handy links:

@ghost commented on GitHub (May 5, 2020): :tada:This issue was addressed in #5277, which has now been successfully released as `Windows Terminal Release Candidate v0.11.1251.0 (1.0rc1)`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v0.11.1251.0 (1.0rc1)) * [Store Download](https://www.microsoft.com/store/apps/9n0dx20hk701?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#7118