Posted March 14, 20223 yr Hey there. For my custom gui/screen, I'm wanting to print a String to the screen. I'm doing that like so: AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color); It's working, but the text is incredibly small (this probably has to do with the game settings option for gui scale. Is there any way I can actually increase the font size or even just 'scale' the string? I've tried both the following right before making the AbstractGui#drawString call and neither worked: matrixStack.scale(2.f, 2.f, 2.f); GL13.glScalef(2.f, 2.f, 2.f); Any help would be appreciated! Thanks!
March 14, 20223 yr Author Sure thing. So in my custom screen class, here's all the logic related to printing to the screen: //Ensure screen always takes up the same amount of 'screen space' regardless of gui scale setting final float scale = 1.f / guiScale; pMatrixStack.scale(scale, scale, scale); //Create screen texture AbstractGui.blit(pMatrixStack, pos.x(), pos.y(), 0, start.x(), start.y(), dimensions.x(), dimensions.y(), textureSize.y(), textureSize.x()); //Then call the string render render(pMatrixStack, x, y); Here's the string render method: public void render(final MatrixStack matrixStack, final int x, final int y) { matrixStack.scale(2.f, 2.f, 2.f); AbstractGui.drawString(matrixStack, Minecraft.getInstance().font, "Test String", x, y, this.color); } All of this technically works, except for the string size being scaled at the end. My best guess is that perhaps I need to push or pop or flush or do something to the MatrixStack after the AbstractGui#blit call (of which I'll test right now --- unfortunately push and pop didn't solve the problem). Edited March 14, 20223 yr by Jimmeh Edit
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.