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

Allow ligatures in WebGL #5888

Conversation

jacob-israel-turner
Copy link

Adds ligature support for WebGL renderer.

Fixes #3607

@jacob-israel-turner
Copy link
Author

jacob-israel-turner commented Aug 24, 2021

The xterm.js team added ligature support for WebGL a few months ago (you can see links in this comment). This PR simply lets xterm-addon-ligatures do its thing.

Copy link
Contributor

@GitSquared GitSquared left a comment

Choose a reason for hiding this comment

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

Thanks for the ping - glad it works!

@jacob-israel-turner
Copy link
Author

Thanks for the approval @GitSquared ! What's the process to get this merged?

@LabhanshAgrawal
Copy link
Collaborator

There are rendering issues with ligatures and webGL renderer
See #5757 and xtermjs/xterm.js#3303
Thus, had to disabled this combination in 1e64e72
We won't be enabling this until it's fixed upstream.
You may use hyper-font-ligatures plugin till then if you want though.

@GitSquared
Copy link
Contributor

@jacob-israel-turner Sorry, there might be some confusion here: I only approved this as someone who previously worked on that feature, I am not a core Hyper contributor and I can't merge PRs into the main branch.

@LabhanshAgrawal Great job on upstream issues helping Daniel, it seems the issue has been fixed in xtermjs/xterm.js#3286 and released in https://github.com/xtermjs/xterm.js/releases/tag/4.12.0, is there anything else preventing Hyper from enabling ligatures+webgl as well? Otherwise I think this PR could be merged - the xterm.js dependency in Hyper is up to date, too.

I've just enabled it on a terminal emulator with the same stack (GitSquared/edex-ui@1b4d3d5) and it works perfectly.

@LabhanshAgrawal
Copy link
Collaborator

@GitSquared That issue is with the 4.12 release also, it's reproducible in the xterm.js demo too.
There are other issues open for webgl+ligatures in the xterm repo also.
Ligatures work with webgl, but the rendering issues make it unusable.
You might test with a simple ls -al it's easily reproduced with colored output.

@jacob-israel-turner
Copy link
Author

Thanks for your response @LabhanshAgrawal!

Ligatures work with webgl, but the rendering issues make it unusable.

From the issues I've seen, I would say this statement is debatable. It seems that there are occasional wrong color for some of the ligatures. From my perspective, I have three options:

  1. Use WebGL without ligatures
  2. Use hyper-font-ligatures without WebGL
  3. Use WebGL with ligatures, including the minor visual bugs

I would prefer to use option 3 while the XTerm.js team figures out the cause of the bugs. #2 is simply not an option, as the performance cost of turning off WebGL is not reasonable.

Would it not be appropriate to allow users enable ligatures with WebGL, but include a disclaimer that there are known issues when mixing the two?

@LabhanshAgrawal
Copy link
Collaborator

Thanks for your response @LabhanshAgrawal!

Ligatures work with webgl, but the rendering issues make it unusable.

From the issues I've seen, I would say this statement is debatable. It seems that there are occasional wrong color for some of the ligatures. From my perspective, I have three options:

  1. Use WebGL without ligatures
  2. Use hyper-font-ligatures without WebGL
  3. Use WebGL with ligatures, including the minor visual bugs

I would prefer to use option 3 while the XTerm.js team figures out the cause of the bugs. #2 is simply not an option, as the performance cost of turning off WebGL is not reasonable.

Would it not be appropriate to allow users enable ligatures with WebGL, but include a disclaimer that there are known issues when mixing the two?

Well, it's not just wrong colors, but that aside. You can actually use the hyper-font-ligatures plugin with webgl, it doesn't force you to use canvas renderer. It just loads the xterm ligatures plugin.

@jacob-israel-turner
Copy link
Author

hyper-font-ligatures uses a very old version of xterm-addon-ligatures, which is unusable with WebGL. The changes presented in this PR provide an environment that, in my experience, is usable.

If you feel strongly that users shouldn't be able to turn on ligatures with WebGL for now, then I'll go submit a PR to the hyper-font-ligatures repo to upgrade xterm-addon-ligatures instead.

@LabhanshAgrawal
Copy link
Collaborator

Yeah, I think updating it on the ligatures plugin for now would be better. Or you can just put it in a local plugin.

@jacob-israel-turner
Copy link
Author

Opened a PR over at hyper-font-ligatures: tolbertam/hyper-font-ligatures#11

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.

Font ligatures don't work v3
3 participants