Skip to content
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

Feature Request: Antialiasing mode options #1298

Closed
Tracked by #1790
Baael opened this issue Jun 17, 2019 · 25 comments · Fixed by #4711
Closed
Tracked by #1790

Feature Request: Antialiasing mode options #1298

Baael opened this issue Jun 17, 2019 · 25 comments · Fixed by #4711
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Milestone

Comments

@Baael
Copy link

Baael commented Jun 17, 2019

Summary of the new feature/enhancement

Support for different text rendering modes, current mode at least for me causes eye strain making new terminal unusable.
Example between terminal (left) and conemu (right):
text rendering terminal and conemu

Proposed technical implementation details

Adding options to profiles.json:

{
...
"TextAntialiasMode": "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE",
...
}
@Baael Baael added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Jun 17, 2019
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 17, 2019
@zadjii-msft zadjii-msft added Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Jun 18, 2019
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Jun 18, 2019
@zadjii-msft zadjii-msft added this to the Terminal v1.0 milestone Jun 18, 2019
@zadjii-msft
Copy link
Member

I think this is a really good idea, and one that @miniksa and I have definitely discussed before.

I'd probably want to make the settings values a little clearer than "D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE", but that we could hash out in a PR I think :)

@zadjii-msft zadjii-msft added the Help Wanted We encourage anyone to jump in on these. label Jun 18, 2019
@DHowett-MSFT DHowett-MSFT removed the Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting label Jun 18, 2019
@DHowett-MSFT DHowett-MSFT changed the title Feature Request: Antialiasing mode Feature Request: Antialiasing mode options Jun 19, 2019
@hwti
Copy link

hwti commented Jun 22, 2019

https://docs.microsoft.com/en-us/windows/desktop/api/d2d1/ne-d2d1-d2d1_text_antialias_mode

If the render target has an alpha channel and is not set to D2D1_ALPHA_MODE_IGNORE, then the default text antialiasing mode is grayscale.

Maybe that's the issue here.

It would be nice if we could set the DWRITE_RENDERING_MODE/DWRITE_MEASURING_MODE too.
For example, look at text rendering in Firefox and Chrome, both using DirectWrite, even in cases when they both enable ClearType : Firefox uses the "GDI classic" mode in some cases :

  • gfx.font_rendering.cleartype_params.force_gdi_classic_for_families = Arial,Consolas,Courier New,Microsoft Sans Serif,Segoe UI,Tahoma,Trebuchet MS,Verdana
  • gfx.font_rendering.cleartype_params.force_gdi_classic_max_size = 15

@Lombra
Copy link

Lombra commented Jun 24, 2019

My heart sank the moment I first opened Windows Terminal and witnessed this awful text rendering method that's prevalent in Chromium based applications. (notably Electron based apps) Glad to hear it might get fixed.

Is there a scenario in which the blurry rendering is required, or why is it used? Is the clear text not objectively better looking?

@miniksa
Copy link
Member

miniksa commented Jun 24, 2019

Grayscale rendering is significantly faster than ClearType. You also cannot mix ClearType with alpha blending of the background.

This should be offered as a user preference for sure because everyone has their own tastes when it comes to text rendering.

@hwti
Copy link

hwti commented Jun 24, 2019

You also cannot mix ClearType with alpha blending of the background.

But IHMO it makes sense to use "GDI classic" rendering mode to disable subpixel positioning (and perhaps a stronger hinting) in this case, especially for a monospace font.

@miniksa
Copy link
Member

miniksa commented Jun 24, 2019

You also cannot mix ClearType with alpha blending of the background.

But IHMO it makes sense to use "GDI classic" rendering mode to disable subpixel positioning (and perhaps a stronger hinting) in this case, especially for a monospace font.

That might also be a user preference. Maybe someone likes subpixel positioning. Maybe the default should be GDI Classic. To be honest, I haven't thought that hard about this specific topic while standing up the renderer, so it hasn't been addressed.

If someone has strong reasons one way or another, I'd love to hear them. Or I'd love to see someone try them out and prove why one beats the other handily. Or offer both as choices.

@svofski
Copy link

svofski commented Jun 30, 2019

Please also consider adding an option to completely disable antialiasing. Not everyone likes soapy text.

@george-tsiros
Copy link

george-tsiros commented Sep 3, 2019

call me crazy, but i think it should by default obey the system-wide settings and if they want to do something different, obey the user's choice

@garyo
Copy link

garyo commented Nov 21, 2019

Is this why my Windows Terminal fonts look vertically stretched? I use Hack, size 10. In Windows Terminal the lowercase "e" is 8 pixels high. In all other apps (Emacs, WSL terminal etc.), lowercase "e" is 7 pixels high (and is ClearType-antialiased rather than monochrome). Sample of Windows Terminal (0.6.2951.0):
image

Sample of WSL terminal (different theme but same text):
image

