-
Notifications
You must be signed in to change notification settings - Fork 184
-
Notifications
You must be signed in to change notification settings - Fork 184
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
Ligature support #601
Comments
This may be beyond the Windows API currently used for text output (ExtTextOut), see #430 and #438 (comment). |
Fira Code has some crazy ligatures for programming while remaining a The issue is that the raw characters are displayed and not the ligatures. |
So you are not asking about any Unicode ligatures but rather font-specific ligatures. |
This functionality may be available with the Uniscribe API. |
So here's your homework :):
|
@be5invis: taking over this issue here...
FreeType is an external library, and DirectWrite as well as Uniscribe are of deterring complexity. I've experimented with Uniscribe, though, and it does not seem to support ligatures (so I guess notepad uses DirectWrite...). But: The information must be available somewhere in the font file. And using a mapping table like |
@mintty Uniscribe does not support enabling arbitrary OpenType feature tag unless it is one of the “required” tags for typesetting complex scripts (like Devanagari). |
@be5invis Thanks for the confirmation. |
@mintty It’s a feature located in |
Hmm, using a
Probably not worth the effort... |
@mintty To avoid some compatibility issues under Linux, Iosevka Term turned off ligatures by default. |
"By default" means the information is not contained in the font? Whatever, I think I'll just close this issue unless someone enthusiastic about the feature will
|
@mintty Iosevka Term does not have any ligature data, while Iosevka does. In most cases, the |
or make an implementation proposal to use DirectWrite, see #430 |
DirectWrite has GDI compatible mode. If you use it, you don't need to switch all graphics code to Direct2D. |
In referring issue #605, I tried to evaluate Uniscribe for this purpose. |
Maybe @koron can help figuring this out for mintty, too. Would also be a major break-though for vim users (like me) that rather use the command line on windows (ie. cygwin). Sorry for bumping this issue: still one year later there seems to be no actual terminal (that can e.g. run tmux) on windows with ligature support. |
Mintty already uses Uniscribe. I don't think there is additional benefit by using DirectWrite with GDI-compatible mode. |
I think @riedel was referring to ligature support, not DirectWrite. |
Oh, I misunderstood that Uniscribe provides (some kind of) ligature support. |
@k-takata: you are right: tt seems that uniscribe supports ligatures, but not the type of OpenType ligatures eg. used by Fira Code. This uniscribe tutorial shows that https://maxradi.us/documents/uniscribe/ talks about font-specific ligature and how to use the more complex workflow using Edit 2: This slightly more complex API seems to do the trick and works with Fira Code: https://www.catch22.net/tuts/drawing-styled-text-uniscribe Edit 1: Windows offers some OpenType specific uniscribe functions: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317792(v=vs.85).aspx |
What's the actual output rendered here? Can you provide a screen log please (e.g. mintty -l)? |
I ran This is the output: I was on the train writing a document at the time and wasn't looking any further. Now I looked into it because it worked for none of the other lines, which seemed strange: it seems that the long dash (hex sequence 0xe28094) in the line triggers rendering the ligatures (others ligatures from fira code work as well). Should be easy to replicate... |
This is a miracle of Uniscribe, I don't think mintty has control over it. However, some observations:
|
They are not really special, but somewhat ambiguous if ligatures are available e.g. for |
Actually, the previous comment applies e.g. to |
I understand there are good reasons not to do ligatures for things like '=>' because of all the use cases you want to support, but I would like to have them in a private fork for my personal use. I am building mintty myself and have poked around in the code trying to figure out how to enable the extra ligatures I'd like, but I'm not having much luck. It seems like it should be in src/term.c somewhere, but the changes I have tried so far (including turning on verbose debug output) haven't worked. Can you point me in the right direction? Thanks! |
As a special hack for |
Thanks, but removing that line didn't seem to change things. I pulled the latest code, did 'make clean && make', I assume that's all that is needed. I'm sure the font family supports ligatures for '->' ... if I open the test file I am using in Notepad the arrow is displayed. |
I verified that "<-" is in fact handed over to Uniscribe for output in one bunch, even without that patch, actually. |
hey, @mintty 👋 Mintty is awsome! I've been trying your terminal out and it mostly checks all my list for a terminal. The last is Ligature Support which it seems that mintty actually supports. I try to edit the shortcut Am I doing it correctly? I'm using Cascadia Code which supports ligature, but it seems that it doesn't work. |
The release page says:
|
Hi @mintty, thanks for getting back with me. Happy Holidays! 🤗 I'm not using As you see in the release, there are six assets,
|
Install Cascadia Code, set it default in mintty, run this:
Works in my case. |
Yes, it works. If you experience any special cases that don't, describe them. |
If I use what @Biswa96 suggested I get an error: I tried playing with the settings thru the shortcut: It somewhat works with that configuration but it's missing converting some ligatures. For eg.: edit: I just realized I'm using |
I tried using Fira Code, which doesn't work either. I've also tried: LigaturesSupport=2 (which I found in this PR f35aa2a) |
OK, your report was it doesn't work. As you see in your line (foo == true), it does work. |
oh okay @mintty sorry about that, so basically |
Sorry for the slow response, life got in the way. I finally got it to work! I played around with the Uniscribe parameters as you suggested, and the extra ligatures I wanted appeared when I passed in some different flags for the
Is this something you would want to incorporate, or should I maintain my own fork? |
Add another bit setting to enable this in LigaturesSupport? |
Thanks for adding it as an option, I didn't want to have to keep up with all your releases. Regarding the ambiguity, I imagine the common case of, say, '<=' is less-than-or-equal-to, not double-arrow-pointing-left. The only way I see around it is if you think it is worthwhile to write code to scan blocks, potentially break them up, and feed them to Uniscribe with different options. I suggest starting out with everything on or off, and see if many people ask for fine-grained control. FWIW, all the other programs I have tried go the less-than-or-equal-to glyph route. For the option, you could hedge your bet about people wanting more control and have another option that is a bitmask. One bit for 'all ligatures on', and in the future other bits could be 'double-arrow-pointing-left on'. |
I wouldn't know how to persuade Uniscribe to render <= as left-arrow. The current option is about interactive line rendering support (i.e. rendering while typing), which isn't yet perfect actually. |
Released 3.1.4. |
Nice, is wsltty going to be updated? (Also you forgot to actually release 3.1.0.3.) |
There is a bug with crash potential in the wslbridge gateway. Waiting for its fix. |
It would be really nice to be able to use ligatures in fonts like Iosevka and Fira Code with mintty.
Currently, it seems that ligatures are not displayed.
The text was updated successfully, but these errors were encountered: