Disabling ligatures
Weekly progress update since 2023-09-14 • 2023-09-21 • Michael Rees
One of the features I've previously mentioned as planned before 0.1 is the ability to disable ligatures. Ligatures are, generally speaking, a good thing! However, there might be times where the author wishes to disable them.
As of tonight, this is now possible. Burro has a new command, .ligatures
, which accepts a "relaxed boolean" argument. The idea of a relaxed boolean is also new for Burro. This means that any of on
, true
, or yes
parse to a truthy value, while off
, false
, and no
are falsy.
I added these new booleans because the other words can sometimes flow more nicely than true
or false
. In this case, I like .ligatures[on]
more than .ligatures[true]
(this matches mom's terminology as well).
To learn how to implement the new feature, I found myself reading the OTF specification—not all 640 pages of it, but just the section on font features! Fonts support several features related to ligatures:
liga
: default ligaturesclig
: contextual ligaturesdlig
: discretionay ligaturesrlig
: required ligatures
Currently, Burro only supports turning liga
, clig
, and dlig
all off. This is done by disabling that set of features from the font file before handing off to the font shaping step. A future improvement could be to allow for finer grained control here.
Even with .ligatures[off]
, Burro leaves the required ligatures enabled. This is done because those ligatures are required for a reason. Some scripts might require certain characters to be combined. The specification also recommends that rlig
never be disabled.