-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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 #2287
Comments
Duplicate of #1651 I looked into this at one point and just using |
I added the following line to void Notepad_plus::loadBufferIntoView(BufferID id, int whichOne, bool dontClose): I realize that's probably not the right place, but I got the following result using the Fira Code font: |
That's interesting. I tried the exact same thing before without any success. Though I tried it on Win7 which might be a difference. |
This is what I tried:
Can't remember where I put that call in that function, but I'll try exactly where you said and see if that works for me. |
I can confirm your results. Only Fira Code and Fira Code Retina draw with ligatures. Light and Medium do not. |
Success! I found I had all the different fonts installed but none of them worked...however I installed them a while ago so I downloaded and installed the latest version of the regular Fira Code font and it worked perfectly. On a side note I don't think it matters when |
Fantastic! Thanks for staying with me on this. I really appreciate it! |
Is this something you discovered yourself or is it documented somewhere? |
Discovered with your help. I just put a != in the editor and flipped through the 4 variants. Your mentioning that you tried the medium got me to thinking. It may be worth noting that Windows Notepad only lists the regular and retina. However, the Windows font previewer seems to like them all. |
Hmmm... sorry but maybe I'm confused: should this work right now on Windows 10 with Notepad++ v7.1, 32bit, build from Oct 15 2016? Or do I have to wait for an update? |
It won't currently work "out of the box". The text rendering needs tweaked but you can do it with a plugin. Keep in mind support for ligatures is not officially supported so you might run into issues. This is the easiest way I know (without recompiling) to get ligatures to work in Notepad++:
Restart and enjoy. |
Thanks! Worked like a charm! |
@dail8859 After using the workaround, font Iosevka works, but Iosevka Light not. |
I don't know how OpenType rendering works on Windows, but from work on Mac and Linux I can say that this (standard weight of Fira Code and Iosevka works, nonstandard weights do not) is the expected (and arguably correct) behavior. In OpenType you specify weight not through font selection but through OpenType variations. Ligatures, too, are supported not through glyph selection (which would require Notepad++ to be aware that "->" becomes the → ligature, etc.) but through glyph variation. Once you use a non-base weight directly via font selection rather than through variation, you've signaled that you're not using OpenType features (correctly) anyway, so the font doesn't enable them. So, the solution if you want Fira Code Bold to be your default is to click the "Bold" checkbox in your Style Settings. (Ligatures are preserved in boldface and bold italic text; if you've done the There's no "Light" style checkbox, so there's no way to get that unfortunately, but the correct solution there is for Notepad++ to offer weight selection. The problem is that many (most) coding fonts do not have a Light variant, so the checkbox would do nothing in those cases. I don't know what, if anything, is lost by making use of the |
@treyharris The lower level text drawing is handled by Scintilla which is what Notepad++ uses internally. So any technical questions are probably best directed toward that project, especially regarding what
You are correct that Notepad++ does not offer anything to set a "light" version, however the underlying Scintilla control does allow setting a font weight. You can use a scripting plugin (such as LuaScript referenced above) and set the font style to a lighter weight using the call to |
@dail8859 Then should this issue be closed? If using LuaScript is sufficient, then you can get ligatures and you can get weights, so Notepad++ "has ligature support". But if using LuaScript isn't sufficient to consider the issue closed, then my point stands—UI is needed or, if Light is not to be provided and it causes no other issues, |
There isn't official support for ligatures as it stands so I would say this should still be left open.
I know in the past there have been issues regarding the quality of the text rendering on certain systems and I'm not sure if changing this would cause any types of problems like that. Scintilla allows different technologies so I would assume there is a good reason why one is better than another in certain cases, but again these technical questions are probably best for the Scintilla project as I don't know how all this works on a detailed level. |
@dail8859 — thanks. I appreciate the technical question, so I just did a little research into Scintilla. I checked the Scintilla bug tracker for references to According to the docs:
So: Scintilla doesn't make it the default because it needed to be unset on non-Windows and on pre-Vista versions of Windows, and it would break downstream clients of the API to make 1 the default now. That being the case, it sounds like By the way, on another note in what I wrote earlier: the difference between Fira Code and Fira Code Retina is that the latter simply has slightly increased weight across the entire spectrum. IOW, the Fira Code Retina 400 weight ("Normal", "Regular", or "Book") is closer to the Fira Code 500 weight ("Medium"), the Fire Code 400 weight is closer to Fira Code Retina's 300 ("Light"), and so on. (This is to address the reason many people set a Bold font as their default in the first place: fixed-width text on Retina displays tend to look thinner, particularly for monospaced text mixed with proportional text, like |
Thanks for the additional info. |
This should NOT have been closed. Notepad++ should support ligatures out of the box, not thru hacks or adding plugins users neither need nor want. |
This wasn't closed. It's still marked as open at the top. It's the referencing articles that have been closed. |
Just an FYI, a recent Windows 10 update (KB-4340917) was supposed to fix OpenType support for Win32 applications, but I tried removing the startup options and it still doesn't work. |
I have a problem in getting Operator Mono Light / light italic ligatures to work. |
@KOLANICH Could you please provide a compiled version of you plugin? I'd need it for the x86 architecture. |
It doesn't work, please help me. |
@xmha97 Since you provided absolutely no additional details, there is little-to-no chance someone can help you figure out why it "doesn't work" |
I can, but I don't think for such a small and trivial plugin it is beneficial. Please, download the source and build it yourself (use MinGW-w64, please, Visual Studio is not trusted after all the "adcidents") if it is feasible for you - you will get better trusted dll (it is a dll, it can contain code, so it can contain malware, so a malicious or hacked CDN or CI can insert malware into the dll you download!) this way. But if you still really want me to build it for you, just say, though don't expect the immediate response or any security or other guarantees. I'm sorry for this late response, I was offline. |
@KOLANICH Actually I tried that in a way, before posting. For a small plugin
For people who know, what they're doing and already have a working environment, it's for sure better to compile it from the source. That said, I'm now using LuaScript plugin, which allows to set the settings in a script at startup as described above. It's working fine, but probably your plugin would need less resources. For other users, I'd guess, it would probably be a benefit if were providing a compiled version. |
There is a PR #8326 which addresses this. |
Visual Studio bears more risks. It is malware itself - it contains telemetry and even downloading it without collecting wnd sending telemetry is hard. MinGW-w64 is lot smaller - about 100 MiBs. They have an obsolete 8.1 on SourceForge (the only https-capable official source of mingw-w64), but
In order to build you need git, CMake, mingw-64 and ninja-build. Download portable versions and unpack. Clone the repo with submodules. Open CMake GUI. create a Look, Notepad++ is an editor for programmers. And programmers must know how to use a C++ compiler. Even if you write in python or javascript only, you sometimes will have to compile native modules, and to do this you must understand how to use the compiler and the build system. There are 4 main build systems: dumb make, autotools, CMake (the most popular one) and Meson. You must know how to build software (as a user, not as a build script writer) using them. |
@KOLANICH Thank you for the explanation and the instructions on how to build the dll. @Ekopalypse Thank you for the hint on the issue. |
BTW, this is how (DAMN SLOW (it used to be damn slow even without ligatures), but works, wine team has implemented ligatures) it works in Wine May be somehow related to
|
... by using Scintilla's DirectWrite technology. It allows ligature support if the font needed (for exemple "Fira Code") is installed. Fix notepad-plus-plus#2287, close notepad-plus-plus#8326 Fix notepad-plus-plus#442, fix notepad-plus-plus#675, fix notepad-plus-plus#813, fix notepad-plus-plus#870, fix notepad-plus-plus#1621, fix notepad-plus-plus#3458, fix notepad-plus-plus#4056, fix notepad-plus-plus#4086, fix notepad-plus-plus#4490, fix notepad-plus-plus#8305
Starting from version 7 7.8.8, Officially supports DirectWrite. |
Note: restart is required to take effect. |
Is that unclear in any way? |
Has anyone else experienced an issue enabling DirectWrite and using the font Operator Mono? The font doesn't appear correctly with this option enabled.
|
Both screenshots are using "Operator Mono Light". The only difference is DirectWrite has been enabled/disabled. |
I have this exact same problem. When DirectWrite is enabled scintilla just straight up revert to Arial, plus a whole slew of graphical and behaviour glitches. |
It's the same for me with open source Intel One Mono. Works for no-style, different font is used for Medium and Light - yet same for both. In non-DW, it works fine. Font in question is OTF, from https://github.com/intel/intel-one-mono/releases/tag/V1.4.0 Is there some way to get internal SCI message log? Maybe this setting should be market as "experimental"? PS: In none of these cases stylistic sets works, but I think it's just different from ligatures (at least according to fontdrop), and seems to be purely OTF feature, so I'm ignoring this problem. |
Description of the Issue
Fonts that support ligatures are not drawn with them
Steps to Reproduce the Issue
Expected Behavior
a long equals sign with a slash through it
Actual Behavior
discrete characters
Suggestion
Set the Technology property of the Scintilla objects to DirectWrite, which draws with ligatures, or provide an option to turn it on.
The text was updated successfully, but these errors were encountered: