Few more additional ones, more about editing than just rendering:<p>The style change mid ligature has a related problem. While it might be reasonable not to support style change in the middle of ligature, you still want to select individual letters within ligatures like "ff", "ffi" and "fl". The problem just like with color change is that neither the text shaper nor program rendering text knows where each individual letter within ligature glyph is positioned. Font simply lacks this information.<p>From what I have seen most programs which support it use similar approximation as what Firefox uses for coloring - split the ligature into equal parts. Works good enough for something like "fi", "fl" not so much for some of ligatures within programming fonts that combine >= into ≥.<p>There are even worse edge cases in scripts for other languages. There are ligatures which look roughly like the 2 characters which formed it side by side but in reverse order. There are also some ligatures in CJK fonts which combine 4 characters in a square.<p>Backspace erases characters at finer granularity than it's possible to select them.<p>With regards to LTR/RTL selection weirdness I recently discovered that some editors display small flag on the cursor displaying current position direction when it's in mixed direction text.
> some editors display small flag on the cursor displaying current position direction<p>I was amazed to see IDEA/RustRover doing exactly this [1] when I added BIDI texts to my code to test things out.<p>[1] <a href="https://i.imgur.com/Qqlyqpc.png" rel="nofollow">https://i.imgur.com/Qqlyqpc.png</a> (image taken from IDEA issue tracker)
A technical note: OpenType Layout does have a way of representing the appropriate _cursor positions_ to use for components of a ligature[1], which is a good proxy for where the individual glyph boundaries are in the trivial case (fi and fl, say) but these tables are not reliably included in all fonts, and they are not actually used by much client software (last I checked they were used by CoreText but not by HarfBuzz or DirectWrite.)<p>[1]: <a href="https://learn.microsoft.com/en-us/typography/opentype/spec/gdef#ligature-caret-list-table" rel="nofollow">https://learn.microsoft.com/en-us/typography/opentype/spec/g...</a>
> Few more additional ones, more about editing than just rendering<p>Right after TFA was published, someone put together the text editing version: Text editing hates you too: <a href="https://lord.io/text-editing-hates-you-too/" rel="nofollow">https://lord.io/text-editing-hates-you-too/</a>
I cannot imagine a use case where I would want to do a style change mid ligature. Can someone smarter than I am give a reasonable example of doing so?
> who really cares if “æ” is written as “ae”?<p>Nitpicking, but if you're writing about text rendering you should know:<p>Yes, ligatures are really about presentation and not semantics. For example <i>fi</i> (U+FB01) means the same thing as <i>fi</i>; it just looks neater in some situations.<p><i>æ</i> (U+00E6) is not a ligature; it's a mostly obsolete character, with different semantics (or phonetics) than <i>ae</i>.<p>For example, for purely typsetting beauty, your word processor might substitute the ligature <i>fi</i> for the two letters <i>fi</i> (which can f* search, and I resent both the ligature and lazy search function developers). It would never substitute <i>æ</i> for <i>ae</i>; that would misspell the word as much as substituting an <i>o</i>.
> æ (U+00E6) is not a ligature; it's a mostly obsolete character, with different semantics (or phonetics) than ae.<p>Reading that a letter in my alphabet is mostly obsolete feels really weird. No rebuttal, just a comment.<p>> It would never substitute æ for ae; that would misspell the word as much as substituting an o.<p>While that is correct, a lot of other systems actually do this exact substition. If your name contains <i>æ</i> it will be substituted with <i>ae</i> in passports, plane tickets and random other systems throughout your life.<p>My own username on this website is an example of a similar substition. The <i>oe</i> should be read as the single character <i>ø</i>.
> Reading that a letter in my alphabet is mostly obsolete feels really weird. No rebuttal, just a comment.<p>Sorry, I should have specified 'in English'.<p>> a lot of other systems actually do this exact substition. If your name contains æ it will be substituted with ae<p>I agree and to clarify, I meant that the reverse substitution doesn't happen.
> I agree and to clarify, I meant that the reverse substitution doesn't happen.<p>Re-reading your comment, yeah its obvious that that was what you meant. My apologies, that’s on me.
Languages often simplify as they evolve, dropping "annoying" characters like æ. In fact, it was replaced by "e" (or ae itself) in most cases as the words got imported by other languages.
A personal hypothesis is that additional characters were much simpler in the age of handwriting, most of the history of literacy, compared to the age of print, the current age.<p>Using handwriting, additional characters are simple and in fact Medieval European scribes used many abbreviations, etc. When you need to set type on a printing press, or even input a character not already on your computer keyboard, the barrier is higher.
I hope that the implication is that æ is obsolete in English. Because it is used in English!
It's mostly obsolete in English, which I think is safe to say and which does not conflict with it being used. For example, I think few people know how to type it into a computer, while everyone who uses a Latin alphabet can type <i>ae</i>.
To be fair I think most English speakers are unfamiliar with how to type most accents. But it appears to me that æ is available as long press "accented character" just like é and ë, also used in English, so they are equally reachable on mobile phone.
> _lazy_ search function developers<p>doing non-ascii first needs awareness and then quickly becomes tricky (encodings yay).<p>getting combining characters and/or homoglyphs right is hard.<p>and if you're still bored out: have fun with Unicode confusables.txt ...<p>with this in mind I dare to give them lazy bums the honor of the doubt and rather call them something between naïve and scared.
ok, fine. :)<p>Isn't there a library out there for this common set of problems? I know Unicode provides normalization tables, though I don't know how good they are and I don't know if Unicode also provides a library.
Nitpicking your nitpicking: I think the author meant better.<p>The "ae" example was used as an introductory example for us <i>English readers</i>.
Unlike the Arabic examples where ligatures are mandatory and supported by most
Arabic fonts, not many English fonts have an "ae" ligature these days. Not to
mention this is a web page and a user can freely apply their !important font
styles.<p>Using æ to mean "treat it as an 'ae' rendered by ligature which is
visually indistinguishable" does not mean the author knows nothing about this
(although the wording can use some improvement to reduce the ambiguity).
I don't understand: <i>æ</i> is <i>not</i> a ligature so it's not an example of a ligature. There are English ligatures to use.<p>Also, most fonts have many characters beyond ASCII, including <i>æ</i>. If your font lacked it then you would see an empty box, not the two letters <i>ae</i>. Applying a font style would not change the rendering of <i>æ</i> into ASCII letters; I don't think it changes the rendering of English ligatures, which are separate code points in Unicode.
> mostly obsolete<p>The Nordic languages beg to differ!
Keep Swedish out of this, you dirty Danes!<p>Edit: Checked out your profile, correcting myself: "you silly north-Danes!"
Yes, sorry, I should have said, 'in English'.
(2019) Popular in:<p>2023 (290 points, 119 comments) <a href="https://news.ycombinator.com/item?id=36478892">https://news.ycombinator.com/item?id=36478892</a><p>2022 (399 points, 154 comments) <a href="https://news.ycombinator.com/item?id=30330144">https://news.ycombinator.com/item?id=30330144</a><p>2019 (542 points, 170 comments) <a href="https://news.ycombinator.com/item?id=21105625">https://news.ycombinator.com/item?id=21105625</a>
I've tried to ask this before in various contexts and I've never been able to find an answer but maybe commenters on a post like this would know.<p>I like the way that the CJK fonts render without anti-aliasing on windows. I want to know why and how to cause windows to render a non-cjk font of my choosing in this aliased style. I am not opposed to hex-editing or otherwise modifying the font if that's necessary. I've never been able to find information bout the mechanism or how it's triggered.
<a href="https://int10h.org/blog/2016/01/windows-cleartype-truetype-fonts-embedded-bitmaps/" rel="nofollow">https://int10h.org/blog/2016/01/windows-cleartype-truetype-f...</a><p><a href="http://www.electronicdissonance.com/2010/01/raster-fonts-in-visual-studio-2010.html" rel="nofollow">http://www.electronicdissonance.com/2010/01/raster-fonts-in-...</a>
Just disable ClearType and all your text will be uniform :)
The ligatures part of this article gets me every time I re-read it. I think reading this article may have been the first time I realized that even large, well-funded projects are still done by people who are just regular humans, and sometimes settle for something that's good enough.
> Text is complicated<p>So true!<p>> and english is bad at expressing these nuances.<p>I think English is a terrible shitpile of grammar and syntax. I'm very impressed that anyone who speaks another language natively can get good at it.<p>But I'm interested in the notion that it lacks nuance to describe the intricacies of text rendering. Can someone tell me where that would apply?
> I'm very impressed that anyone who speaks another language natively can get good at it.<p>From my completely anecdotal observations, native speakers are the worst at English. They struggle with homophones, prepositions, tenses, confuse meanings of words, apostrophes and I could go on and on.<p>English grammar is easier to learn by reading and writing than speaking, what most native speakers do.<p>Its/it's, they/their/they're, who's/whose, prepositions like a lot, a while and confused words like definitely and defiantly are the first that come to mind. See if you are better than a foreigner.
> I think English is a terrible shitpile of grammar and syntax<p>Spoken languages are like programming languages, there are the ones people complain about and the ones nobody uses.
And start with simpler regular rules and get more complex over time as words are imported and reimported, pronunciations shift, grammatical rules morph and evolve (often to simplify grammatical genders and cases) while leaving their mark, and spelling changes.<p>For example, goose/geese is the result of the plural form and singular form undergoing different paths in the Great Vowel Shift resulting in the different vowels in the modern form.<p>There's also evidence that Proto-Indo-European had laryngeal consonants that have disappeared in all modern languages derived from it [1], but have left their mark on the descendant languages.<p>[1] <a href="https://en.wikipedia.org/wiki/Laryngeal_theory" rel="nofollow">https://en.wikipedia.org/wiki/Laryngeal_theory</a>
Then there are also the lovely instances of deliberate misspellings / insertion of letters into words that never had them in English.<p>Eg. receipt, which has the p only in Latin, but had long lost it by the time Old French brought it to Britain.
This. A language that doesn't adapt (accumulate shitpile of baggage from other languages over changing times) will be a dead language eventually.<p>English will always have my respect for being open/inclusive and adaptive.<p>Interesting fact: If you are looking for a spoken language with the cleanest/composable grammar - it's Sanskrit. The panini grammar is actually like a programming language where sentences are just compositions of lower level similar units.<p>But like I said it's practically dead (not used as a spoken language). But interestingly used as a proxy language for translation and other nlp tasks due to it's clean grammar :)
> the notion that it lacks nuance to describe the intricacies of text rendering<p>I took this to mean that any non-domain-specific language may be bad at describing that domain, e.g. why physicists, mathematicians, chemists, etc. have a common symbology for the discipline, or why programming languages exist. i.e., not so much that English is uniquely bad among written human language for conveying these topics, but just that any non-specialized language may be.<p>Though, I think the author did a fair job, but I lack the domain experience to guess at where the misconceptions might lie.
As a native english speaker, i did try to learn german but eventually gave up. A language sprinkled with "learn by wrote" gender prefixes for every item is just not worth learning. I did have an issue with the numbers being back to front once you get to the unit value but then someone pointed out english does that too for the values 13-19... so there ya go.
> A language sprinkled with "learn by wrote" gender prefixes for every item is just not worth learning.<p>Bantu languages, which cover much of subsaharan Africa, have many noun classes ("genders")—sometimes as many as 20. You have to learn all sorts of prefixes for each noun class depending on their grammatical role in tying to the noun.<p>However, it's really not so bad. Once you get the hang of the noun classes, it actually makes picking up the ear for it <i>faster</i>. Of course this is more true the more consistent the language in applying its internal rules.
Learn by ‘rote’.
<i>> So subpixel-AA is a really neat hack that can significantly improve text legibility, great! But, sadly, it’s also a huge pain in the neck!</i><p>Especially when you have a monitor with unusual subpixel layout, which is very common for OLEDs that don't have any standard for it. In practice, developers of common font libraries like FreeType simply didn't bother with trying to support all that. And that trickles down to toolkits like Qt. Surprising the article doesn't mention this major problem with modern displays.<p><i>> Retina displays really don’t need it</i><p>Assuming this means high resolution displays - unfortunately that's not always what you end up using. So subpixel antialiasing can still be useful, if it can work. But as above, it's often just broken on OLEDs.
"Subpixel offsets break glyph caches"<p>I once resolved that by keeping a vertically shrunken but really wide glyph around in a cache. Just resample it for a different horizontal offset.
The AGG (“Anti-Grain Geometry”) library does something similar[1], from what I understand.<p>Also, I had (though never tested) the impression that in the Windows world ClearType uses 3x the horizontal resolution internally (I vaguely remember that being mentioned in the horror novel^W^W <i>Raster Tragedy</i>[2] somewhere?..). Given many font designers’ testing process for their hinting bytecode seems to be to run it through ClearType and check if it looks OK (not unlike firmware programmers...), we all, including Microsoft, are essentially stuck with that choice forever (or at least until people with painfully low-res displays become rare enough that the complaining about blurry text can be disregarded). So I’d expect 1/3 of a pixel to be the natural resolution for a glyph cache, not 1/4? Or have things changed in the transition from GDI to GDI+ to DirectWrite?<p>[1] <a href="https://agg.sourceforge.net/antigrain.com/research/font_rasterization/index.html#toc0011" rel="nofollow">https://agg.sourceforge.net/antigrain.com/research/font_rast...</a><p>[2] <a href="http://rastertragedy.com/" rel="nofollow">http://rastertragedy.com/</a>
>But if the transform is an animation this will actually look even worse<p>I wish they provided an example video of this since I can't visualize it. My natural thinking is subpixel antialiasing should look fine.<p>>the characters will jiggle as each glyph bounces around between different subpixel snappings and hints on each frame.<p>This shouldn't be a big issue unless your animation is slow and your subpixels are big.
Hmm I use Firefox and the rendering I see in Firefox looks nothing like the render the author gets in Firefox; in fact the text rendering I get looks very similar to the "Chrome" rendering. Obviously this must depend on the libraries linked during the build process.
The article is from 2019, things might also simply have changed since then.
Depending on your OS Firefox will select from multiple rendering backends based on your GPU, driver etc.<p>On Windows it may or may not be using DirectWrite for text rasterization as a general thing, and in some cases text might be rasterized using a different fallback path if DirectWrite can't handle the font, I think.<p>IIRC this was/is true for Chrome as well, where in some cases it software rasterizes text using Skia instead of calling through to the OS's font implementation.
IIRC, Chrome now uses CoreText/DirectWrite for system fonts on macOS/Windows, and Skrifa (FreeType rewritten in Rust) outlines rasterized with Skia for everything else (system fonts on Linux, web fonts on all platforms).<p>I believe Firefox leans on the system raserizers a little more heavily (using them for everything they support), and also still uses FreeType on Linux.
> <i>Don’t ask about the code which line-breaks partial ligatures though.</i><p>Wondered about this. All the circular dependencies sound like you could feasibly get some style/layout combinations that lead to self-contradictory situations.<p>E.g. consider a ligature that's wider than the characters' individual glyphs. If the ligature is at the end of the box, it could trigger a line break. But that line break would also break up the ligature and cause the characters to be rendered as individual glyphs, reducing their width - which would undo the line break. But without the line break, the ligature would reconnect, increase the width and restore the line break, etc etc...
Blink's (Chromium) text layout engine works the following way.<p>1. Layout the entire paragraph of text as a single line.<p>2. If this doesn't fit into the available width, bisect to the nearest line-break opportunity which might fit.<p>3. Reshape the text up until this line-break opportunity.<p>4. If it fits great! If not goto 2.<p>This converges as it always steps backwards, and avoids the contradictory situations.<p>Harfbuzz also provides points along the section of text which is safe to reuse, so reshaping typically involes only a small portion of text at the end of the line, if any.
<a href="https://github.com/harfbuzz/harfbuzz/issues/224" rel="nofollow">https://github.com/harfbuzz/harfbuzz/issues/224</a><p>This approach is different to how many text layout engines approach this problem e.g. by adding "one word at a time" to the line, and checking at each stage if it fits.
And the companion article: <a href="https://lord.io/text-editing-hates-you-too/" rel="nofollow">https://lord.io/text-editing-hates-you-too/</a><p>(posted in other other threads too)
How did they get the exact effect to show what they want in the text here instead of say, me seeing the exact same visuals for each browser as I am reading it from a single browser?
> Just so you have an idea for how a typical text-rendering pipeline works, here’s a quick sketch:<p>1. Styling (parse markup, query system for fonts)<p>2. Layout (break text into lines)<p>3. Shaping (compute the glyphs in a line and their positions)<p>4. Rasterization (rasterize needed glyphs into an atlas/cache)<p>5. Composition (copy glyphs from the atlas to their desired positions)<p>Why is layout done so early? It seems to me that that would be later in the process.
The real takeaway from the article is that you can rathole forever on ill-defined problems. Decide upfront whether you care about actual humans and their usecases or hypothetical humans and their hypothetical usecases.
Good. I hated <i>it</i> first!
After seeing "english" twice in one paragraph I stopped reading.