651 points · by davidbarker · 3y ago · 199 comments
One naive way to do this would be to create ligature pairs for difficult pairs (mi, lm, etc). But instead, they seem to be selecting character alternates that fill the fixed width differently based on their surroundings.
In practice this is unusable. Because the width of the letters now depends on the succeeding character, the text jumps as you write it. Super annoying.
Cool for reading. Awful for writing.
[append] Oh, I do see some jumping when I type "optimized". Honestly, it doesn't seem very jarring to me; the jumping is always right where the edit point is so the added or removed letter causes a much bigger jump.
But even without anything like that, if it’s good for reading I like to use different fonts when reviewing and writing code to help with the context-switch, so I think this could be useful to me. And I guess people in regions where a single keystroke isn’t always a single character such as Korea, China, Japan and the arab world might be used to the jarring effect already?
The text editor widget on their page is a bunch of "line" divs with individual terms being inside spans. If you add an inline style of
font-feature-settings: "calt" off;
or, more completely, font-feature-settings: "calt" off,"dlig" var(--ligatures,1),"ss01" var(--ligatures,1),"ss02" var(--ligatures,1),"ss03" var(--ligatures,1),"ss04" var(--ligatures,1),"ss05" var(--ligatures,1),"ss06" var(--ligatures,1),"ss07" var(--ligatures,1),"ss08" var(--ligatures,1);
to a single line div or a single term span, it won't do the healing. If one of the CSS pseudo selectors worked for these kinds of elements (I see there are a lot that apply to forms, but.. maybe :active / :active-within would work for editable spans?), you could have healing automatically apply to terms when they 'blur' / when they're no longer active.If the editor “repaints” commit mono on the letter-pair boundary, I could see that being a very jumpy UX — ie: the letter I just typed is moving by a few pixels. But if that repaint happens on the word boundary it might be less noticeable?
In either case, a transition could be helpful for commit mono and/or Monaspace. (But agreed with above comments that Monaspace is more subtle because it spreads the spacing over the entire word, so maybe the transition is not actually percievable or worth it). :)
As far as I can tell from the demo, these pairs currently aren't affected by texture healing, and they look a little awkward in Radon especially.
I feel at least partially the same about fancy ligatures; we could just use the actual characters in source code, Unicode is widely supported. Raku does that, but it would need better typesetting (with variable-width fonts) to really shine.
It sometimes breaks out of the grid, but there still is a grid. Things are sometimes not micro-aligned but still macro-aligned, and that matters (to me).
Why do we keep using fixed-width fonts? Because a lot of stuff has been written that depends on a columnar grid. Most notably, terminals are absolutely predicated on it and fundamentally cannot support any other mode of operation.
To begin with: visual alignment, ASCII art, diagrams using box-drawing characters, &c., both in code and in the output of diverse tools:
def function_name(and_long_parameter_list,
so_that_it_wraps="like so"):
pass
ABC_D = 1 # Explanation
ABC_EFG = 2.0 # Another one
ABC_HI = 34 # A third one
┌────────┬─────────────┐
│ Tables │ Using │
┝━━━━━━━━┿━━━━━━━━━━━━━┥
│ Cell │ Box-drawing │
│ Cello │ characters │
│ Viola │ ⋮ │
│ Voilà │ │
└────────┴─────────────┘
error: cannot find macro `behold` in this scope
--> <anon>:1:13
|
1 | fn main() { behold!() }
| ^^^^^^
$ ls -la
total 43210
drwxr-xr-x 17 root root 4096 Jan 1 23:45 .
drwxr-xr-x 17 root root 4096 Jan 1 23:45 ..
lrwxrwxrwx 1 root root 7 Feb 29 2020 bin -> usr/bin
drwxr-xr-x 2 root root 0 Dec 31 23:59 boot
⋮
(I included the ⋮ in the box drawing table deliberately, because it demonstrates a weakness in the scheme: terminals and most monospacy text editors force stuff into the grid, just clipping or overflowing the cell if a glyph has to come from a fallback font, but most other things don’t, so you end up with visual alignment breaking if the fallback font used has different metrics. Also the whole East Asian Width thing and ucwidth and whatever is super messy. Your monospace font may or may not include the box-drawing characters, but it’s much more unlikely to include ⋮.)Terminals are also built on columnar behaviour; there are escape codes for moving the cursor to such-and-such a line and column, for example, and things like a side-by-side split require columnar behaviour.
Text editors can go non-monospaced, but it breaks various content for the reasons discussed, and you’ll need monospace for any terminal because loads of stuff will break otherwise, so combined with inertia, even editors that support proportional fonts aren’t often used that way if they default to monospace.
(Me, I’d rather like to use a proportional font while editing, but I’m not moving off Vim for it, so I’ll probably never get it. But for presentation, I like to go at least partially proportional with the monospace font Triplicate’s Poly variant, which breaks strict monospaceness, widening characters like w/m/W/M and narrowing characters like i/j/l/1. As for what Monaspace’s texture healing, I like it most of the time, but am not sold on cases like some_function_w_, where the last two underscores are markedly shorter than the first and it feels unbalanced.)
Code can be aligned with elastic tabstops ( https://nickgravgaard.com/elastic-tabstops/ ) or virtual formatting (that things are aligned according to syntax regardless of whitespace).
Things to align in terminals are mostly tables, and they could be rendered as tables if the terminal supporting that knew that they are tables. Nushell natively supports tabular data structures, so rendering them as proper tables would need just one change – the table renderer.
It might be ok but there is a reason why type designers make every character to be the same and try to balance everything including spacing.
Monospaced fonts designs are dictated exactly by that limit of fixed character+fixed space.
But maybe the “healing” might not be verydistracting.
I really like the idea of using different style of font for different things, but as primarily terminal user, I don't even know which terminals support it (if any), and then we would need CLI text editors support as well. But I think it's a great idea.
Radon (the handwriting one) seems to complement the other fonts well because it's basically an italic. But all the others are so similar, with their identical metrics and whatnot, that the "authoritative docstrings" and "Copilot voice" examples are really hard to distinguish.
I’ve wanted to switch to an open alternative to Operator Mono for a long time now, and I think because of the mix and match, this finally is the one.
those other variants are not nearly different enough to really convey information.
// What if tentative ideas looked handwritten?
/**
* What if docstrings looked authoritative?
*/
... misaligning the two ** in /** is awkward.Even Monaspace here has a width slider, which starts at "wider than PragmataPro" and just slides to "silly width". I wonder why they didn't try sliding down to a condensed version?
Default Iosevka is close, but the leading is much larger. Luckily you can customize it to be almost identical (set `leading = 1110` in the config; value obtained by trial and error).
I was on a quest to find the narrowest font and Quinze was the answer. It's something like 20% narrower than Iosevka and M+. I can't find an easy comparison with PragmataPro but if Iosevka is a free interpretation of PragmataPro like you mentioned then Quinze should be narrower as well.
In fact Quinze is so narrow that when I attempted to force its use in all monospace text in the browser, readability took a hit instead of improving. This is because at the same height it is much smaller than "normal" fonts. In my coding setup I use a huge font size which works great with the narrow width.
I guess the downside is that Quinze is very minimal: pretty much only ASCII, no ligature, no customization etc. None of those bother me.
Here is a screenshot of Iosevka Comfy in action: https://share.combo.cc/-bN9f8hAiiG
and Iosevka Comfy Motion, with tasteful serifs: https://share.combo.cc/-BNHfhV4zgu
I'm using "Bell MT" to replace Times in browser (and also using it for variable-pitch font in emacs Org mode), it is good but I wish it had a taller/condensed version.
Also, one of the best condensed mono font is "The Sans Mono Condensed" which first popularized by early Oreilly books (it has since switched to other mono fonts). The downside is that it only has a western character set but I liked it a lot
% ttfmono MonaspaceArgon-Regular.otf
monospaced flag = 0
(0 = variable-width, otherwise = monospaced)
Sadly I think that because of that flag it does not enable ligatures.I was able to see ligatures and text healing in vim running in a patched st* though. I really like it thanks! The text healing only moves the line subtly as I type and when I cursor over there are no droppings from the widened 'm' for example. It's well thought-out for code.
If I could ask for a feature it would be to select some variants, like angular 0 with reverse slash or to leave the ! in the != ligature. To see what I mean: https://github.com/be5invis/Iosevka/blob/main/doc/stylistic-...
I have to explicitly set the "Show all fonts" checkbox which shows all "non monospaced" fonts.
I have recommended this many times here, but I use a proportional coding font: Input Sans
Why is that? In text or punctuation?
For words it’s more readable. The punctuation is designed for coding. The numerals are still monospaced.
For others, this is ligatures https://fonts.google.com/knowledge/glossary/ligature
> If you want coding ligatures but do not want texture healing, you can elide the calt setting:
There is no point in cranking out yet another code font that doesn't have hinting. PragmataPro and Berkeley Mono are such well loved fonts not because of their aesthetic quality (code fonts are (proudly) ugly), but because of how well their hinting has been done.
If I want an unhinted, but well performing, font... there is Iosevka. Which I use.
[0] http://eastfarthing.com/luculent/
[1] https://fontlibrary.org/en/font/luculent (live example in browser)
from fontTools import ttLib
from path import Path
output_dir = Path('mono')
for file in Path('.').files('*.otf'):
print(file)
font = ttLib.TTFont(file)
font['post'].isFixedPitch = 1
font['OS/2'].panose.bProportion = 9
font.save(output_dir / file.name)
font.close()So tl;dr it's: "MonaspaceVARIANT-WEIGHT", no spaces.
Unfortunately, it's on the editor to support mixing fonts. There's never been multiple compatible monospaced fonts before so no editors really support this yet. Lots of editors also don't support variable typefaces properly yet (ahem, VS Code) but this is going to change.
Ultimately what you're describing is the future! But we have to release the typefaces to bootstrap that future.
We made a prototype extension that hack it into VS Code. But they're hacky af and not really releasable.
Emacs and Vim have both supported this since at least last century.
So if I want to use a variable pitch font (like say... DejaVu Sans) to draw comments, I can set the font-lock-comment-face to use the "DejaVu Sans" family.
Using this approach, you can use up to 4 different fonts: One for normal text, one for italic, one for bold, and one for bold italic. And the font for each group doesn't necessarily need to be that style, e.g. you can use a non-bold version for the `bold` font, etc.
hi Comment guifg=#7e7490 gui=bold,italic
In Kitty, set the desired fonts: font_family IosevkaTerm Nerd Font Mono
italic_font IosevkaTerm Nerd Font Mono
bold_font IosevkaTerm Nerd Font Mono
bold_italic_font Iosevka Term SlabOther editors/terminal emulators would probably need to add support for this.
Even to my aesthetically un-nuanced sensitivity, these fonts look good
Edit and OT: Interesting HN algorithm behavior: I just wrote two posts in this thread (on different topics). The first appeared at the top of the page, as usual for new comments. When I clicked "Submit" on the second one, it appeared below the first one. My guess is that it was because it's much shorter. (First comment: https://news.ycombinator.com/item?id=38213113 )
If it's just an issue with the textbox, it doesn't matter. If it's an issue with the monospaced font, that's a problem.
Makes me wonder how other people deal with so few characters on their screen, or is everyone using high DPI, >1080p monitors?
I might try this one, but I doubt it will be any improvement.
!= is two bloody characters not one.
And now people are doing it for 3 characters.
With this kind of thing, you get all the text editing idiocy of combining characters (like emojis) for no benefit at all.
See: Text Editing Hates You Too https://lord.io/text-editing-hates-you-too/
Unfortunately that's not true.
The problem shows itself when looking at codeblocks that developers share (in docs, blogs, videos, etc...)
Ligatures become a readability problem.
Jetbrains, VSCode people, whomever: edit mode and presentation view. There are times when I think for a lot of people the traditional math style makes sense for reading, but when it comes to editing, it bothers the hell out of me too.
In addition to ligatures, you get IMO a better version of the "Mix & Match" idea: doc comments are rendered as normal proportional text.
Another way to fix the inconsistency is for the language designers to get unstuck from the past and allow literal ≠ in code
Oh this has been done for decades. Metafont (by the inimitable Don Knuth) let you describe glyphs as toolpaths in code. You could have as many parameters as you wanted; I've seen examples where a sans-serif is smoothly swept into a serif.
Metafont never got adopted as much as I would have hoped; the lack of a graphical editor and some impedance mismatch with OpenType probably prevented its wider adoption.
Real typographers know that the Computer Modern family is garbage.
`overflow: scroll` is almost never (p>0.999) the right thing, and users that don’t use overlay scrollbars are suffering because of the poor choice of name, getting a forced scrollbar when one is almost never appropriate. (This includes almost all Windows for now, I believe; and some Linux, probably no longer most since GNOME is bent on ruining everyone’s life; and some macOS.)
—⁂—
When is `overflow: scroll` legitimate?
One obsolete case is preventing document scrolling when a modal is open, without triggering reflow due to the scrollbar disappearing, but I say the side-effects are still worse than the problem (the document scrollbar is nonsensical while the modal is open), so you should let it be (why was scrolling the document under the modal such a problem anyway?), or prevent scrolling by means other than scrollbar manipulation, by capturing it in the modal backdrop.
Another obsolete case is avoiding a bit of layout shift when switching between pages if some fit in the viewport an others don’t; but honestly it’s so long since I’ve seen a site where any pages fit in the viewport… and more to the point, this is better handled with `scrollbar-gutter` (not supported by Safari; you could use @supports to fall back to `overflow: scroll`, but the importance and number of affected users—since Safari is normally overlay scrollbars—are so tiny I don’t think it’s worth it).
The only arguably legitimate case I can think of is on spreadsheets/data grid components, where you can reasonably prefer to display a noop scrollbars rather than just reserving the space for them.
OK, and one other: code to find scrollbar dimensions for various layout purpose normally uses `overflow: scroll` on a temporary element and this is legit, even though you could do it other, mildly more complex ways; but it also makes assumptions about scrollbars always being the same size, and there’s honestly no reason why they should be, and `scrollbar-width` has shown a distinct appetite for using thinner scrollbars in some places and a browser could reasonably vary its default scrollbar width based on the dimensions. And scrollbar-dimension-finding isn’t particularly common, and the problems it’s used to solve are mostly better handled in other ways; now if only viewport units weren’t broken by design in the presence of document scrollbars…
I’ve contemplated campaigning for explicit deprecation of `overflow: scroll` and getting warnings shown in dev tools if you use them, because I’ve seen it misused so many times in the last decade, where people actually meant `overflow: auto`, and other than scrollbar-dimension-finding doubt I’ve seen even a single legitimate and reasonable use in that time.
Still surprised that you are so worked up by this - is it really so common or so problematic?
Your use case sounds like it might be better handled by `scrollbar-gutter: stable`, though I might adjust my judgement on seeing it.
I do think I've seen it before, I don't think it's a new idea. Probably some typographic tradition from when it was used as a section separator in prose.
https://en.wikipedia.org/wiki/Asterism_(typography)
Edit: it’s called an Asterism
The one that kills me is the squiggly comparisons ~>, I find it horrible and doesn't evoke the kind of comparison I see in Gemfiles.
I read |> as "pipe + redirect" for me so turning them to triangles make them lose a ton of meaning.
Oh and != is so much wider than >=, probably because == is, so as not to be confused with = which kinda makes sense but is visually jarring. It's even more jarring with === which gets so wide and thin three-band that it loses its "equalness" and becomes a striped rectangle.
The healing is a nice trick but the difference of m character width riles me up when they line up vertically:
limit
gamut
I can't quite make sense of the whole of ss04 </ glyphs. I feared \/ and /\ would be terrible for awkperlruby regexes, but they only apply if there's whitespace around (still / \/ / is an improbable yet valid regex that would have it transformed)Turns out a font can only infer so much based only on characters when combinations are contextual.
But the most annoying thing is that even if that was solved, ligatures are terrible when editing, especially when your (line) caret ends up in the middle of a ligature or (box) over half of the character (or third), which breaks the illusion/abstraction as you now have to think about the underlying characters.
Definitely a no-go for me, but to each his own.
Some seem useful but is seems I can not pick them individually and have to commit to an entire group of them. The symbol for </> (something I never used anyway) looks like the absolute worst to me, like how is that better? And especially of you do rarely or never used it you get forced into this shit if you like other things from that group and enable it.
Turning two == into one long one, NO! I think people just overthink it, it becomes confusing and not more readable.
- native language
- mathematically or symbolically oriented
- etc.
I personally find them imminently readable and use with Fira Code font.
blah
FTA. It means you can do things like have inline comments use Radon, docstrings use Xenon, code use Neon, and string literals use Krypton for more visual difference -- without the line heights and columns getting all weird because of it.
This beautiful feature is created by the GitHub team and is only available on VS Code, strengthening its lead over the other editors.
This fact has led me to look more closely at Commit Mono, suggested by nvartolomei in his comment (this article). I love the texture healing idea, and that font looks to be more open and easier to use in other environments.