GeezerVison is showing github.com — Ligature support · Issue #2287 · notepad-plus-plus/notepad-plus-plus
DescriptionDescription of the Issue
Fonts that support ligatures are not drawn with them
Steps to Reproduce the Issue
- Select a font that supports ligatures, such as Fira Code
- Select a C-based language
- key in "!="
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.


Reacted by Josef, Jordan Atwood, Saran Tanpituckpong ✔️, Brian James, Thomas Freudenberg, menugarit, Nir Lanka/Shane, Yaya - Nurul Azeera Hidayah Yatsuko Muhammad Nur Hidayat Yasuyoshi (MNH48), RainAir, Artem Chivchalov and 23 more Activitydail8859 commented on Sep 15, 2016 Duplicate of #1651
I looked into this at one point and just using SC_TECHNOLOGY_DIRECTWRITE is not enough. Notepad++ uses Scintilla v3.5.6 and it seems that a newer version of Scintilla is required to support ligatures. So once Scintilla is updated internally this will most likely be possible. Reacted by MetaChuh and Jorge Morales Graucsh commented on Oct 24, 2016 I added the following line to void Notepad_plus::loadBufferIntoView(BufferID id, int whichOne, bool dontClose):
::SendMessage(viewToOpen->getHSelf(), SCI_SETTECHNOLOGY, SC_TECHNOLOGY_DIRECTWRITE, 0);
I realize that's probably not the right place, but I got the following result using the Fira Code font:

dail8859 commented on Oct 24, 2016 That's interesting. I tried the exact same thing before without any success. Though I tried it on Win7 which might be a difference. Graucsh commented on Oct 25, 2016 Maybe it makes a difference where the message is sent?

I put the code after:
MainFileManager->addBufferReference(id, viewToOpen); dail8859 commented on Oct 25, 2016 This is what I tried:
- Install the Fira Code font (I think I used the medium)
- Set the global Notepad++ font to use Fira Code
- Type something like
!= and nothing happens. (I can see the font is getting changed, it just doesn't seem to pick up on the character sequences at all.)
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. Graucsh commented on Oct 25, 2016 I can confirm your results. Only Fira Code and Fira Code Retina draw with ligatures. Light and Medium do not. Reacted by Stephan Strittmatter, Yaya - Nurul Azeera Hidayah Yatsuko Muhammad Nur Hidayat Yasuyoshi (MNH48), Thomas A. Christensen II and Jorge Morales dail8859 commented on Oct 25, 2016 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 SCI_SETTECHNOLOGY is set because I manually changed it by my scripting plugin while a file was already opened and it immediately worked. :) Graucsh commented on Oct 25, 2016 Fantastic! Thanks for staying with me on this. I really appreciate it! dail8859 commented on Oct 25, 2016
Only Fira Code and Fira Code Retina draw with ligatures. Light and Medium do not.
Is this something you discovered yourself or is it documented somewhere? Graucsh commented on Oct 25, 2016 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. mmokross commented on Oct 27, 2016 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? dail8859 commented on Oct 27, 2016 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++:
- Install a recent version of Fira Code (use either the normal font or the retina as those are the only ones that seem to work).
- Install LuaScript via the Plugin Manager (you can also use PythonScript if you are more comfortable with it or want to use a 10 ton hammer).
- Select the font via
Settings > Style Configurator > Global Styles > Global Override. Select "Fira Code" for the font style and turn on Enable global font
- Edit the LuaScript startup file by doing
Plugins > LuaScript > Edit Startup Script and add the following code:
editor1.Technology = SC_TECHNOLOGY_DIRECTWRITE
editor2.Technology = SC_TECHNOLOGY_DIRECTWRITE
Restart and enjoy. Reacted by Michael Mokroß, Josef, Mingjie Li, Jordan Atwood, lucky, Brian James, inlinex, Nik, Andres Moschini, Paul Kertscher and 128 more Reacted by Muhammadhussein Ammari, Luvexina and Inflation Reacted by totalamd, vaanwd, Artem, FZs, Karlo Bistrički, Demian, Ben Neilsen, Kyle, H-e-l-l-oW-o-r-l-d, Cristian Flores and 1 more Reacted by Jordan Atwood, Henry, Stephen Griffiths, Marian Stoica, Yaya - Nurul Azeera Hidayah Yatsuko Muhammad Nur Hidayat Yasuyoshi (MNH48), LauriKoivisto, Zachary Wassall, Subodh Pareek, snowman, Yori and 15 more Reacted by Ali Can YILDIZ, Cristi Badila, inlinex, Jordan Atwood, wolfi3, Gabriel Weidmann, John van Terheijden, Yaya - Nurul Azeera Hidayah Yatsuko Muhammad Nur Hidayat Yasuyoshi (MNH48), Zachary Wassall, snowman and 32 more Reacted by Manoj Baishya, A. Aafaque, Artem, FZs, Karlo Bistrički, Thijs, Luciano Paciornick, c3r38r170, Nelson Martell, sksallaj82 and 3 more Reacted by FZs, DraKul78, John Christian Domingo and Cristian Flores mmokross commented on Oct 27, 2016 Thanks! Worked like a charm! limingjie commented on Dec 7, 2016 @dail8859 After using the workaround, font Iosevka works, but Iosevka Light not. treyharris commented on Nov 13, 2017 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 SC_TECHNOLOGY_DIRECTWRITE workaround above, you can check this for yourself, by checking Bold in your styles with plain Fira Code or Iosevka and not Light/Bold as your base font. Fira Code Retina is also a base font containing ligatures, bold weight and oblique (italic) variants, so it also works.)
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 SC_TECHNOLOGY_DIRECTWRITE. But if the answer is nothing, it should probably be enabled by default. Reacted by thomas-ashcraft and Anders dodmi commented on Jun 11, 2020 @KOLANICH Thank you for the explanation and the instructions on how to build the dll.
@Ekopalypse Thank you for the hint on the issue. KOLANICH commented on Jul 2, 2020 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
dwrite_npp.mp4.zip
May be somehow related to
00c0:fixme:d2d:d2d_device_context_Flush iface 000000000<something>, tag1 0000000000000000, tag2 0000000000000000 stub!
added a commit that references this issue on Oct 11, 2020This issue will close once commit bb88d08 is merged into the 'master' branch.bb88d08 rmmaniac commented on Dec 7, 2020 Starting from version 7 7.8.8, Officially supports DirectWrite.
from menu->Settings->Preferences->MISC->Use DireteWrite,
Use DireteWrite checkcked and I tested JetBrainsMono-Regular.ttf and FiraCode-Retina.ttf both work fine (no LuaScpipt plugins installed).... Reacted by UENO, M. and despawnedd Reacted by UENO, M. and despawnedd Reacted by AntoineLu, Joshua "Yoshi" Askharoun, krypt-lynx, Sarah Plotkin, UENO, M., Matthew Brown, despawnedd, foreachthing, Adam McKellar and smsourov thomas-ashcraft commented on Apr 24, 2021
from menu->Settings->Preferences->MISC->Use DireteWrite,
Note: restart is required to take effect. sasumner commented on Apr 24, 2021 @thomas-ashcraft
from menu->Settings->Preferences->MISC->Use DireteWrite,
Note: restart is required to take effect.
Is that unclear in any way?

Reacted by Muhammadhussein Ammari, Pankaj Nikam, Jaineel Mamtora, foreachthing and Jeff Ussing u01jmg3 commented on Jun 7, 2021 Has anyone else experienced an issue enabling DirectWrite and using the font Operator Mono? The font doesn't appear correctly with this option enabled.
- Top disabled, bottom enabled.

u01jmg3 commented on Jun 7, 2021 Both screenshots are using "Operator Mono Light". The only difference is DirectWrite has been enabled/disabled. mfaizsyahmi commented on Mar 9, 2022
Has anyone else experienced an issue enabling DirectWrite and using the font Operator Mono? The font doesn't appear correctly with this option enabled.
* Top disabled, bottom enabled.
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.
Considering ligatures are just a "nice to have" and I got Fira Code to work on VSCodium, I'm just gonna cut my losses. added a commit that references this issue on May 17, 2024This issue will close once commit 0a821b6 is merged into the 'main' branch.0a821b6 Krzysiu commented on Feb 27, 2025
Has anyone else experienced an issue enabling DirectWrite and using the font Operator Mono? The font doesn't appear correctly with this option enabled.
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.

MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|