News for hackers. Stuff that matters.
Re:Texture Healing for Monospace Fonts by starkparker on Friday November 10, 2023 @01:52PM (#38222887)
It bothers way me more that the same glyph can differ within the same word than it satisfies me that the glyphs are very slightly more proportional. The third "m" in the "minimum" example being narrower than the "m"s adjacent to the two "i"s makes my brain itch. Same for the "i"s in "miniature". Makes me feel like I'm looking through a fish-eye lens, or that my glasses prescription is off.
Re:Texture Healing for Monospace Fonts by vinberdon on Friday November 10, 2023 @03:33PM (#38224133)
Yeah... I hate this. Solves a "problem" for someone with a different type of OCD than mine.
Re:Texture Healing for Monospace Fonts by jay_kyburz on Friday November 10, 2023 @05:20PM (#38225332)
This is a solution looking for a problem.
Re:Texture Healing for Monospace Fonts by cosmotic on Friday November 10, 2023 @03:37PM (#38224187)
This is going to make a lot of brains itch.
Re:Texture Healing for Monospace Fonts by andix on Friday November 10, 2023 @04:04PM (#38224510)
My brain seems to scan for differences to familiar patterns. For code that just doesn't look right. When I see stuff like this, it feels like finding a bug/typo. So a lot of false alarms.

Maybe my brain would adjust after a while. And maybe I'm also different to other people. I think my reading skills are a bit skewed towards recognizing words/patterns instead of reading characters (probably some form of compensation for my dyslexia).

Re:Texture Healing for Monospace Fonts by mortenjorck on Friday November 10, 2023 @04:58PM (#38225087)
I think this all makes a lot more sense when seen in a practical context rather than the blown-up examples in the feature documentation.

Take a look at the code editor examples on the main site for Github Monaspace: https://monaspace.githubnext.com Scroll down to the "Five Fonts" section and try unchecking the texture healing toggle.

The fisheye effect you get when looking at the font in 200pt goes away at 16pt, and in the context of a busy code block, has the effect of smoothing out the visual rhythm of the characters with only a minor disruption of the monospace grid. Perhaps it's not for everyone (it is a trade-off), but I think it's a smart compromise.

Re:Texture Healing for Monospace Fonts by tobr on Friday November 10, 2023 @05:17PM (#38225304)
I think this is a fun innovation and I might try to use it in my terminal, but for coding, the real solution should be obvious: use a proportional font.
Re:Texture Healing for Monospace Fonts by cylinder714 on Friday November 10, 2023 @06:46PM (#38226087)
I wonder if there are proportional fonts/typefaces that are amenable for coding use? Here, let me open that can of worms....
Re:Texture Healing for Monospace Fonts by Stratoscope on Friday November 10, 2023 @07:53PM (#38226489)
This seems to be an unpopular opinion, but proportional fonts are great.

One question people sometimes ask is, "How can you code in a proportional font? How do you line things up in columns?"

The answer is you don't. For example, the Black code formatter for Python completely eschews column alignment of this sort:

  foo.bar(one,
          two,
          three)
(Imagine that the words were long enough that the whole thing wouldn't fit on one line.)

Instead, Black formats it like this:

  foo.bar(
      one,
      two,
      three
  )
No column alignment, only indentation. Code formatted like this is equally readable in a proportional or monospaced font. You don't need monospaced fonts!

I've read and written all my code in proportional fonts for close to 20 years. My current one is Trebuchet++, a variant of Trebuchet MS that I customized in FontForge.

Trebuchet MS is pretty good on its own. For example, all of the "confusable" glyphs are easy to distinguish. And it renders very nicely on a high-DPI display.

Its tilde is pretty bad, though. It's tiny and almost looks like a hyphen. So that was the first thing I fixed, putting in a better tilde.

Then I experimented with spacing for the _ and . glyphs. I added negative margin on both sides of the _, while keeping its width. And I added positive spacing on both sides of the . glyph. Consider code like this:

snake_case_name.another_snaky_name()

These spacing changes have the affect of pulling the individual words in each name closer together, while increasing the separation between the two names.

It is subtle, but to my eye it helps readability.

Next up will be to add some positive margin inside the three pairs of brackety things: (), [], {}. I have always found that it helps readability to add a space inside parens and such, but most contemporary code formatters prohibit this. With a proportional font I can tweak the font to put some visual spacing there.

Re:Texture Healing for Monospace Fonts by adastra22 on Friday November 10, 2023 @10:02PM (#38227257)
"If you stop doing things which derive benefits from monospaced fonts, then you can get away with a proportional font."

Thanks, but no. Your foo.bar() example is significantly less readable the way Black formats it.

Re:Texture Healing for Monospace Fonts by Dylan16807 on Saturday November 11, 2023 @12:08AM (#38227804)
I don't like the extra lines, but also I almost never care if "one" is exactly lined up with "two". You can use proportional fonts with the first example too.
Re:Texture Healing for Monospace Fonts by kdmccormick on Saturday November 11, 2023 @12:52AM (#38227953)
> can use proportional fonts with the first example too.

what, how? Wouldn't the number of spaces you'd need to prefix lines 2 and 3 with vary between fonts?

Re:Texture Healing for Monospace Fonts by Dylan16807 on Saturday November 11, 2023 @01:54AM (#38228139)
Not if you don't care about "one" exactly lining up with "two".

  foo.bar(one
        two,
        three) //this is fine, and slight drift on different fonts is also fine
I would have demonstrated in a proper proportional way but HN destroys NBSP.
Re:Texture Healing for Monospace Fonts by adastra22 on Saturday November 11, 2023 @02:07PM (#38233415)
That was the whole point.
Re:Texture Healing for Monospace Fonts by Dylan16807 on Saturday November 11, 2023 @02:31PM (#38233664)
You dismissed the idea as "if you stop doing thing which benefit from monospaced fonts", suggesting that monospaced fonts are better in this situation.

My argument is that both fonts are just as good in this situation, and monospaced fonts aren't benefiting here. You don't need monospaced fonts to use formatting 1, you can just choose formatting 1 and then use either kind of font.

Doesn't that mean I disagree with your post?

Re:Texture Healing for Monospace Fonts by adastra22 on Saturday November 11, 2023 @05:35PM (#38235269)
Having the "one" line up with the "two" is the benefit here, and the point of the monospaced font. If you don't care about that, fine. But objectively lots of people do.
Re:Texture Healing for Monospace Fonts by Dylan16807 on Saturday November 11, 2023 @06:34PM (#38235685)
Well I'm saying that it does still line up in a reasonable sense, at least from the perspective of someone that would use a proportional font at all and isn't looking for a grid.

It's important to note that I'm not comparing monospace versus proportional. I'm saying that "formatting 1 with proportional font" isn't really worse than "formatting 2 with proportional font". Both of them are going to have problems from someone that really likes monospacing.

Re:Texture Healing for Monospace Fonts by adastra22 on Saturday November 11, 2023 @07:22PM (#38235977)
"If you stop doing things which derive benefits from monospaced fonts, then you can get away with a proportional font."
Re:Texture Healing for Monospace Fonts by Dylan16807 on Saturday November 11, 2023 @09:29PM (#38236665)
No, that's the opposite of my point.

"If you already decided to have a proportional font, you don't need to stop doing any things."

My argument is that "need to stop doing X" is not true for either kind of font.

Re:Texture Healing for Monospace Fonts by ZephyrBlu on Saturday November 11, 2023 @01:30AM (#38228064)
That formatting is extremely common in dynamic languages. Are you from the C/C++ world?
Re:Texture Healing for Monospace Fonts by alex-moon on Saturday November 11, 2023 @06:05AM (#38229235)
For me it's not about lining things up in columns as much as it is about column widths. So, for example, hitting up or down, I know which character the cursor is going to go to (which means I can string keypresses together and do them in a fluid movement). Putting in a hard limit for line lengths (which is very important to me, I know opinions on this differ) means that limit can be drawn as a literal line on the UI (which in turn means I know how small I can resize the editor pane to be). Similar lines with slightly different values (e.g. 'x', 'y' and 'z') will line up so the different values are underneath each other everywhere they appear in the line (also those lines will be the same length which reassures me those lines are the same outside the variables/values).
Re:Texture Healing for Monospace Fonts by jrmg on Friday November 10, 2023 @09:40PM (#38227153)
I can’t help but think that the example in that page has used ‘timing’ so much to deliberately show off texture healing - it’s a great example because the ‘m’ can expand in both directions and the ‘i’s end up looking the same.

I suspect the state where different width variants of the same letter are close to each other would happen a lot more in the real world.

Re:Texture Healing for Monospace Fonts by Terretta on Monday November 13, 2023 @09:25AM (#38250429)
Right, and they show it above "time" where the "e" can't "give the space" so you can understand if it actually bothers you (probably not unless you stop and stare):

    const timing_end_m_ = () => {
      let timing_end = new Date();
      let time_spent = timing_end - timing_start; // in ms
Re:Texture Healing for Monospace Fonts by galaxyLogic on Friday November 10, 2023 @10:14PM (#38227323)
That's a good link. I think the text-healing mode with VS Dark Theme is clearly the most readable
Re:Texture Healing for Monospace Fonts by seanhunter on Saturday November 11, 2023 @01:04AM (#38227985)
This might be an autism thing for me but turning on texture healing on that page is so horrible it actually made me flinch.

The fact that the "i" in "terminal dimensions" and the "i" in "width" aren't underneath each other makes it look like my monitor is broken or something. It's like someone has done it on purpose to mess with me.

Re:Texture Healing for Monospace Fonts by deaddodo on Saturday November 11, 2023 @02:38AM (#38228333)
After seeing it in a larger context like that, I'm even more in agreement with OP. The weirdly random letter alignment screws with my brain much more than I thought from just the localized examples in the topic link.

I'll stick to the consistent design for a slightly less aesthetic experience for that reason alone.

Re:Texture Healing for Monospace Fonts by crazygringo on Friday November 10, 2023 @08:12PM (#38226582)
Yup, I unfortunately have to agree. It's a cool idea, but when I type "gimme" in the editor, the two adjacent m's are different widths, and it looks sooo wrong.

Interestingly enough, the fact that letterforms change as I type doesn't bother me the way I thought it would -- turns out I'm already kinda used to it from ligatures.

So points for being a clever idea to try out, but unfortunately what it does to a word like "gimme" just makes it a non-starter. Let's face it -- lowercase m's in monospace will always be ugly and cramped, but at least they're consistently so.

Re:Texture Healing for Monospace Fonts by gwern on Friday November 10, 2023 @08:22PM (#38226646)
But is this a fundamentally bad idea, or is it, like kerning in general (which can require thousands of pairs to be defined), something that just needs more work?

It's not like this is limited to just a few pairs of letters like 'mi', or just pairs - if you've seen Fontemon https://www.coderelay.io/fontemon.html you know the sky is the limit for what the rewrites can do!

Re:Texture Healing for Monospace Fonts by crazygringo on Friday November 10, 2023 @08:37PM (#38226762)
Specifically for monospace fonts, it's not obvious to me how any further work could fix it.

The same letterform having different widths just looks bad and wrong.

It's not like kerning, which always looks good when done well (for proportional fonts).

Re:Texture Healing for Monospace Fonts by galaxyLogic on Friday November 10, 2023 @10:12PM (#38227309)
> It's not obvious to me how any further work could fix it.

In "gimme" you could have a rule that when any character is next to itself both occurrences must have the same width. Wouldn't that fix the "gimme" example?

Re:Texture Healing for Monospace Fonts by eternityforest on Saturday November 11, 2023 @12:13AM (#38227827)
What about distributing the space amount more that one letter, and ensuring no two of the same letter are ever different. You'd allow things to get out of sync and not be on a perfect grid, so long as you could align everything at key points where a line has the same character on two successive lines, or some other case where you know you need alignment.

Everything else would just look like a proportional font.

Maybe it would influence coders too much and subconsciously make them choose names that line up well though...

Re:Texture Healing for Monospace Fonts by seanhunter on Saturday November 11, 2023 @01:56AM (#38228147)
It's a fundamentally bad idea. I think for anything to look monospace for me the following two properties are non-negotiable.

1) Horizontal spacing needs to align vertically between glyphs of the same letters on separate lines. This is the example I give elsewhere of a letter "i" being in a very slightly different position than the same letter just two lines above it. I personally find this extremely disturbing and unpleasant to look at in monospace.

2) The glyph of a letter needs to be the exact same between instances of the same letter that are in any kind of visual proximity. This is the "gimme" example the parent of your comment gives. AnyThinG ElSe LoOkS lIkE jumblycase. Which I think we can all agree is just plain horrible.

Re:Texture Healing for Monospace Fonts by phanimahesh on Saturday November 11, 2023 @11:39AM (#38231800)
The effect is not as pronounced and almost indistinguishable in xenon radon and krypton. It's just neonand argon that look horrible in gimme.