this post was submitted on 09 Nov 2023
287 points (95.0% liked)

Programming

17651 readers
350 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities [email protected]



founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 17 points 1 year ago (3 children)

That texture healing looks super nice. Is that something fonts can just do or does it require special editor support?

[–] [email protected] 21 points 1 year ago (1 children)

It's basically a different type of ligature - it is standard to OTF fonts, but requires ligature support in your editor/terminal. Just need to enable ligatures and/or enable specific ligature sets. See https://github.com/githubnext/monaspace#editors or maybe https://wezfurlong.org/wezterm/config/font-shaping.html for the general procedure in a supporting terminal.

[–] [email protected] 1 points 1 year ago (1 children)

Is there a way to disable it but keep ligatures?

[–] [email protected] 2 points 1 year ago (1 children)

From https://github.com/githubnext/monaspace#editors :

If you want coding ligatures but do not want texture healing, you can omit the calt setting:

[–] [email protected] 1 points 1 year ago
[–] [email protected] 19 points 1 year ago* (last edited 1 year ago)

Texture healing works by finding each pair of adjacent characters where one wants more space, and one has too much. Narrow characters are swapped for ones that cede some of their whitespace, and wider characters are swapped for ones that extend to the very edge of their box. This swapping is powered by an OpenType feature called “contextual alternates,” which is widely supported by both operating systems and browser engines.

Contextual alternates are normally used for certain scripts, like Arabic, where the shape of each glyph depends on the surrounding glyphs. And they are also used for cursive handwriting fonts where the stroke of the “pen” might have different connection points across letters. Texture healing is a novel application of this technology to code.

basically fonts were already capable of using alternate versions of characters based on their nearby characters, so they used that for these fonts to allow for seemingly-dynamic sizing/spacing

[–] [email protected] 8 points 1 year ago (2 children)

It's an OpenType standard feature but the font rendering system has to support it and the app has to enable it. The page has a link to instructions for enabling it in VS Code but I have no idea about support status on different OS and desktop environments. I could see it working on webview on Android fwiw, I'm guessing it's either well supported in general or at least by browsers.

[–] [email protected] 6 points 1 year ago

Here is the comprehensive editor compatibility list for Fira Code. Should be the same.

[–] [email protected] 2 points 1 year ago

It is well supported in all browsers and operating systems. At least VS Code and IntelliJ support it, and even some terminals.