fix: graphemes are not correctly highlighted

Graphemes don't all have the same width, not even when you use a monospace font.
For latin characters it usually works find to assume the same width. But emojis,
japanese or chinese characters have have different width. There are even some
ultra wide characters like 𒐫 or ﷽. There is also a thing
called 'half-width' character. E.g. the japanese 'a' can be ア or ア.

Fixed by actually computing the width of graphemes and using pixel.
This commit is contained in:
2025-03-23 21:00:53 +01:00
parent 21b2da1e69
commit 61132d242f
6 changed files with 181 additions and 86 deletions

View File

@@ -22,6 +22,25 @@ x◌᷍◌◌᷍◌x
Control characters:

------------------------------
wide and half width characters:
123456789
アンドレアス
アンドレアス アンドレアス アンドレアス アンドレアス アンドレアス アンドレアス アンドレアス
アンドレアス
canadian aboriginal:
ᑭᓇᑐᐃᓐᓇᑦᑎᐊᖅᒥᒃ
simplified chinese:
任何人不得使为奴隶或奴
Thai:
ทุกคนมีสิทธิที่จะได้
Nastaliq Urdu (rl):
چونکہ یہ تمام
Braille:
⠑⠧⠑⠗⠽⠕⠝⠑
Arabic (rl):
ولما كانت
------------------------------
👍🏿 dark thumbs up (U+1F44D + U+1F3FF - THUMBS UP SIGN + EMOJI MODIFIER FITZPATRICK TYPE-6)
ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------ä---------ä----------<
2019-08-07 00:00:10,391 [catalina-exec-40] INFO c.r.c.u.l.PerformancePointcut - Executed HealthCheckController.checkOperativeness in 1 ms successful. [jv3fw7r2.m1u5]