-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 font ligatures #958
Comments
I think we are not interested into the regular ligatures (in fact, it would be bad to enable ligatures for |
What would happen if half of the ligature is a different color? How would you handle that? |
@LoganDark does that even work with regular ligatures? Or are they split up when they're different colors? |
No, and no. |
i wonder if it would be possible to pull render code from txtjs, as they have figured out how to render ligatures, although i think they manually draw the text. http://txtjs.com/examples/Text/ligatures.html |
@devsnek I don't think it's an issue actually doing the rendering of the text. The issue is knowing which character join so they can be drawn together (Currently "==" is drawn as "=" and "=", not "=="). |
@Tyriar wouldn't the font renderer take care of that without our intervention |
@devsnek IT'S YOU disclaimer: completely off topic, just a random comment |
If we're going by how other emulators handle them, they do get split up if they are different colors, as one would expect. This is almost a requirement since this allows symbols to be correctly represented by some language highlighters in ViM, for example. I think it's entirely acceptable to show the individual symbols if the render mode is not the same for all of the underlying characters. |
@Qix- My suggestion then would be to draw all the text at once and then do coloring in post. That would eliminate any issues with ligatures, and wouldn't require detecting ligature pairs (although it would break compatibility with variable-width fonts, or even monospace fonts that are slightly off/don't have integer widths) |
@LoganDark multi-colored ligatures would look bizarre and there would be no clear way to color them IMO. |
Yeah I don't think multi-color ligatures would work. It also goes against how they work underneath, where a single glyph is drawn at the start, not multiple. As a clarification, this is waiting on a good solution for detecting which character sequences have ligatures. To do this properly it would probably involve low level code that checks font files (and thus would need to be a native node module and not work for web consumers), I don't think this information is exposed to the web platform. |
Now that hyper released 2.0.0 stable, maybe ligature workarounds need a higher priority. |
Determining the glyph mappings manually is a tough nut to crack. From what I can tell, making a decent experience out of this would require the following:
I've done some initial poking around with Fira Code (specifically its nerd font variant) to try to figure out how difficult each step might be. I haven't yet decided whether I'm feeling ambitious enough (or care about font ligatures enough) to take this on, but here's what I've found so the knowledge isn't lost:
|
@princjef Thanks for sharing your explorations, really really helpful! I have also been putting some thoughts into this topic a couple days ago, and I came to the following conclusion:
TBH, I don't think it's worth the effort to support ligatures at the current state 😔 |
I've opened a pr princjef/font-ligatures#22 as the first step in getting this done |
The pr's open for quite some time now, what to do? |
I reached out to @princjef on Teams. |
I have opened a pr with the discussed idea. Do check it out and test. #3264 |
As #3264 is merged now, what's the next step? |
@LabhanshAgrawal just implemented character joiner support in the dom renderer with #3285, webgl still needs to happen which shouldn't be too difficult as well #3094. Pulling out the xterm.js only bits from microsoft/vscode#34103:
|
I can take a look at webgl if needed, but it will take some time as I'm not familiar with it at all right now. |
@LabhanshAgrawal I'm on it atm 🙂 |
That's great then 😊👍 |
Oh, it's already done. |
Please close this ticket when releases, I would be happy to try it immediately as it releases. :) |
@jukrb0x the webgl ligature support is done, I was going to keep this open until it's done in VS Code to do the remaining mostly clean up items:
|
tsc was returning errors as it was importing xterm.d.cs twice
This reverts commit 1bdbd4c.
Knock knock 😶👀 |
@NewtonChutney latest update for vscode: microsoft/vscode#34103 (comment) |
@Tyriar Not sure if this is related - tried to run gh CI with node 16|18 and it failed with some weird output error for the ligature addon, whilte it works with node 14. (Link to the action:https://github.com/jerch/xterm-addon-image/actions/runs/5222277777/jobs/9427553798) |
@jerch passes fine on main, it's on Azure DevOps but also node 18 🤷 |
Hmm weird, it also worked locally with node 16 (have not tested node 18 here). |
Support being removed in #938
It's certainly still possible, the renderer needs to know which characters to join though.
The text was updated successfully, but these errors were encountered: