blinksh / blink

Blink Mobile Shell for iOS (Mosh based)
https://blink.sh
GNU General Public License v3.0
6.08k stars 565 forks source link

Adding new fonts (Fira Code Stylistic Sets) #889

Open ghost opened 4 years ago

ghost commented 4 years ago

Hi.

It appears that blink.sh does not accept the .monaco-editor CSS property that Fira Code uses to enable stylistic sets. See https://github.com/tonsky/FiraCode/wiki/How-to-enable-stylistic-sets#css

I added the appropriate lines to the Fira Sans template from https://github.com/blinksh/fonts/blob/master/Fira%20Code.css and tried to import the resulting CSS into blink.sh. However, the alternatives were not working.

treyharris commented 4 years ago

As a workaround, you could try https://github.com/twardoch/fonttools-utils/tree/master/pyftfeatfreeze which allows you to “bake in” certain stylistic sets to make them defaults in a special version of the font. You’d then have to put them online so Blink can access them, but a GitHub Pages-served version should work fine.

ghost commented 4 years ago

I tried that to get the alternative styles in iTerm2: for i in Bold Light Medium Regular Retina; do pyftfeatfreeze -f 'ss01,ss03,ss05' -R 'Fira Code/Fira Alt Code,FiraCode/FiraAltCode' FiraCode-$i.otf Fira-Alt-Code-$i.otf; done

Alternative styles work as expected in blink. For some reason, though, ligatures stop working. Using the same font in iTerm2, both alternative styles and ligatures work. Any suggestions?

treyharris commented 4 years ago

Hmm, I suspect this is a manifestation of tonsky/FiraCode#869 — the title of the issue suggests differently, but reading through it seems to suggest ligatures can entirely break if you enable any of these—except for (I’d imagine) ss20, since substituting oldstyle figures for lining figures can be done without such a kludge.

Why the font works correctly on iTerm2 and not Blink, though—I’m baffled.