I’m using a custom font (Open Sans) in CodeMirror 6.
When the font finishes loading, the page layout is reflowed. After this reflow, the cursor rendered by drawSelection becomes incorrect (misaligned / visually abnormal).
This seems to be caused by the font metrics changing after the initial render, while drawSelection does not get properly updated to reflect the new layout.
The library was already listening to fonts.ready, but assuming nothing changed if content or line height stayed precisely the same. Attached patch improves this and, for me, fixes the issue in your reproduction HTML.
I know. The browser platform makes some things really hard. If you know of a non-terrible (i.e. no polling) way to reliably be notified of font changes, I’d love to hear about it.