Open kspalaiologos opened 1 year ago
Originally discovered by https://github.com/mrbenjadmin - I do not use MacOS and am reporting the issue on his behalf.
What a cool issue! My first guess is macOS automatically uses a fallback font when glyphs can't be rendered. The text in the screenshots is clearly all 7-bit ASCII so my guess is it's not the codepoints themselves but has to do with TokenTypes.RESERVED_WORD
defaulting to bold whereas other token types don't. Not sure yet why other OS's wouldn't also use fallback fonts or show a placeholder char like the empty rectangle, but different OS's surely have different rendering engines, so maybe there's just some limitation in the macOS JVM's font rendering implementation?
Anyway I'll try to reproduce on my Macbook
@bobbylight I found a workaround!
Turns out that you have to reset the font in the styles, not only just call setFont on the RSTA:
scheme.restoreDefaults(IDE.aplFont, false);
It is incredibly weird that this issue manifested only in very specific circumstances, though.
I have implemented my own highlighter and style the text as follows:
Using the following font:
This is the result on MacOS:
This is the result on Debian Linux (OpenJDK 17, 18, 19 all work the same):
The problem is clear -
flt64:lerch-phi
is highlighted using a completely different font from the rest of the text area. Interestingly enough, this issue manifests itself only on MacOS, only with the token typeRESERVED_WORD
.The code: https://github.com/kspalaiologos/kamilalisp/tree/ide