10

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.

3 Answers 3

11

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/

4
  • Is there any way to get these ligatures to work within the plot window, e.g. for a ggplot axis?
    – Brian
    Aug 2, 2017 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 3, 2017 at 21:48
  • @Jonathan Thanks! I changed the accepted answer to yours!
    – green diod
    Jun 19, 2019 at 21:06
  • So, the comment of 2017. I use Rstudio latest from here: hub.docker.com/r/rocker/rstudio/tags There are no buttons for using ligatures. Where is this button?
    – Avraam
    Apr 4 at 9:53
8

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.

6
  • 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, 2016 at 9:37
  • @greendiod you are right, i've changed my answer :P
    – Losses Don
    Jan 14, 2016 at 4: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, 2016 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. Jun 20, 2017 at 8:59
  • @CosminSaveanu Hey, thanks for your comment! I have add the information you provided to my answer.
    – Losses Don
    Jun 20, 2017 at 9:13
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.

0

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.