Go Down

Topic: How to change the editor font? (Read 6070 times) previous topic - next topic

rubenyz

Feb 25, 2015, 05:14 pm Last Edit: Feb 25, 2015, 05:52 pm by rubenyz
Hi!
How do I change the editor font?
I know about the preferences.txt file, but I don't exactly know the syntax of "editor.font=xx,xx,xx"
I want to change the font to Source Code Pro Medium, but how do I type that? I tried SourceCodePro-Medium, but that doesn't work...

Regards,
Ruben

johnwasser

In Arduino 1.6.0 on my MacBook Pro the preferences.txt file includes:
Code: [Select]
editor.font=Monaco,plain,10

I expect the first field is font name. The second field is probably "plain" or "bold" or "italic" or perhaps combinations.  The third field is probably point size.

For the font name, try putting it in exactly as shown in your font list:
Code: [Select]
editor.font=Source Code Pro Medium,plain,10

If that fails, try using single-quotes:
Code: [Select]
editor.font='Source Code Pro Medium',plain,10

If that fails, try using double-quotes:
Code: [Select]
editor.font="Source Code Pro Medium",plain,10
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

johnwasser


After downloading the font, this worked for me on my Mac and Arduino 1.6.0:

Code: [Select]
editor.font=Source Code Pro,Medium,12
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

rubenyz

#3
Feb 26, 2015, 03:35 pm Last Edit: Feb 26, 2015, 03:36 pm by rubenyz
Thank you, I didn't think it would've been so simple...

Code: [Select]
editor.font=Source Code Pro Medium,plain,14

That works.
I thought I had to use the PostScript name, which is SourceCodePro-Medium.

Thanks!

spicetraders

If your using OSX, then under the launcher in the other container you will find the "Font Book".  This handy app shows all fonts and displays the samples.  It also allows revel in finder the true name and extension used for the font.  Use the true name the font is listed as in the finder, which is not always the font display name.

The font book also provides for validating a font type, a right click on font name will allow this so double check your font is valid.

Also the OXS can display six different font types, not sure if the IDE can use all six.


nicholask

I'm in my mid-60s and find those "pastel on pastel" schemes that are popular these days hard to read.  I even resorted to using an external editor for my Arduino programming.

Today I did a number of web searches on how people deal with this issue and found out a few things that allowed me to changes fonts, colors and so on.  I thought this would be a good place to list my notes as they might be helpful to others.  My system is a Windows 7 PC.

The default fonts and colors are hard to read and user allowed options are minimal.  If you go to preferences, it states that you can make more changes by editing "preferences.txt" and gives a link to its location, which in Windows 7 is at:

C:\Users\nickrk\AppData\Roaming\Arduino15

Where "nickrk" is my user name, of course.

However, there's a lot of stuff that's not in that file either.  It turns out there's a file called "themes.txt" under your Arduino program directory, in W7 it's here:

C:\Program Files (x86)\Arduino\lib\theme

Editing it is tricky due to protection.  I make a backup copy and save my edited file to the desktop, then drag it in to the above directory and give an OK as Administrator to over-write the original.  Note that in one case after I did an edit, the IDE would not start up, so the backup is essential.

I reversed the colors of the background and text for the screen, giving me white on black.  Then I searched out some color coding information and changed "comments" so they'd be more visible too.  I found info on colors versus the 6-digit hex codes here:

http://www.javascripter.net/faq/rgbtohex.htm

I also wanted to change the font itself but wasn't sure what's available.  Turns out there are some font files in:

C:\Program Files (x86)\Arduino\java\lib\fonts

They are all Lucida something or other.  I opened my "preferences.txt" file and changed the editor font from "editor.font=Monospaced, plain,16"  to "editor.font=LucidaSansRegular,plain,16", which I think looks a lot better. Could I have just used a Windows system font?  I don't know
.
I found that my old cursor could barely be seen so I changed it to bold yellow on black in "theme.txt".  It's called "caret", I changed editor.caret.color from #333300 to #ffff00.

Note that I also downloaded an Arduino "themes editor" but it didn't pan out because it wasn't aware of the latest file locations in W7 installations, apparently.

Regards,

Nick

nicholask

Well, I'm replying to my own post to say for sure be careful when modifying theme.txt.  I've once again run into an issue where I edit theme.txt and the Arduino IDE refuses to start up.  It goes through some of the starting sequence spash screen stuff and then disappears without an error.  I even had to do a complete re-install to get back a theme.txt file that would allow me to start up.

I assumed it was something to do with the text file format.  When I look at it with a hex editor, I see linefeeds (0x0A) only, no carriage returns (0x0D).  So I carefully did my editing with an editor that displays non-printing codes to assure no 0x0D but still got the same result.  Hmmm?

Nick

Go Up