Files
macvim-mirror/runtime/doc
Yee Cheng Chin d1c8e612fe Fix CoreText clipping issues with tall texts
This fixes the issue where particularly tall characters will get clipped
at the row boundary. This happens because even though a font describes
the line height with font metrics, individual glyphs do not have to
respect them, and we can see with emoji rendering sometimes they can
poke upwards past the line height. Also, it's trivially easy to
construct composing characters that become really tall, e.g. "x゙̂⃗", or
Tibetan scripts like "ཧཱུྃ".

To fix this, we do the following:

1. Remove the explicit clipping call at rendering.

2. Fix partial redraw to not lead to clipping / corruption. This is
   quite tricky, because let's say we have a character that is tall
   enough to touch other lines, if those lines are redraw but not the
   line with the tall char, the redraw will paint over the parts of the
   glyphs poking through. Alternatively if we redraw the line with the
   tall chars we also need to expand the redraw region to make sure
   other lines get repainted as well. To fix this properly, we should do
   a proper glyph calculation when we receive the draw command before we
   issue before we call `setNeedsDisplayInRect`, but since right now we
   only extract glyph info later (during drawRect call), it's too late.
   We just do the hacky solution by storing a variable
   `redrawExpandRows` that tracks how many lines to expand for all
   lines. It's a little hacky since this will affect all lines
   permanently regardless if they have tall characters or not. The
   proper fix may come later as an optimization (or when we do hardware
   rendering via Metal).

3. Re-order the rendering so we have a two pass system, where we first
   draw the background fill color for all rows, then the text. This
   helps prevent things like Vim's window split or cursorline from
   obscuring the text.

4. Add a preference to turn on clipping (old behavior). This helps
   prevent odd issues with really tall texts (e.g. Zalgo text) making it
   hard to see what's going on. The preference `MMRendererClipToRow` is
   not exposed in UI for now as it's a relatively niche. It will be
   exposed later when we have a dedicated render tab in settings.

Note that a lot of these characters only show their full height by doing
`set maxcombine=8` because the default (2) is quite low.

Part of the fix for #995
2023-01-29 16:10:16 -08:00
..
2022-06-28 13:44:46 +01:00
2022-12-06 18:20:10 +00:00
2022-11-18 21:49:57 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-09-27 17:30:34 +01:00
2022-12-31 15:30:45 +00:00
2022-11-23 23:46:31 +00:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-12-06 18:20:10 +00:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-08-26 18:01:12 +01:00
2021-06-27 15:18:56 +02:00
2022-02-26 12:25:45 +00:00
2022-10-28 20:47:54 +01:00
2022-07-25 15:42:07 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-10-16 13:11:12 +01:00
2022-11-23 23:46:31 +00:00
2022-11-23 23:46:31 +00:00
2023-01-09 20:12:45 +00:00
2022-06-28 13:44:46 +01:00
2022-10-28 20:47:54 +01:00
2022-09-18 13:04:22 +01:00
2022-09-27 17:30:34 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-12-06 18:20:10 +00:00
2022-12-06 18:20:10 +00:00
2022-09-18 13:04:22 +01:00
2022-09-27 17:30:34 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-07-25 15:42:07 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2022-10-28 20:47:54 +01:00
2022-10-16 13:11:12 +01:00
2022-10-03 18:04:35 +01:00
2022-12-11 15:53:04 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-10-16 13:11:12 +01:00
2022-10-16 13:11:12 +01:00
2022-06-28 13:44:46 +01:00
2022-10-28 20:47:54 +01:00
2022-12-31 15:30:45 +00:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2022-09-10 13:13:14 +01:00
2023-01-09 20:12:45 +00:00
2022-11-18 21:49:57 +00:00
2022-12-31 15:30:45 +00:00
2022-12-31 15:30:45 +00:00
2022-11-23 23:46:31 +00:00
2023-01-09 20:12:45 +00:00
2022-06-28 13:44:46 +01:00
2022-07-25 15:42:07 +01:00
2023-01-09 20:12:45 +00:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-10-16 13:11:12 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-09 21:21:04 +00:00
2022-06-28 13:44:46 +01:00
2022-06-28 13:44:46 +01:00
2022-11-23 23:46:31 +00:00
2022-06-28 13:44:46 +01:00
2022-12-11 15:53:04 +00:00
2023-01-09 20:12:45 +00:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2022-02-20 19:48:20 +00:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2020-07-26 17:00:44 +02:00
2022-01-23 12:07:04 +00:00
2022-01-23 12:07:04 +00:00
2022-01-16 14:46:06 +00:00
2021-06-13 19:02:49 +02:00
2021-06-13 19:02:49 +02:00
2022-12-06 18:20:10 +00:00
2022-06-28 13:44:46 +01:00
2021-12-05 21:54:04 +00:00
2021-12-05 21:54:04 +00:00
2022-01-16 14:46:06 +00:00
2022-07-01 18:45:04 +01:00