You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public static final Font aplFont;
static {
try {
aplFont = Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(IDE.class.getResourceAsStream("/APL385.ttf"))).deriveFont(Font.BOLD, 15f);
} catch (FontFormatException | IOException e) {
throw new RuntimeException(e);
}
}
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 type RESERVED_WORD.
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?
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
The text was updated successfully, but these errors were encountered: