Change editor font to Alegreya


#1

Hi guys,

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

Thanks


#2

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


#3

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


#4

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


#5

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.


#6

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:


#7

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


#8

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


#9

Haha okay!
Thanks for the help.


#10

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.


#11

Thanks!
This is what I was looking for.


#12

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:


#13

Thank you Mara for this.


#14

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


#15

Thanks, I understand now