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

SGR 11-19 for highlighting with fonts #13513

Closed
PMunch opened this issue Nov 10, 2023 · 5 comments
Closed

SGR 11-19 for highlighting with fonts #13513

PMunch opened this issue Nov 10, 2023 · 5 comments

Comments

@PMunch
Copy link
Contributor

PMunch commented Nov 10, 2023

Is your feature request about something that is currently impossible or hard to do? Please describe the problem.
Currently highlighting is only possible to do with colour and bold/italic. I would like support to be added for the ANSI escape codes with SGR parameters 11-19 to change the font in a highlight.

Describe the solution you'd like
Along with cterm, ctermfg, ctermbg, and ctermul I would like to have ctermfont or similar to set the alternate font with SGR parameters 11-19. This would allow highlighting text in Vim with fonts such as Monaspace.

Describe alternatives you've considered
I've played around with using bold and italic and set the fonts in my terminal emulator to use different fonts instead of applying these effects and the results are nice. However this means I no longer have access to bold and italic to style text. Optimally I would want to have access to both alternate fonts and bold/italic.

@chrisbra
Copy link
Member

that sounds like too much of a niche use-case as this is (of course) only restricted to a terminal. Is there a terminal, that actually supports this?
I checked briefly the xterm ctlseq doc page and it doesn't seem to contain the SGR parameters 11-19.

@PMunch
Copy link
Contributor Author

PMunch commented Nov 11, 2023

I know at least pangoterm supports it, but I'm sure there are others. In general though it seems like it's a bit of a catch 22 situation. I talked to the maintainer of the wonderful Kitty terminal and they told me that they didn't want to add support for it until some tools actually used the feature. And now I'm talking to tool maintainers and get told that there's no reason to implement it if no terminals support it. However font designers seems to be picking up on this untapped area of design freedom, and users like myself are interested in trying the features out.

As mentioned though pangoterm supports it, and the Kitty maintainer said they would implement support if they got commitment from some large terminal tool that support would be added. So if Vim implements this fairly simple feature we can start the ball rolling.

The usecase is definitely a bit niche for now, but with this recently added interest I think it's a good time to put ourselves in a position where this niche could be explored.

@chrisbra
Copy link
Member

yes, agree. I'll leave it open, but don't count on this feature being implemented in the near future. I don't know much of the terminal code handling.

@PMunch
Copy link
Contributor Author

PMunch commented Nov 11, 2023

I believe it should be fairly easy to implement. It's essentially the exact same system that the colours and other styles uses, it would probably even be possible to just add them as attributes to the existing cterm list of attributes. But I believe it would be a cleaner solution to have them as a separate option that could only accept a single font instead of the list which cterm offers.

@PMunch
Copy link
Contributor Author

PMunch commented Nov 16, 2023

Just in case anyone finds this issue, and to make it easier to close if the PR gets merged, I created a PR for this feature here: #13537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants