9

I looked at Fira Code and I wanted to try it out with one of the listed supported editors. So I launched RStudio (Version 0.99.491 on a Win box) and set the font to Fira Code but ... nothing. So how to enable font ligatures in RStudio?

EDIT: The trick in the accepted answer below still works for RStudio Version 1.0.44. I still wish there's a simple button to enable it.

green diod
  • 1,399
  • 3
  • 14
  • 29

3 Answers3

10

I still wish there's a simple button to enable it.

Wish granted! We've just added this to RStudio 1.1.

You can try the preview release here:

https://www.rstudio.com/products/rstudio/download/preview/

Jonathan
  • 8,497
  • 41
  • 35
  • Is there any way to get these ligatures to work within the plot window, e.g. for a `ggplot` axis? – Brian Aug 02 '17 at 20:30
  • Not that I'm aware of, but if it's possible it doesn't have anything to do with RStudio settings (ggplot2 fonts are rendered inside R). – Jonathan Aug 03 '17 at 21:48
  • @Jonathan Thanks! I changed the accepted answer to yours! – green diod Jun 19 '19 at 21:06
  • So, the comment of 2017. I use Rstudio latest from here: https://hub.docker.com/r/rocker/rstudio/tags There are no buttons for using ligatures. Where is this button? – Avraam Apr 04 '23 at 09:53
7

RStudio now have a build in option for ligatures, you do not need these dirty hack any more, cheers!


[OLD CONTENTS]

  • Close RStudio
  • Open [RStudio dir]/www/index.htm (If you are using a Linux distribution, the dir may be /usr/lib/rstudio, thanks for the comment of @CosminSaveanu)
  • Add following code between <head> and </head>:

    <style>*{text-rendering: optimizeLegibility;}</style>

  • Restart your RStudio.

dirty but works.

Losses Don
  • 923
  • 10
  • 14
  • Thanks Losses Don, your trick works (I corrected your path because in version 0.99.491 of RStudio, the latest at this date, index.htm is directly under www and not under www/rstudio) . I just wish there would be just a way to enable it directly in a menu. – green diod Jan 12 '16 at 09:37
  • @greendiod you are right, i've changed my answer :P – Losses Don Jan 14 '16 at 04:18
  • I edited again the answer to move the `style` part inside `head`. But still, it should be easy to enable right from the user interface. – green diod Dec 20 '16 at 19:58
  • Also works with RStudio 1.0.143 on Linux. The location of the index.htm is in `/usr/lib/rstudio/www` for Ubuntu 17.04. – Cosmin Saveanu Jun 20 '17 at 08:59
  • @CosminSaveanu Hey, thanks for your comment! I have add the information you provided to my answer. – Losses Don Jun 20 '17 at 09:13
  • More detail on @losses-don's instructions for Mac: To find `index.htm` in bullet point 2, ctrl+click on `RStudio.app` in the `Applications` folder, then navigate to `Contents/Resources/www/`. – Will Jul 27 '17 at 20:42
0

If you are using Linux then type in your Terminal,

sudo apt install fonts-firacode 

Restart Rstudio then in Tools / Appearance / Editor Font: choose Fira Code and Apply.

msjahid
  • 66
  • 2