Firacode: Old style nums variant prevents lot of ligatures

Created on 1 Mar 2018  路  6Comments  路  Source: tonsky/FiraCode

Problem

Some characters like = (equal) have an identical onum variant (equal.tosf). This breaks the ligatures since there are none with equal.tosf.

Exemple

  • Normal:
    screenshot from 2018-03-01 16-09-29

  • With ligatures (default):
    screenshot from 2018-03-01 16-09-37

  • With oldstyle nums:
    screenshot from 2018-03-01 16-09-43

  • With both:
    screenshot from 2018-03-01 16-09-47

Suggestion:

Remove the .tsof variant for characters that doesn't change with the onum feature to restore default ligatures.

Thanks

Most helpful comment

@camsteffen

Ligatures are pattern based. E.g. you want to replace -> with an arrow. The code for that would be:

sub hyphen greater by hyphen_greater.liga;

So if your program sees hyphen glyph followed by greater glyph it would replace both with a single hyphen_greater.liga which contains a double-width arrow in case of Fira Code.

Old-style numbers are implemented the same way:

sub zero by zero.onum;
sub one by one.onum;

The problem is that it used to replace not only numbers but some symbols like -, +, <, >, % and so on. If onum substitution happens first ligatures won鈥檛 work because character is not different:

hyphen greater -> hyphen.onum greater.onum -> ??? (does not match <hyphen> <greater>)

This change removes substitutions for everything except the numbers, so both old-style numbers and ligatures can work at the same time.

All 6 comments

Makes sense, but still leaves lots of characters that do change. May I ask what鈥檚 your use-case? Why are you turning on both old-style numerals and ligatures?

Because I like coding with old-style nums (for some reason it helps me read long numbers) and I like this font ligatures!

Besides removing features seemed like an easy fix, since most ligatured chars (at least the one I use) do not change.

FYI I removed (with fontforge I don't have access to glyphs) all .tsof variants except numbers (which seem to be the only ones varying) and everything is working fine except the multiply (1x1) and the uc (1:1) ligatures that operate on regular numbers and not on the old style. (It still is a lot better)

Would someone be so kind to explain this change for curious simpletons like myself?

This change means that you鈥檒l be able to use old-style numbers along with ligatures that appear directly next to numbers. Here鈥檚 a screenshot showing the difference between normal and old-style numbers:

@camsteffen

Ligatures are pattern based. E.g. you want to replace -> with an arrow. The code for that would be:

sub hyphen greater by hyphen_greater.liga;

So if your program sees hyphen glyph followed by greater glyph it would replace both with a single hyphen_greater.liga which contains a double-width arrow in case of Fira Code.

Old-style numbers are implemented the same way:

sub zero by zero.onum;
sub one by one.onum;

The problem is that it used to replace not only numbers but some symbols like -, +, <, >, % and so on. If onum substitution happens first ligatures won鈥檛 work because character is not different:

hyphen greater -> hyphen.onum greater.onum -> ??? (does not match <hyphen> <greater>)

This change removes substitutions for everything except the numbers, so both old-style numbers and ligatures can work at the same time.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Igorgro picture Igorgro  路  3Comments

whatisaphone picture whatisaphone  路  3Comments

mlajtos picture mlajtos  路  4Comments

iyzana picture iyzana  路  3Comments

pedrowebcomum picture pedrowebcomum  路  4Comments