Bug 398656 - Text editor should support ligatures
Summary: Text editor should support ligatures
Status: CLOSED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.3   Edit
Hardware: PC All
: P3 enhancement with 90 votes (vote)
Target Milestone: 4.16   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: feep, plan
Depends on: 562165
Blocks: 508072
  Show dependency tree
 
Reported: 2013-01-21 12:00 EST by Daniel Neades CLA
Modified: 2020-07-02 10:58 EDT (History)
30 users (show)

See Also:


Attachments
Screenshot snippet showing missing fi ligature (32.79 KB, image/png)
2013-01-21 12:00 EST, Daniel Neades CLA
no flags Details
Screenshot showing ligatures on macOS/Neon.2 (74.41 KB, image/png)
2017-01-23 15:25 EST, Torkild Resheim CLA
no flags Details
Font ligatures on Windows (30.67 KB, image/png)
2020-02-12 16:07 EST, Thiago Berne CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Neades CLA 2013-01-21 12:00:49 EST
Created attachment 225895 [details]
Screenshot snippet showing missing fi ligature

I am using a proportionally spaced font (Skolar PE, though other fonts are also affected) for editing my Java and Scala code. The font is designed to use OpenType ligatures for certain character pairs (e.g. ‘fi’), but the Eclipse text editor doesn’t use these and renders such pairs using the glyphs for the individual letters. This looks ugly, and is a distraction when editing code. The editor should therefore use common OpenType ligatures when they are available in a font, or at least there should be an option to use them.

It looks like this problem was at least partially caused by an inappropriate fix for Bug 28831. There should at least be an option to use ligatures for fonts containing them, and the editor should work correctly when they are displayed.
Comment 1 Mark Jeronimus CLA 2015-10-13 10:14:22 EDT
In lieu with the title of this bug, I'm hijacking it.

There's a new font on the block (has been for a while): https://github.com/tonsky/FiraCode

