4

Is it possible to display a specific font_face for each individual syntax language setting in Sublime Text 2? For example:

"php" : { "font_face" : "Droid Sans Mono" },
"c#" : { "font_face" : "Courier New" },
"javascript" : { "font_face" : "monospace" } 

Couldn't find much about the font_face setting in ST2 other than how to change it globally. My job requires me to jump around a lot of different language files and think this would make them easier to distinguish on the fly. I like my color scheme and want to keep that the way it is, but unfortunately it doesn't quite differ enough for me to be able to pick out the languages quickly.

5
  • You might try posting this on SuperUser, they might have a better answer. (particularly because sublimetext doesn't appear to have many followers on SO) Aug 24, 2012 at 2:07
  • Saddens me to hear about the no ST followers... But thank you for the tip! I'll go post there now.
    – voodooGQ
    Aug 24, 2012 at 2:11
  • 1
    if you mouseover the tags (e.g. "sublimetext") it'll show you the # of followers for the tag. Aug 24, 2012 at 2:12
  • And that's why I love the StackNetwork, learn something new every time I look at it. Thank you again!
    – voodooGQ
    Aug 24, 2012 at 2:14
  • In case people are interested, I've posted an answer over at superuser.com/questions/465661/….
    – fguchelaar
    Aug 24, 2012 at 8:57

2 Answers 2

5

If you go to Preferences > Settings - More > Syntax Specific - User, you can add

{
    "font_face": "Source Code Pro"
}

to have that font for only that syntax.

2
  • 11
    In case it isn't obvious, to configure a certain syntax you must first have a file of that syntax open.
    – Ben Graham
    Nov 15, 2012 at 0:02
  • People are searching around the internet to find this comment ^^. Aug 6, 2014 at 19:17
3

For syntax specific settings for targeted language, in Packages > User folder, create a file with name of that language.

ex. for PHP, create php.sublime-settings.

and add following code to it:

{
    "font_face": "Source Code Pro"
}

For JavaScript create file names JavaScript.sublime-settings and so on.

Also, using this technique, you can set different color schemes for different languages using the color_scheme attribute.

{
    "font_face": "Source Code Pro",
    "color_scheme": "Packages/Theme - Flatland/Flatland Monokai.tmTheme"
}

Alternatively, if the file with targeted language is open, you can go to Preferences > Settings - More > Syntax Specific - User, and add the font_face setting.

1
  • What about different font faces for a specific syntax? For example I want to have italic version of my font to be used for comment lines? Is it possible? Aug 14, 2014 at 8:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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