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

Support sub-pixel anti-aliasing and fix blurry text issues #991

Merged
merged 10 commits into from
Sep 14, 2017

Conversation

Tyriar
Copy link
Member

@Tyriar Tyriar commented Sep 14, 2017

This PR does the following:

  • Characters are now drawn to an integer grid, but cell width is now floored. Originally it was ceiled which made the text look odd, and then a floating point number was used which makes the CharAtlas optimizations look blurry. Now characters look great whether they're cached or uncached.
  • Background and foreground layers are now merged, this was necessary to support sub-pixel anti-aliasing as the effect only applies when drawn only an opaque background.
  • Bold is now supported for uncached text.

Fixes #988
Fixes #987
Fixes #973


Browser zoom 100%

Before:

screen shot 2017-09-13 at 11 37 55 pm

After:

screen shot 2017-09-13 at 11 34 11 pm

Browser zoom 100%, magnified

Before zoomed in:

screen shot 2017-09-13 at 11 39 18 pm

After zoomed in:

screen shot 2017-09-13 at 11 35 20 pm

Browser zoom 150%

Before:

screen shot 2017-09-13 at 11 39 50 pm

After:

screen shot 2017-09-13 at 11 36 48 pm

@Tyriar Tyriar added this to the 3.0.0 milestone Sep 14, 2017
@Tyriar Tyriar self-assigned this Sep 14, 2017
@Tyriar Tyriar requested a review from mofux September 14, 2017 06:41
@Tyriar
Copy link
Member Author

Tyriar commented Sep 14, 2017

I just covered the following cases:

  • Draw background on text layer before the canvas is shown to prevent a black flash when the background isn't #000
  • Draw background on char atlas to properly support non-#000 backgrounds
  • Redraw background when the canvas is resized

screen shot 2017-09-13 at 11 56 13 pm

screen shot 2017-09-13 at 11 57 54 pm

@coveralls
Copy link

coveralls commented Sep 14, 2017

Coverage Status

Coverage decreased (-0.2%) to 70.003% when pulling b225866 on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 70.127% when pulling c2b765f on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 70.127% when pulling c2b765f on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

Prevents black flash on init
@coveralls
Copy link

coveralls commented Sep 14, 2017

Coverage Status

Coverage decreased (-0.1%) to 70.035% when pulling aca7ab6 on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

@coveralls
Copy link

coveralls commented Sep 14, 2017

Coverage Status

Coverage decreased (-0.04%) to 70.116% when pulling fee381e on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

@coveralls
Copy link

coveralls commented Sep 14, 2017

Coverage Status

Coverage decreased (-0.03%) to 70.127% when pulling 8bdc8fb on Tyriar:blurriness_fix into 136c82f on sourcelair:v3.

Copy link
Contributor

@mofux mofux left a comment

Choose a reason for hiding this comment

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

This looks really good now. There are two remarks I want to make:

  1. After this is merged, we should open / re-open an issue to merge the selection layer logic into the TextRenderLayer, or come up with another approach to have the selection drawn between foreground and background.

  2. Using Chrome's Rendering Inspector and enabling Paint Flashes, I can see that almost the whole line is now repainted if I type a regular letter like "w". Only exception seems to be a space character. Is this intentional?

Update: Forget about 2). This also happens in the current v3 branch. It only happens in zsh but not in bash though - probably zsh sends not only the letter but the whole line if the prompt changes.

repaint

@Tyriar
Copy link
Member Author

Tyriar commented Sep 14, 2017

The paint flashing in 2 isn't actually re-drawing the whole line, Chrome's just saying "things in this rectangle are changing"

@Tyriar Tyriar merged commit e8d784a into xtermjs:v3 Sep 14, 2017
@Tyriar Tyriar deleted the blurriness_fix branch September 14, 2017 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants