Closed
Description
Description 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.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
dail8859 commentedon 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.Graucsh commentedon 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 commentedon 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 commentedon Oct 25, 2016
Maybe it makes a difference where the message is sent?

I put the code after:
MainFileManager->addBufferReference(id, viewToOpen);
dail8859 commentedon Oct 25, 2016
This is what I tried:
!=
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 commentedon Oct 25, 2016
I can confirm your results. Only Fira Code and Fira Code Retina draw with ligatures. Light and Medium do not.
dail8859 commentedon 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 commentedon Oct 25, 2016
Fantastic! Thanks for staying with me on this. I really appreciate it!
dail8859 commentedon Oct 25, 2016
Is this something you discovered yourself or is it documented somewhere?
Graucsh commentedon 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 commentedon 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 commentedon 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++:
Settings > Style Configurator > Global Styles > Global Override
. Select "Fira Code" for the font style and turn onEnable global font
Plugins > LuaScript > Edit Startup Script
and add the following code:Restart and enjoy.
mmokross commentedon Oct 27, 2016
Thanks! Worked like a charm!
limingjie commentedon Dec 7, 2016
@dail8859 After using the workaround, font Iosevka works, but Iosevka Light not.
48 remaining items