Conversation
carlos-zamora
left a comment
There was a problem hiding this comment.
Straightforward. Most of it is just piping the enum all the way down to the renderer.
Considering that D2D1_TEXT_ANTIALIAS_MODE_ALIASED is basically the only one left, should we just yeet it into this PR too?
@msftbot make sure @miniksa signs off on this
|
Please do put aliased in as an option. |
|
Should this be the beginning of the but of course, maybe it chould also support a string ( |
|
@DHowett-MSFT I'm gonna argue no, because I want this for 1.0 😄 That's a fine idea for 1.x/backlog IMO. If "font" is a string, use that. If it's a object, try parsing other bits out of it. That'll work well enough, but won't land this side of 1.0 |
| }, | ||
| "antialiasingMode": { | ||
| "default": "grayscale", | ||
| "description": "Controls how text is antialiased in the renderer. Possible values are \"grayscale\", \"cleartype\" and \"aliased\". Note that changing this setting will require starting a new terminal instance.", |
There was a problem hiding this comment.
Explain the default maybe? Grayscale is faster than cleartype but doesn't look as jagged as aliased. It's a compromise.
src/renderer/dx/DxRenderer.cpp
Outdated
| // Routine Description: | ||
| // - Changes the antialiasing mode of the renderer. This must be called before | ||
| // _PrepareRenderTarget, otherwise the renderer will default to | ||
| // D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE. This has only been tested with |
There was a problem hiding this comment.
it is no longer true that it has been tested with only those 😄 right?
|
Hello @zadjii-msft! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
## 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.

Summary of the Pull Request
I needed to do something to keep sane so today I day of learned about antialiasing. This PR adds the ability to specify the
"antialiasingMode"as a setting.D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALED2D1_TEXT_ANTIALIAS_MODE_CLEARTYPEinsteadPR Checklist
Detailed Description of the Pull Request / Additional comments
Grayscale:
Cleartype:

Side-by-side (can you tell which is which?)