Sublime Forum

How to make a font with working layout features (ligatures etc.)?

#1

I want to make my own coding font with layout features. I don’t like ligatures for operators etc., but tried to add them first to my font to see if they work in general.

I just can’t get it to work. Is there anything special the font has to do to activate ligatures and other OpenType layout features?

I’ve been working on font engineering for quite a while, so the fonts should be fine. Ligatures are active in Fira Code and Space Mono, which use different techniques (calt feature vs. liga feature), so it should be no big deal to get working layout features, but they just are not applied in my font. Neither on Windows 10 nor MacOS 10.12, neither in OTF nor TTF files. The only difference is that my font is not monospaced while Fira Code and Space Mono are. I’m using build 3156.

Any ideas or hints?

0 Likes

#2

I also noticed that not all rules from Fira Code are applied in Sublime Text. The working ligatures and the missing rules are both part of the Contextual Alternates (calt) feature.

Take for example this substitution rule:

sub \zero \x' @HexDigit by \x.multiply;

This is what it should look like:

The x is replaced by a multiplication x in hex numbers (and the colon is raised when it is placed between two uppercase letters, this is a different substitution rule which is not shown here). Both are not applied in Sublime Text.

The ligatures of Fira Code work though, and also work when I export the Fira Code fonts myself from the available Glyphs source file.

0 Likes

Improve D parsing and ligature support
#3

When I make all glyphs the exact same width, the ligatures suddenly work. It would be nice if they also worked in proportional fonts.

0 Likes

#4

Unfortunately proportional fonts generally are second-class citizens to monospace fonts within Sublime Text.

I believe this is primarily due to reflow issues when changing proportional fonts. If you type a character and the syntax changes the style, and the new style chars are wider or narrower then a whole section of text can shift around. This sort of reflow can happen with ligatures also. If the ... glyph is narrower than three ., then things will shift around in funny ways as you type.

1 Like

#5

I see … I can get it to work by making the key glyphs monospaced and making sure that the metrics for the italic font are identical. That’s good enough for now.

0 Likes