Firacode: Partial IntelliJ IDEA support

Created on 22 Dec 2015  Â·  52Comments  Â·  Source: tonsky/FiraCode

From version of 15 EAP there is a partial support for ligatures with editor.enable.optional.ligatures=true in bin/idea.properties file.

In OS X, the bin folder is located inside of the application itself, for example: /Applications/IntelliJ IDEA 16 EAP/ Context menu -> Show package content /Contents/bin/idea.properties.

Here is a proof:

2015-12-22 16 03 57

As you can see, ligatures appears if there is a letter (not number) beside.

I created a test case for this:

            .=a .-a :=a =:=a
         ==a !=a ===a !==a =/=a

     <<-a <--a <-a b<->a b-> b--> b->>
<=<a <<=a <==a     b<=>a b=> b==> b=>> b>=>
     >>=a >>-a >-a       b-< b-<< b=<<
          <~~a <~a b~~~a b~> b~~>

     <<<a <<a <=a  b<>a  b>= b>> b>>>
               <|a b<|>a b|>

               <$a b<$>a b$>
               <+a b<+>a b+>
               <*a b<*>a b*>

         \\a \\\a b{- -}a b// b///
             /*a /**a b**/ b*/
          </a <!--a www  b--> b/>
            0xF 9:45a m-x *ptr

       ;;a ;;;a ::a :::a !!a !!!a
       ??a ???a %%a %%%a &&a &&&a
       ||a |||a ..a ...a b..< a[]b
       --a ---a ++a +++a **a ***a

          ~=a ~-a -~a =~a ~@a
        ^=a ?=a /=a /==a |=a ||=a
           ##a ###a ####a
         a#{b a#[b a#(b a#?b a#_b a#_(b

a*b a*A B*b A*B *a *A a* A*
a-b a-A B-b A-B -a -A a- A-
a+b a+A B+b A+B +a +A a+ A+
a:b a:A B:b A:B :a :A a: A:

And this is how it looks in IntelliJ IDEA 16 EAP v144.2151.16:

2015-12-22 16 03 38

As you can see, every ligature that based on 2 glyphs is working, except of any brackets <>[]{}()

But without letter beside there is nothing as I described above:

2015-12-22 16 03 33

So, basically, we can add this info in repository readme.

Most helpful comment

I also have removed FiraCode light.

No matter _which font_ I use, I get an ugly "light" version of it if I click on enable ligatures. I don't think it's a problem with FiraCode.

PHPStorm 2016.1 on OS X 10.11.4

PHPStorm settings

All 52 comments

Didn't work for me on 16 EAP :(

@dmitriid, for some reason, it doesn't work for all file types. If you create a new scratch buffer, the ligatures will work.

@shockone Nope :) Didn't work for the new scratch buffer either :) I guess we can call the support is "spotty". But yay for you! You got it working

@dmitriid did you forget to add editor.enable.optional.ligatures=true in idea.properties?

Nope, done that. Then launched IDEA, all fonts look as they did before. In any type of file, in any type of scratch file

Heh. Worked for me on Idea 15 with modified idea.properties. For some
reason Idea decided to use Light weight by default, and it only worked with
a letter right after the ligature. Silly

On Tue, Dec 22, 2015 at 3:31 PM dmitriid [email protected] wrote:

Nope, done that. Then launched IDEA, all fonts look as they did before. In
any type of file, in any type of scratch file

—
Reply to this email directly or view it on GitHub
https://github.com/tonsky/FiraCode/issues/96#issuecomment-166565959.

This isn't actually a fully working test case just yet: there are some problems which only show up when syntax highlighting is used.

Hello,

I'm a JetBrains employee, working now on supporting ligatures in IDEA. There's a reason why Fira Code in its current state cannot be supported in IntelliJ IDEA at the moment, some details about this can be found e.g. here. But there's a 'refactoring' for the font, which can make it work.

I could provide a patch, if font's source code would be available in open format, but I don't have Glyphs app, so I can only explain the idea here. Basically, DFLT script tag shouldn't be used in OpenType features mapping, tags for all scripts supported by font should be used instead. For Fira Code this means, 'DFLT dflt' script/language pair should be replaced with 'zyyy dflt' 'zinh dflt' 'cyrl dflt' 'grek dflt' ('latn' script is already declared).

I've tested font modified in such a way, and didn't see any regressions in any editors on any platform so far.

Hi @JB-Dmitry!

I’ll see what I can do about it.

Does removing DFLT solves the issue when ligatures only render if a letter is placed before/after it?

Yes, I think it should solve it.

@JB-Dmitry here’s a test build https://dl.dropboxusercontent.com/u/561580/Fonts/FiraCode/FiraCode_1.102.zip

I kept languagesystem DFLT dflt; but added what you’ve suggested. Works for me (with addition of editor.enable.optional.ligatures=true) (I use OS X and IDEA 15 community edition).

Folks in this thread, can you please test it in Windows/Linux and report back?

@JB-Dmitry any ideas why Idea chooses Light weight by default and how to change that?

That works for me on Linux! You're all awesome for looking into this so much!

I kept languagesystem DFLT dflt; but added what you’ve suggested.

That should also work, thanks.

any ideas why Idea chooses Light weight by default and how to change that?

I couldn't reproduce that. What JDK are you using to run IDEA (can be found in 'About' screen)?

Works on OS X! Great!

@JB-Dmitry it must be related to editor.enable.optional.ligatures=true somehow. If I enable it, it starts using Ligth weight for Fira Code, Bold weight for Input Mono, etc. Once I disable it, it chooses correct regular weight for both. Checked on 15 and 16 EAP Ideas (OS X)

screen shot 2015-12-26 at 00 55 53
screen shot 2015-12-26 at 01 04 55

Laugh all you want, still doesn't work for me on either 15 or 16 EAP :)

Link to my full IDEA settings in case anyone wanna take a look (perhaps some setting somewhere interferes):

https://dl.dropboxusercontent.com/u/2966998/idea/Mamut-15.jar
https://dl.dropboxusercontent.com/u/2966998/idea/Mamut-16-EAP.jar

@tonsky Thanks, now I can reproduce it. Will try to fix in one of the upcoming IDEA 16 EAP builds.

@dmitriid What OS do you have?

@JB-Dmitry

OS X 10.11.2 (15C50)

IDEA Ultimate 15 IU-143.1559.1
IDEA Ultimate 16-EAP IU-144.2151.16

@JB-Dmitry I'm adding the editor.enable.optional.ligatures=true to /Applications/IntelliJ Idea (15|16).app/Contents/bin/idea.properties

@dmitriid Please try next IDEA 16 EAP build (to be released). If it still won't work, attach your log file here or at https://youtrack.jetbrains.com/issue/IDEA-127539.

@JB-Dmitry Done

The following builds have some fixes related to support of ligatures on Mac OS:
IDEA Community build 144.2641
IDEA Ultimate build 144.2641
(corresponding changes didn't make it to the next official EAP build, and will be available in EAP builds later in January)

@tonsky Issue with picking of Light font version should be fixed there.

@dmitriid Try one of these builds, and attach logs from them.

@JB-Dmitry Still nothing :( https://youtrack.jetbrains.com/issue/IDEA-127539#comment=27-1266742

I removed the font, reinstalled it from the link above. Set ligatures=true, nothing :(

I've tried installing Fira Code on my Mint Petra, to use it with PHPStorm 10.0.2, but... I got a huge performance penalty. I tried simply navigating PHP, Blade and Markdown files, but all of them makes my CPU graph go crazy. The files are not big, but are from the same project. A markdown scratch file presents the same issues.

The problem does not happen with Hasklig, though. The performance is normal with it.

Should I open a separate issue about IntelliJ performance?

@igorsantos07 I have experienced the same. Reported here

Tried on Ubuntu 14.04 with AndroidStudio 2.0 Preview 4. Also had performance problem.

Time required for application of OpenType substitution rules in the font is approximately proportional to the number of matching rules - as, more often then not, rules don't match, we need to go over each rule for each character/glyph in input string.
It looks like Fira Code might use much less rules to implement the same logic. E.g. currently 4 matching rules (lookup subtables) are used to implement