Change editor font to Alegreya

Hi guys,

Is there any way to change the RStudio editor font to Alegreya.
Any help will be kindly appreciated.

Thanks

Did you try to install the font on your computer then see if you can select it in RStudio global option ?

I don't have that font on my system, but if you do (and if it's a code font — monospaced, etc.) it should show up as an option if you go to RStudio >> Preferences >> Appearance panel >> Editor font dropdown

1 Like

I did, it doesn't show up in the editor font menu.

I tried that but it doesn't show up in the menu. It's not a monospaced font. That is why I was asking if there is a way to hack it into RStudio somehow.

Well, being open source and all, the source code is always available:

It's looking for proportional and/or fixed-width fonts (this is just from a piece of CSS, but if you go through the code you'll see it several times)

The editor is built on Ace. So, if you can find something that works for Ace, you've got a good shot of being able to adapt it:

2 Likes

Thanks for the links, but I'm a bit of an amateur and don't understand these much.

In that case, I'd recommend avoiding "hacks" as you start to get familiar with the tools.

Haha okay!
Thanks for the help.

FWIW, the way people usually hack the editor themes right now is something like this:

This is a fairly harmless but pretty tedious and fragile method (it breaks every time you update the RStudio IDE). And your options are somewhat limited by the way Ace editor themes work (they’re pretty much ports of TextMate themes), so you can’t easily do things like have the Markdown in R Markdown documents be a different font from the code chunks (that would be a top feature on my list!).

I believe the IDE team has stated that they want to make an officially supported method for people to customize editor themes, but it hasn’t made it into a release yet.

2 Likes

Thanks!
This is what I was looking for.

Already there in preview releases! You can import tmTheme files. I've made a couple themes (both from importing tmTheme, and directly using ace scopes in rsthemes), but I haven't tried anything with fonts.

FWIW, there are reasons to stick to coding fonts for editing code:

3 Likes

Thank you Mara for this.

Unfortunately, non-monospaced fonts are not supported in the RStudio editors -- hence why we screen them out.

2 Likes

Thanks, I understand now