As you can see, the same font is significantly taller in Windows Terminal. (The prompt line is also rendered in bold in WSL, but look at the echoed text -- that's not bold in both samples, so should be comparable.)

@george-tsiros
Copy link

george-tsiros commented Nov 21, 2019 via email

@garyo
Copy link

garyo commented Nov 21, 2019

the fact that you ask for a size "10" font doesn't mean anything.

Well yes, it's possible of course. I do understand in some detail how Windows TrueType font creation/selection works though; and the fact that these samples have (almost) the same width but different heights suggests to me that something else is at work here. And in every other Windows program I use that font in (OneNote, Word and some web apps, as well as the examples I gave above), it does not come out vertically stretched like that.

@Arcitec
Copy link

Arcitec commented Dec 6, 2019

Opened Windows Terminal for the first time today. My first impression was that something is very wrong. Then I realized the text looked awful, as if I need to wear glasses because the text is out of focus. Tried changing font to no avail. :-/

I don't understand the comments above. Did you say that this antialiasing/blur is necessary to allow acrylic backgrounds to work?

I hope the text can be made sharp with a better anti aliasing algorithm. Like in notepad.exe, which is rendering crisply antialiased text. I don't think Terminal is supposed to be so blurry in comparison, right?

@melak47
Copy link

melak47 commented Dec 7, 2019

Did you say that this antialiasing/blur is necessary to allow acrylic backgrounds to work?

No -- ClearType works fine on the acrylic background. The alpha blending only comes into play in the titlebar IIRC (when drawing over the standard titlebar), but I think that should be fine, too, since any area where text is drawn into the titlebar is entirely covered by an opaque background color.

You can build the terminal yourself, replace the single use of D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE with D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE, and see this result:

term

In the titlebar, it still uses grayscale AA. I haven't looked enough to be able to say if this is because of alpha blending problems, or if that text is drawn differently and doesn't use this AA mode because of that.

@carlescufi
Copy link

carlescufi commented Feb 17, 2020

I wonder if rendering without antialiasing at all, a la mintty, would be possible as well, at least for certain fonts:

image

zadjii-msft added a commit that referenced this issue Feb 24, 2020
@ghost ghost added the In-PR This issue has a related PR label Feb 24, 2020
@ghost ghost closed this as completed in #4711 Feb 25, 2020
@ghost ghost added Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed In-PR This issue has a related PR labels Feb 25, 2020
ghost pushed a commit that referenced this issue Feb 25, 2020
## 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.
* "antialiasingMode": "grayscale": the current behavior, `D2D1_TEXT_ANTIALIAS_MODE_GRAYSCALE`
* "antialiasingMode": "cleartype": use `D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE` instead


## PR Checklist
* [x] Closes #1298
* [x] I work here
* [ ] I didn't add tests 
* [x] Requires documentation to be updated

## Detailed Description of the Pull Request / Additional comments
Grayscale:
 
![image](https://user-images.githubusercontent.com/18356694/75173847-2373f680-56f5-11ea-8896-c1cf04c61d41.png)



Cleartype:
![image](https://user-images.githubusercontent.com/18356694/75173854-25d65080-56f5-11ea-9de1-e2d1c343cae5.png)

 


Side-by-side (can you tell which is which?) <!-- grayscale, cleartype -->
 
![image](https://user-images.githubusercontent.com/18356694/75173864-28d14100-56f5-11ea-8bdd-d47a60fbbe4d.png)
@Legorooj
Copy link

I'm still seeing this when running the very latest terminal 1.0.1401.0 when using "antialiasingMode": "cleartype" on every profile in my settings.json.

Every single profile in profiles.list has "antialiasingMode": "cleartype" set, and it's set in profiles.defaults.

I tried:

  • Updating - I was seeing this last version as well (0.11.x?) - and that made no difference.
  • Reinstalling and editing cleartype into the settings before opening Terminal in the first place. No difference.
  • Nearly an hour on Google - this and related threads primarily - with no result.

I'm a little stuck.

@melak47
Copy link

melak47 commented May 21, 2020

@Legorooj if you have acrylic on, it won't use cleartype, see #5277

@Legorooj
Copy link

@melak47

"defaults":
{
    // Put settings here that you want to apply to all profiles.
    "antialiasingMode": "cleartype",
    "useAcrylic": false
},

The error still occurs (several relaunches. I also tried setting it individually for each profile):

PowerShell 21_05_2020 5_34_34 PM

@miniksa
Copy link
Member

miniksa commented May 29, 2020

@melak47

"defaults":
{
    // Put settings here that you want to apply to all profiles.
    "antialiasingMode": "cleartype",
    "useAcrylic": false
},

The error still occurs (several relaunches. I also tried setting it individually for each profile):

PowerShell 21_05_2020 5_34_34 PM

@Legorooj, that's not a cleartype error. That screenshot is of the problem in #5759.
You can try the rendering settings documented behind https://docs.microsoft.com/en-us/windows/terminal/troubleshooting#the-text-is-blurry to set either full repaints or software rendering to mitigate that until we can fully understand what is causing some graphics drivers to blur out the previous frames of our rendering.

@Legorooj
Copy link

@miniksa thanks for that - somehow I didn't come across that issue or the settings page. Using forced software rendering seems to have fixed the problem. Thanks!

@george-tsiros
Copy link

george-tsiros commented May 30, 2020 via email

@mic345
Copy link

mic345 commented Jul 10, 2020

Question -- some people turn off the "smooth edge of screen fonts" option available on the "Performance Options", so the fonts look pixeleted but crystal sharp. From what I saw the fonts stay the same with this option turned on or off. Can you please check if this is causing the fonts to look smudge?

Take care and awesome terminal you've got there 👍
Mic.

@ofek
Copy link
Contributor

ofek commented Jun 19, 2022

if you have acrylic on, it won't use cleartype, see #5277

is that still the case?

@seabdelh

This comment was marked as off-topic.

@zadjii-msft

This comment was marked as off-topic.

@seabdelh

This comment was marked as off-topic.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Rendering Text rendering, emoji, complex glyph & font-fallback issues Area-Settings Issues related to settings and customizability, for console or terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Priority-3 A description (P3) Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.