All the Ligatures are rendered correctly, however, the ligatures are all treated as 1-wide instead of their actual width. This makes this font look ugly with 2-character ligatures and impossible to use with 3-character ligatures (<<<). When moving the caret, it will assume positions which are 1/2 or 1/3 and 2/3 into a character.
Comment 2 Thomas Baldauf CLA 2017-01-23 03:19:43 EST
Ligatures are necessary to support this great coding font:
https://github.com/tonsky/FiraCode
Comment 3 Torkild Resheim CLA 2017-01-23 15:24:29 EST
(In reply to Mark Jeronimus from comment #1)
>When moving the caret, it will assume positions which are 1/2 or 1/3 and 2/3 into a character.
Isn't that what one would expect?

(In reply to Thomas Baldauf from comment #2)
> Ligatures are necessary to support this great coding font:
> https://github.com/tonsky/FiraCode
I just tested FiraCode on Neon.2 (macOS) and it looks pretty good. Although there is a problem with some line heights being off.
Comment 4 Torkild Resheim CLA 2017-01-23 15:25:27 EST
Created attachment 266420 [details]
Screenshot showing ligatures on macOS/Neon.2
Comment 5 Torkild Resheim CLA 2018-06-20 18:05:47 EDT
FWIW: I've been using Iosevka as my preferred ligature font in Eclipse (on macOS) for quite a while, and it works just fine. I guess it depends on the font. I have not tried any others recently.
Comment 6 Joey Smith CLA 2018-06-22 02:46:38 EDT
(In reply to Torkild Resheim from comment #3)
> (In reply to Mark Jeronimus from comment #1)
> >When moving the caret, it will assume positions which are 1/2 or 1/3 and 2/3 into a character.
> Isn't that what one would expect?

It's certainly not what I expected - e.g. in https://imgur.com/a/RqWlgXL I would expect 5 characters "a", space, "->" ligature, space, "b". Stopping in the middle of the character is unexpected behaviour for me.
Comment 7 Peter Lupo CLA 2018-06-22 10:59:03 EDT
Having the caret stopping between the ligature character is exactly the expected behavior to me. It's also the same behavior in IntelliJ IDEA and Notepad++. It allows you deleting any single character from the ligature without touching the others. While it can be possible to achieve that using delete and backspace for 2-character ligatures, besides the hassle, you can't work around it for ligatures with more than 2 characters.
Comment 8 Torkild Resheim CLA 2018-06-22 19:33:17 EDT
(In reply to Peter Lupo from comment #7)
> Having the caret stopping between the ligature character is exactly the
> expected behavior to me. It's also the same behavior in IntelliJ IDEA and
> Notepad++. It allows you deleting any single character from the ligature
> without touching the others. While it can be possible to achieve that using
> delete and backspace for 2-character ligatures, besides the hassle, you
> can't work around it for ligatures with more than 2 characters.
Thanks for doing the explanation Peter!

I just tested jusing Fira Code and there is still something seriously wrong with the height of some lines in the code I’ve looked at, as a result the line numbers column is totally off. Otherwise it renders just fine.
Comment 9 sunx well CLA 2019-11-02 20:47:28 EDT
See https://bugs.eclipse.org/bugs/show_bug.cgi?id=536562#c92

the lasted SWT can solve this problem via scriptControl.fMergeNeutralItems = true.
Comment 10 Niraj Modi CLA 2019-11-21 04:06:51 EST
(In reply to sunx well from comment #9)
> See https://bugs.eclipse.org/bugs/show_bug.cgi?id=536562#c92
> 
> the lasted SWT can solve this problem via scriptControl.fMergeNeutralItems =
> true.

Please share a gerrit patch based on your proposal, Thanks!
Comment 11 sunx well CLA 2019-11-21 04:30:54 EST
Sorry, I don't know how to use gerrit.
Comment 12 Karsten Thoms CLA 2019-12-03 02:20:26 EST
(In reply to sunx well from comment #11)
> Sorry, I don't know how to use gerrit.

https://wiki.eclipse.org/Platform/How_to_Contribute

Don't hesitate to ask when you need assistance.
Comment 13 Thiago Berne CLA 2020-02-12 16:07:12 EST
Created attachment 281800 [details]
Font ligatures on Windows
Comment 14 Thiago Berne CLA 2020-02-12 16:08:20 EST
On Windows, some ligatures works but others don't (see my previous attachment).
Comment 15 Szczepan Holyszewski CLA 2020-04-14 16:15:03 EDT
On Linux it is not possible to select Fira Code font in Preferences > General/Appearance/Colors and Fonts > Basic/Text Font > [Edit...]. The Fira Code font is not available in the list. As I am writing this, I also have PHPStorm open with Fira Code displaying beautifully in the editor, so no, the font is NOT missing on my system.

(By the way, the font picker dialog that Eclipse uses looks Gnome-ish even though I am on KDE)
Comment 16 Niraj Modi CLA 2020-04-15 08:10:33 EDT
(In reply to Thiago Berne from comment #13)
> Created attachment 281800 [details]
> Font ligatures on Windows

(In reply to Thiago Berne from comment #14)
> On Windows, some ligatures works but others don't (see my previous
> attachment).

I confirm above behavior on Windows10 as tested with "FiraCode" font as taken from https://github.com/tonsky/FiraCode/tree/master/distr/ttf.
Currently investigating a fix for Ligatures support on Windows based on suggestion in: https://bugs.eclipse.org/bugs/show_bug.cgi?id=536562#c92
Comment 17 Niraj Modi CLA 2020-04-15 09:14:15 EDT
Raised bug 562165 to investigate the Ligatures support on Windows.
Comment 18 Nikita Prokopov CLA 2020-04-15 13:43:51 EDT
Please check if 3.1 fixes the issue with Fira Code not be detected as monospace https://github.com/tonsky/FiraCode/releases/tag/3.1
Comment 19 Lakshmi P Shanmugam CLA 2020-04-16 03:16:35 EDT
(In reply to Torkild Resheim from comment #8)
> (In reply to Peter Lupo from comment #7)
> > Having the caret stopping between the ligature character is exactly the
> > expected behavior to me. It's also the same behavior in IntelliJ IDEA and
> > Notepad++. It allows you deleting any single character from the ligature
> > without touching the others. While it can be possible to achieve that using
> > delete and backspace for 2-character ligatures, besides the hassle, you
> > can't work around it for ligatures with more than 2 characters.
> Thanks for doing the explanation Peter!
> 
> I just tested jusing Fira Code and there is still something seriously wrong
> with the height of some lines in the code I’ve looked at, as a result the
> line numbers column is totally off. Otherwise it renders just fine.

Is this still an issue on Mac?
I tested Eclipse 4.15 with Fira Code on macOS 10.15 and didn't see any problem with line numbers column.
Comment 20 Torkild Resheim CLA 2020-04-16 04:40:27 EDT
(In reply to Lakshmi Shanmugam from comment #19)
> (In reply to Torkild Resheim from comment #8)
> > (In reply to Peter Lupo from comment #7)
> > > Having the caret stopping between the ligature character is exactly the
> > > expected behavior to me. It's also the same behavior in IntelliJ IDEA and
> > > Notepad++. It allows you deleting any single character from the ligature
> > > without touching the others. While it can be possible to achieve that using
> > > delete and backspace for 2-character ligatures, besides the hassle, you
> > > can't work around it for ligatures with more than 2 characters.
> > Thanks for doing the explanation Peter!
> > 
> > I just tested jusing Fira Code and there is still something seriously wrong
> > with the height of some lines in the code I’ve looked at, as a result the
> > line numbers column is totally off. Otherwise it renders just fine.
> 
> Is this still an issue on Mac?
> I tested Eclipse 4.15 with Fira Code on macOS 10.15 and didn't see any
> problem with line numbers column.

Nope. Just tested with 4.15 too and and it looks good. I also tested with 4.9 and that also looks good. Which makes me wonder whether this particular bug was in Fira Code. I'm pretty sure I updated it not long ago, but since I normally use Iosevka I did not notice.
Comment 21 Jannis Schnitzer CLA 2020-04-19 08:15:20 EDT
As of 2020-03 (4.15.0) on macOS 10.15.4, Ligatures work with Fira Code, but not with Pragmata Pro. Is there any way to fix this?
Comment 22 Szczepan Holyszewski CLA 2020-04-21 08:25:28 EDT
(In reply to Nikita Prokopov from comment #18)
> Please check if 3.1 fixes the issue with Fira Code not be detected as
> monospace https://github.com/tonsky/FiraCode/releases/tag/3.1

It turns out I didn't actually have Fira Code installed systemwide. PHPStorm had it just for itself, via a theming plugin. I installed otf-fira-code from Arch linux repository and it works like charm.
Comment 23 Szczepan Holyszewski CLA 2020-04-21 08:27:54 EDT
(In reply to Jannis Schnitzer from comment #21)
> As of 2020-03 (4.15.0) on macOS 10.15.4, Ligatures work with Fira Code, but
> not with Pragmata Pro. Is there any way to fix this?

Just learned about Pragmata Pro and I can't resist: gosh is that a throwback to coding on Atari Falcon :D Not sure I would use it as a coding font now, but it sure as hell looks classy!
Comment 24 Niraj Modi CLA 2020-05-11 04:30:32 EDT
(In reply to Niraj Modi from comment #17)
> Raised bug 562165 to investigate the Ligatures support on Windows.

Added Ligatures support on Windows via bug 562165 fix.
Comment 25 Niraj Modi CLA 2020-05-12 05:32:17 EDT
(In reply to Niraj Modi from comment #24)
> (In reply to Niraj Modi from comment #17)
> > Raised bug 562165 to investigate the Ligatures support on Windows.
> 
> Added Ligatures support on Windows via bug 562165 fix.

Ligatures support is available on Windows with this week & on-wards Eclipse IBuilds:
https://download.eclipse.org/eclipse/downloads/drops4/I20200510-1800/
Comment 26 Niraj Modi CLA 2020-05-22 03:34:34 EDT
Resolving top level bug, as Ligatures support is now available on all 3 platforms. If there are any issues noticed, please open new bugs.
Comment 27 Pierre-Yves Bigourdan CLA 2020-05-22 10:26:35 EDT
(In reply to Niraj Modi from comment #26)
> Resolving top level bug, as Ligatures support is now available on all 3
> platforms. If there are any issues noticed, please open new bugs.

Given that a lot of this discussion was driven by Fira Code, I believe that one action is missing here: submitting a pull request removing the shameful mention of Eclipse as "doesn't work" on the font's Readme (https://github.com/tonsky/FiraCode). :)
Comment 28 Thiago Berne CLA 2020-05-22 10:30:08 EDT
(In reply to Pierre-Yves B. from comment #27)
> (In reply to Niraj Modi from comment #26)
> > Resolving top level bug, as Ligatures support is now available on all 3
> > platforms. If there are any issues noticed, please open new bugs.
> 
> Given that a lot of this discussion was driven by Fira Code, I believe that
> one action is missing here: submitting a pull request removing the shameful
> mention of Eclipse as "doesn't work" on the font's Readme
> (https://github.com/tonsky/FiraCode). :)

Agreed!!
But just after the 4.16 is released!
Comment 29 Niraj Modi CLA 2020-06-17 07:20:05 EDT
(In reply to Pierre-Yves B. from comment #27)
> Given that a lot of this discussion was driven by Fira Code, I believe that
> one action is missing here: submitting a pull request removing the shameful
> mention of Eclipse as "doesn't work" on the font's Readme
> (https://github.com/tonsky/FiraCode). :)

Appreciate if someone creates a pull request for removing the mention of Eclipse.
Thanks!
Comment 30 Pierre-Yves Bigourdan CLA 2020-07-02 10:58:54 EDT
(In reply to Niraj Modi from comment #29)
> (In reply to Pierre-Yves B. from comment #27)
> > Given that a lot of this discussion was driven by Fira Code, I believe that
> > one action is missing here: submitting a pull request removing the shameful
> > mention of Eclipse as "doesn't work" on the font's Readme
> > (https://github.com/tonsky/FiraCode). :)
> 
> Appreciate if someone creates a pull request for removing the mention of
> Eclipse.
> Thanks!

I was going to pick this up, but it was already done: https://github.com/tonsky/FiraCode/commit/6fc75b41f9a296721d14cfe6d47d300f1f03dc8c :)