• qwertyasdef@programming.dev
    link
    fedilink
    arrow-up
    20
    arrow-down
    1
    ·
    1 year ago

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

    • Die4Ever@programming.dev
      link
      fedilink
      arrow-up
      16
      ·
      edit-2
      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

    • lemmyvore@feddit.nl
      link
      fedilink
      English
      arrow-up
      8
      ·
      1 year ago

      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.