I think it depends on font family too, e.g. Consolas working for me as expected, however with directwrite
ST doesn’t show Roboto Mono Italic/Bold variants.
Italic/bold not working
Hey kris5228: Does bold and italics work for you with the Cobalt theme? If so, can you save a backup copy of your Oceanic_Next.tmTheme file and then add the following lines to the original:
<dict>
<key>name</key>
<string>Bold Markup</string>
<key>scope</key>
<string>markup.bold</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>bold</string>
<key>foreground</key>
<string>#C1AFFF</string>
</dict>
</dict>
<dict>
<key>name</key>
<string>Italic Markup</string>
<key>scope</key>
<string>markup.italic</string>
<key>settings</key>
<dict>
<key>fontStyle</key>
<string>italic</string>
<key>foreground</key>
<string>#B8FFD9</string>
</dict>
</dict>
Does this give you bold and italics? (You might need to exit sublime and delete the cache file to get this to work.) It does for me. It looks to me like some of the .tmTheme files are using bold and italics only for certain code elements and/or only with certain syntaxes. This means that some of them won’t do anything in response to _ italics _ or ** bold **.
I’ve tried adding it to my tmTheme file but still no change. I’ve tried many different tmTheme files and even though they work perfectly fine in Windows, none of them work in Linux.
It seems some of the bugs are because font creators and sublime dont sync.
Most of the modern fonts have “Regular”, “Italic”, “Bold”, “Bold Italic” typefaces at lease. So, Sublime does not catch the default “Regular” type, and if you set font_face to “Some Font Regular”, you lose bold and italic, because Sublime cannot find it, as it appends “Bold” and “Italic” keywords to look for a font. Obviously “Regular Bold” does not exist.
For fonts whose regular type consists only of a name “Some Font”, everything’s fine.
So since you cannot make font designers to name fonts as we want, SublimeText should be made capable of defining font sets manually, like “font_face”: [“Font Regular”, “Font SemiBold”, “Font Italic”, “Font Compressed Bold Italic”].
Handling of fonts with many weights was fixed in build 3127. Linux and Windows were primarily affected. Build 3127 will also now print info to the console if a font has geometry issues that prevent using the bold or italic faces.
I can confirm Operator Mono Mediu works now but non-monospaced fonts (e.g. Garamond, Verdana) still face the same issue.
I’m using Input Serif Compressed and was trying to get it to reflect various weights. I discovered that you have to go to the actual font name as it is stored on your machine. So in my case, to get the bold variant, I had to show it like so:
"font_face": "InputSerifCompressed-Bold",
That worked for me on my Mac.
I was struggling to get Ubuntu Mono font to work. On my Mac, the font book has a collection that I installed called Ubuntu Mono but when I enabled that font in the file: Preferences.sublime-settings–User like this: “font_face”: “Ubuntu Mono”, all text characters turned in to squares with a question mark in the center.
*Resolution: from font book, select the font collection you want to use. In my case, Ubuntu Mono. Then right click on that collection and “show in finder”. Each font was listed individually in the Fonts folder: UbuntuMono-B.ttf, UbuntuMono-BI.ttf, UbuntuMono-R.ttf, UbuntuMono-RI.ttf. So I created a new folder in the Fonts folder named “Ubuntu Mono” and moved the UbuntuMono fonts to the new folder. When I enabled “font_face”: "Ubuntu Mono: and saved the Preferences file it worked!
I hope this is helpful to others,
@felixhao28 non-monospaced fonts (e.g. Garamond, Verdana) still face the same issue.
@wbond This behavior is intended, and not a bug.
@wbond so are you saying that there’s no bold/italic support at all for all non-monospaced fonts?
I’ve configured Sublime as a clone (a far better clone!) of iA Writer, and I’m loving it for markdown editing. However, when I set "font_face": "iA Writer Duospace"
it no longer has support for bold/italic text - it’s a shame, because this font is basically monospace except for a very few characters.
Here’s the font, it’s open source: https://github.com/iaolo/iA-Fonts
It would be really awesome if Sublime could support bold/italic text on this font
Here’s an explanation of the font as well for anyone who’s interested: https://ia.net/topics/in-search-of-the-perfect-writing-font/
Disregard that earlier question asking for clarification, apparently I’m not the first to request this feature:
- https://github.com/SublimeTextIssues/Core/issues/279
- How to enable bold and italic for not monospace font?
- Proportional fonts lose italic/bold syntax highlighting
- Operator italic is not displaying as set by the theme
I was just hoping that maybe a practically monospace font could be supported since iA Writer Duospace is completely monospaced (iirc widths don’t change depending on italic/bold styles), except for a few letters which are wider than others (those still stay the same width when bolded/italicised, however). I wouldn’t opposed to an option to override this behaviour and enable non-monospaced fonts to be bolded/italicised anyway - even if it changed the location of the cursor.
You can use the font_options
setting for that:
// Valid options on all platforms are:
// - "no_bold": Disables bold text
// - "no_italic": Disables italic text
// Antialiasing options:
// - "no_antialias": Disables antialiasing
// - "gray_antialias": Uses grayscale antialiasing instead of subpixel
// Ligature options:
// - "no_liga": Disables standard ligatures (OpenType liga feature)
// - "no_clig": Disables contextual ligatures (OpenType clig feature)
// - "no_calt": Disables contextual alternatives (OpenType calt feature)
// - "dlig": Enables discretionary ligatures (OpenType dlig feature)
// - "ss01": Enables OpenType stylistic set 1. Can enable sets 1 to 10
// by changing the last two digits.
// Windows-only options:
// - "directwrite": (default) Use DirectWrite for font rendering
// - "gdi": Use GDI for font rendering
// - "dwrite_cleartype_classic": Only applicable to "directwrite" mode,
// should render fonts similar to traditional GDI
// - "dwrite_cleartype_natural": Only applicable to "directwrite" mode,
// should render fonts similar to ClearType "natural quality" GDI
// - "subpixel_antialias": Force ClearType antialiasing when disabled
// at system level
// Mac-only options:
// - "no_round": Don't round glyph widths for monospace fonts when
// "font_size" is small.
"font_options": [],
i.e.
"font_options": ["no_italic"],
Sorry, but I don’t think that your suggestion will work.
In the settings file (ST 3) it says that no_bold and no_italic are not supported.
Perhaps you are referring to ST4?
The paste above is from Default/Default (Windows).sublime-settings
as shipped with ST3 build 3210 and seems to work just fine. If your settings file is different, perhaps you have an override from a prior version?
I am using ST3 build 3210 on Ubuntu 20.04. I thought that the settings file would be identical regardless of platform, but perhaps that is not the case.
.I don’t know about overrides. I don’t think I have them.
You’re looking at the comment for the setting that follows font_options
:
// Font options for theme text. Valid options are the same as
// "font_options", except "no_bold" and "no_italic" are not supported
"theme_font_options": [],
Sorry, my mistake. It’s sometimes difficult to understand these settings files.