microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.1k stars 793 forks source link

Some of the Arabic letters look extremely corrupted #743

Closed AptiviCEO closed 1 week ago

AptiviCEO commented 1 month ago

Cascadia family version

2404.23

Cascadia family variant(s)

Cascadia Code (the version with ligatures), Cascadia Mono (the version without ligatures)

Font file format(s)

Windows Terminal included version (TTF (variable)), .ttf (variable)

Platform

Windows 11 23H2

Other Software

No response

What happened?

First, thank you for your hard work on Cascadia Code 2404.23!

It looks like that some of the following Arabic glyphs look corrupted on all the applications. I was exploring new typefaces using the character map program on Windows while trying to brainstorm an idea for Terminaux (a C# library) while I encountered some corrupted characters at least for the Arabic language. It only happens in the NF and the PL variants.

However, this corruption doesn't happen on large font sizes (43 px and up); only happens on 42 px and lower. When these Arabic characters connect, the corruption increases.

The following characters all suffer from visual graphical glitches (connected or not) that make such letters illegible: (Note that the terminal I-Beam cursor line is not part of the glyph and, hence, not part of the corruption)

Letter Once Twice Thrice
U+063B: ARABIC LETTER KEHEH WITH TWO DOTS ABOVE (ػ) image image image
U+0684: ARABIC LETTER DYEH (ڄ) image image image
U+0687: ARABIC LETTER TCHEH (چ) image image image
U+0688: ARABIC LETTER TCHEHEH (ڇ) image image image
U+06AD: ARABIC LETTER NG (ڭ) image image image
U+06AF: ARABIC LETTER GAF (گ) image image image
U+06B0: ARABIC LETTER GAF WITH RING (ڰ) image image image
U+06B1: ARABIC LETTER NGOEH (ڱ) image image image
U+06B2: ARABIC LETTER GAF WITH TWO DOTS BELOW (ڲ) image image image
U+06B3: ARABIC LETTER GUEH (ڳ) image image image
U+06B4: ARABIC LETTER GAF WITH THREE DOTS BELOW (ڴ) image image image
U+06B7: ARABIC LETTER LAM WITH THREE DOTS ABOVE (ڷ) image image image
U+06B8: ARABIC LETTER LAM WITH THREE DOTS BELOW (ڸ) image image image
U+06BF: ARABIC LETTER TCHEH WITH DOT ABOVE (ڿ) image image image
U+075E: ARABIC LETTER AIN WITH THREE DOTS POINTING DOWNWARDS ABOVE (ݞ) image image image
U+0763: ARABIC LETTER KEHEH WITH THREE DOTS ABOVE (ݣ) image image image
U+076A: ARABIC LETTER LAM WITH BAR (ݪ) image image image
U+077F: ARABIC LETTER KAF WITH TWO DOTS ABOVE (ݿ) image image image
U+08B0: ARABIC LETTER GAF WITH INVERTED STROKE (ࢰ) image image image
U+08B3: ARABIC LETTER AIN WITH THREE DOTS BELOW (ࢳ) image image image

Out of all the glitches experienced by these characters, U+06AF, U+06B0, U+06B2, U+06B3, U+06B4, U+075E, U+077F, and U+08B0 characters are the most affected with their corruption at its worst. However, the normal Arabic characters look fine, such as this:

image

I suspect that the glyphs for the above characters may not have been generated properly in the final font files.

lhecker commented 1 month ago

However, this corruption doesn't happen on large font sizes (43 px and up); only happens on 42 px and lower. When these Arabic characters connect, the corruption increases.

FYI the issue seems to happen due to incorrect hinting instructions (= when "grid fit" is enabled). On Windows, at large font sizes hinting won't occur anymore and text will be drawn from the outlines instead. That's why it works at >42px. If for instance DWRITE_RENDERING_MODE_OUTLINE is used, then the issue will be fixed even at small font sizes.

AptiviCEO commented 1 month ago

Alright, thanks for this information. Can the grid fitting instructions for these characters be fixed? And how did such instructions go wrong in the first place?

By the way, I've also tested this issue on Android 14 (Termux [grid hinting] and QuickEdit [outline?]), with the U+077F: ARABIC LETTER KAF WITH TWO DOTS ABOVE (ݿ) letter, and Termux has exactly the same issue, so it isn't isolated to Windows.

So, I think that this is a huge regression, because it used to work perfectly in the 2021 version as it had the correct grid fitting instructions.

aaronbell commented 1 month ago

What has likely happened is that the point order changed at some point unexpectedly. I will have to investigate.

skycommand commented 1 month ago

AptiviCEO, your investigation is more comprehensive than mine. Thanks a lot.