GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Ligature support · Issue #2287 · notepad-plus-plus/notepad-plus-plus

Ligature support #2287

New issue
Copy link
New issue
Copy link
Closed
Closed
Ligature support#2287
Copy link
Assignees
donho
Labels
acceptedfeatureFeature requests and Feature commits

Description

@Graucsh
Graucsh
opened on Sep 15, 2016
Issue body actions

Description of the Issue

Fonts that support ligatures are not drawn with them

Steps to Reproduce the Issue

  1. Select a font that supports ligatures, such as Fira Code
  2. Select a C-based language
  3. 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.

default
directwrite

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

Activity

Next
  1. dail8859 commented on Sep 15, 2016

    @dail8859
    dail8859
    on Sep 15, 2016
    Contributor
    More actions

    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
  2. Graucsh commented on Oct 24, 2016

    @Graucsh
    Graucsh
    on Oct 24, 2016
    Author
    More actions

    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:

    npp_ligatures

  3. dail8859 commented on Oct 24, 2016

    @dail8859
    dail8859
    on Oct 24, 2016
    Contributor
    More actions

    That's interesting. I tried the exact same thing before without any success. Though I tried it on Win7 which might be a difference.

  4. Graucsh commented on Oct 25, 2016

    @Graucsh
    Graucsh
    on Oct 25, 2016
    Author
    More actions

    Maybe it makes a difference where the message is sent?
    npp_ligatures_win7

    I put the code after:
    MainFileManager->addBufferReference(id, viewToOpen);

  5. dail8859 commented on Oct 25, 2016

    @dail8859
    dail8859
    on Oct 25, 2016
    Contributor
    More actions

    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.

  6. Graucsh commented on Oct 25, 2016

    @Graucsh
    Graucsh
    on Oct 25, 2016
    Author
    More actions

    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
  7. dail8859 commented on Oct 25, 2016

    @dail8859
    dail8859
    on Oct 25, 2016
    Contributor
    More actions

    Success!

    capture

    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. :)

  8. Graucsh commented on Oct 25, 2016

    @Graucsh
    Graucsh
    on Oct 25, 2016
    Author
    More actions

    Fantastic! Thanks for staying with me on this. I really appreciate it!

  9. dail8859 commented on Oct 25, 2016

    @dail8859
    dail8859
    on Oct 25, 2016
    Contributor
    More actions

    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?

  10. Graucsh commented on Oct 25, 2016

    @Graucsh
    Graucsh
    on Oct 25, 2016
    Author
    More actions

    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.

  11. mmokross commented on Oct 27, 2016

    @mmokross
    mmokross
    on Oct 27, 2016
    More actions

    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?

  12. dail8859 commented on Oct 27, 2016

    @dail8859
    dail8859
    on Oct 27, 2016
    Contributor
    More actions

    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++:

    1. 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).
    2. 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).
    3. Select the font via Settings > Style Configurator > Global Styles > Global Override. Select "Fira Code" for the font style and turn on Enable global font
    4. 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
  13. mmokross commented on Oct 27, 2016

    @mmokross
    mmokross
    on Oct 27, 2016
    More actions

    Thanks! Worked like a charm!

  14. limingjie commented on Dec 7, 2016

    @limingjie
    limingjie
    on Dec 7, 2016
    More actions

    @dail8859 After using the workaround, font Iosevka works, but Iosevka Light not.

  15. treyharris commented on Nov 13, 2017

    @treyharris
    treyharris
    on Nov 13, 2017
    More actions

    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
  16. 19 remaining items

  17. dodmi commented on Jun 11, 2020

    @dodmi
    dodmi
    on Jun 11, 2020
    More actions

    @KOLANICH Thank you for the explanation and the instructions on how to build the dll.

    @Ekopalypse Thank you for the hint on the issue.

  18. donho
    added
    accepted
    on Jun 12, 2020
  19. donho
    self-assigned this
    on Jun 12, 2020
  20. donho
    closed this as completedin 0a821b6on Jun 12, 2020
  21. KOLANICH commented on Jul 2, 2020

    @KOLANICH
    KOLANICH
    on Jul 2, 2020
    Contributor
    More actions

    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!
    
  22. chcg
    added
    featureFeature requests and Feature commits
    on Aug 1, 2020
  23. alef162
    added a commit that references this issue on Oct 11, 2020

    Add an option to improve rendering special Unicode characters

    This issue will close once commit bb88d08 is merged into the 'master' branch.
    bb88d08
  24. rmmaniac commented on Dec 7, 2020

    @rmmaniac
    rmmaniac
    on Dec 7, 2020
    More actions

    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
  25. thomas-ashcraft commented on Apr 24, 2021

    @thomas-ashcraft
    thomas-ashcraft
    on Apr 24, 2021
    More actions

    from menu->Settings->Preferences->MISC->Use DireteWrite,

    Note: restart is required to take effect.

  26. sasumner commented on Apr 24, 2021

    @sasumner
    sasumner
    on Apr 24, 2021
    Contributor
    More actions

    @thomas-ashcraft

    from menu->Settings->Preferences->MISC->Use DireteWrite,

    Note: restart is required to take effect.

    Is that unclear in any way?

    image

    Reacted by Muhammadhussein Ammari, Pankaj Nikam, Jaineel Mamtora, foreachthing and Jeff Ussing
  27. u01jmg3 commented on Jun 7, 2021

    @u01jmg3
    u01jmg3
    on Jun 7, 2021
    More actions

    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.

    operator

  28. u01jmg3 commented on Jun 7, 2021

    @u01jmg3
    u01jmg3
    on Jun 7, 2021
    More actions

    Both screenshots are using "Operator Mono Light". The only difference is DirectWrite has been enabled/disabled.

  29. mfaizsyahmi commented on Mar 9, 2022

    @mfaizsyahmi
    mfaizsyahmi
    on Mar 9, 2022
    More actions

    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.
    
    operator

    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.

  30. angelobrito
    added a commit that references this issue on May 17, 2024

    Add an option to improve rendering special Unicode characters

    This issue will close once commit 0a821b6 is merged into the 'main' branch.
    0a821b6
  31. Krzysiu commented on Feb 27, 2025

    @Krzysiu
    Krzysiu
    on Feb 27, 2025
    Contributor
    More actions

    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"?

    Image

    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.

    Image

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

Metadata

Metadata

Assignees

  • @donho
    donho

Labels

acceptedfeatureFeature requests and Feature commits

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402792 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.