-
Notifications
You must be signed in to change notification settings - Fork 41
Description
Hi, I'm completely at a loss.
I have a bit of a weird setup, that being integrating skia into the Minecraft renderer. Everything seems to work, but text refuses to work properly. Depending on the TypeFace instance, the text being drawn is either clipped (with no clip being present!), fully visible or not visible at all. An example:
As mentioned, the clipping is dependent on which TypeFace instance I use. Reloading the screen changes how much is clipped, if anything. Note that the actual font isn't being changed, the instance is just remade.
This happens with local fonts, as well as system fonts. All TTF. Even checked with the JB Mono font from the examples directory, that also has the problem.
My code so far:
// Init:
Typeface tf = Typeface.makeFromFile("/absolute/path/to/JetBrainsMono-Regular.ttf");
// At render:
Paint whitePaint = new Paint().setColor(0xFFFFFFFF);
try (Font font = new Font(tf, 32, 1, 0)) {
font.setEdging(FontEdging.ANTI_ALIAS);
canvas.clear(0xFFFF0000); // Fills the entire screen; Clip is not present
canvas.drawString("hello??", 100, 200, font, whitePaint); // Cut off?
}
Caching the Font has the same effect.
Weirdly enough, the examples work for me, and text there renders properly.
This is probably an issue with my code, but I've tried for the past 2 hours to get it working, and my only real hope is that someone here has experienced a similar issue and can share their experience.
Thanks