Sublime Forum

Sublime Text 3 Build 3207 Ligatures Not Working

#1

Currently I’m using Sublime Text 3 Build 3207 in Windows 7. I have tried Fira Code, Monoid, and Iosevka, and the ligatures still not working. Also have tried several font options: directwrite, no_antialias, and gray_antialias without any luck.
Below are my current settings hope it helps:

{
	"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
	"font_face": "Monoid",
	"font_options":
[
    "directwrite"
],
	"font_size": 8,
	"ignored_packages":
	[
		"Vintage"
	],
	"theme": "Monokai Classic.sublime-theme"
}

Can anyone point out what did I miss here?

0 Likes

#2

have you tried in Plain Text syntax to see if the ligatures show up there?

0 Likes

#3

yes I have, and also didn’t work

0 Likes

#4

I can confirm that all these fonts you mentioned work fine with ST — although they produce different ligatures for symbols like <= and =>, so which one you use depends on the operators supported by the specific syntax (see docs of these fonts for more details).

To enable ligatures you need to adjust settings, either globally or per syntax. The default ST settings contain commented examples/instructions on how to enable the various ligatures groups for each font:

    // 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.

There’s a post on the forum that explains in detail how to work with ligatures, but I can’t remember where.

0 Likes

#5

FiraCode for me works fine with these settings on most langs:

  "font_face": "Fira Code",
  "font_options":
  [
    "subpixel_antialias",
    "gray_antialias",
  ],
0 Likes

#6

From:

Under a blank Windows7 SP1 ligatures don’t work. Only after applying some unspecified Windows patches they work

So Win 7 might be a problem — I have Win 10 and only needed the above settings.

3 Likes

#7

So apparently it’s Sublime Text 3 in Windows 7 issue, because there is no issue in VSCode on the same laptop.

Also tried some other font options, still no luck.

Thank you for pointing me to the right direction, really appreciate it! Hope someone else found this post useful.

0 Likes

#9

This is very strange, for if VSCode supports ligatures then the OS should be OK to go with any apps.

Try to do all tests in plain text files, because ligatures only work for a given token — e.g., if the syntax parses == as two separate = symbols, than ligatures will fail (poor syntaxes often do that). In plain text syntax there is no highlighting, so ligatures should work fine if supported — just take any source file and set it’s syntax to plain text to check ligatures.

Also, ensure that you override the default font settings in your custom Sublime settings for Windows.

You might need to try also settings for fonts visualization engines (directwrite or gdi, as discussed in various posts). For me the defaults work fine, but if the laptop doesn’t have a graphic card, then you might have to try different settings.

1 Like

#10

For future reference: general ligature debugging/info can be found at https://www.sublimetext.com/docs/3/ligatures.html.

VSCode is written on top of Chrome, which uses harfbuzz for text shaping. We use Microsoft’s Uniscribe APIs for text shaping, so they may be different in specific situations.

I do know that ligatures won’t work with gdi set in font_options. GDI is very old and deprecated by Microsoft, but lots of people are used to the output it provides. In general ligatures work fine in the default configuration (directwrite), however it would appear perhaps some builds of Windows 7 have bugs in Uniscribe? This doesn’t surprise me considering how old the OS is that this point.

2 Likes

#11

Sorry for late respond, I just finished installing Windows 10 along with ST3 in it. And yes, ligatures work great! Thanks for telling me about VSCode text shaping, because it conduses me a lot when it didn’t work on ST3.

0 Likes