From fa7ff74fec41344fc00d16af875ac78e3eff99a5 Mon Sep 17 00:00:00 2001 From: Death Fuel <108496936+DeathFuel@users.noreply.github.com> Date: Wed, 29 Oct 2025 15:57:41 +0100 Subject: [PATCH] make an exception for the splash screen (#1069) --- .../client/font/BatchingFontRenderer.java | 24 ++++++++++++------- .../angelica/client/font/FontStrategist.java | 8 +++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java b/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java index d39d4df1f..256cb179a 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/BatchingFontRenderer.java @@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableSet; import com.gtnewhorizons.angelica.config.FontConfig; import com.gtnewhorizons.angelica.glsm.GLStateManager; import com.gtnewhorizons.angelica.mixins.interfaces.FontRendererAccessor; +import cpw.mods.fml.client.SplashProgress; import it.unimi.dsi.fastutil.objects.ObjectArrayList; import net.coderbot.iris.gl.program.Program; import net.coderbot.iris.gl.program.ProgramBuilder; @@ -50,7 +51,8 @@ public class BatchingFontRenderer { private final int texBoundAttrLocation; private final int fontShaderId; - private final boolean isSGA; + final boolean isSGA; + final boolean isSplash; private static class FontAAShader { @@ -85,6 +87,8 @@ public class BatchingFontRenderer { } this.isSGA = Objects.equals(this.locationFontTexture.getResourcePath(), "textures/font/ascii_sga.png"); + // noinspection deprecation + this.isSplash = underlying instanceof SplashProgress.SplashFontRenderer; FontProviderMC.get(this.isSGA).charWidth = this.charWidth; FontProviderMC.get(this.isSGA).locationFontTexture = this.locationFontTexture; @@ -351,24 +355,28 @@ public class BatchingFontRenderer { return (what >= fromInclusive) && (what <= toInclusive); } + public boolean forceDefaults() { + return this.isSGA || this.isSplash; + } + public float getGlyphScaleX() { - return this.isSGA ? 1 : (float) (FontConfig.glyphScale * Math.pow(2, FontConfig.glyphAspect)) * (FontStrategist.customFontInUse ? 1.5f : 1); + return forceDefaults() ? 1 : (float) (FontConfig.glyphScale * Math.pow(2, FontConfig.glyphAspect)) * (FontStrategist.customFontInUse ? 1.5f : 1); } public float getGlyphScaleY() { - return this.isSGA ? 1 : (float) (FontConfig.glyphScale / Math.pow(2, FontConfig.glyphAspect)) * (FontStrategist.customFontInUse ? 1.5f : 1); + return forceDefaults() ? 1 : (float) (FontConfig.glyphScale / Math.pow(2, FontConfig.glyphAspect)) * (FontStrategist.customFontInUse ? 1.5f : 1); } public float getGlyphSpacing() { - return (this.isSGA ? 1 : FontConfig.glyphSpacing); + return forceDefaults() ? 0 : FontConfig.glyphSpacing; } public float getWhitespaceScale() { - return (this.isSGA ? 1 : FontConfig.whitespaceScale); + return forceDefaults() ? 1 : FontConfig.whitespaceScale; } public float getShadowOffset() { - return (this.isSGA ? 1 : FontConfig.fontShadowOffset); + return forceDefaults() ? 1 : FontConfig.fontShadowOffset; } private static final char FORMATTING_CHAR = 167; // ยง @@ -483,7 +491,7 @@ public class BatchingFontRenderer { chr = FontProviderMC.get(this.isSGA).getRandomReplacement(chr); } - FontProvider fontProvider = FontStrategist.getFontProvider(chr, this.isSGA, FontConfig.enableCustomFont, unicodeFlag); + FontProvider fontProvider = FontStrategist.getFontProvider(this, chr, FontConfig.enableCustomFont, unicodeFlag); // Check ASCII space, NBSP, NNBSP if (chr == ' ' || chr == '\u00A0' || chr == '\u202F') { @@ -576,7 +584,7 @@ public class BatchingFontRenderer { return 4 * this.getWhitespaceScale(); } - FontProvider fp = FontStrategist.getFontProvider(chr, isSGA, FontConfig.enableCustomFont, underlying.getUnicodeFlag()); + FontProvider fp = FontStrategist.getFontProvider(this, chr, FontConfig.enableCustomFont, underlying.getUnicodeFlag()); return fp.getXAdvance(chr) * this.getGlyphScaleX(); } diff --git a/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java b/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java index 3134095fb..933809bc1 100644 --- a/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java +++ b/src/main/java/com/gtnewhorizons/angelica/client/font/FontStrategist.java @@ -85,13 +85,13 @@ public class FontStrategist { /** Lets you get a FontProvider per char while respecting font priority and fallbacks, the unicode flag, whether or not - SGA is on, if a font can even display a character in the first place, etc. + SGA is on, if we're in a splash screen, if a font can even display a character in the first place, etc. */ - public static FontProvider getFontProvider(char chr, boolean isSGA, boolean customFontEnabled, boolean forceUnicode) { - if (isSGA && FontProviderMC.get(true).isGlyphAvailable(chr)) { + public static FontProvider getFontProvider(BatchingFontRenderer me, char chr, boolean customFontEnabled, boolean forceUnicode) { + if (me.isSGA && FontProviderMC.get(true).isGlyphAvailable(chr)) { return FontProviderMC.get(true); } - if (customFontEnabled) { + if (customFontEnabled && !me.isSplash) { FontProvider fp; fp = FontProviderCustom.getPrimary(); if (fp.isGlyphAvailable(chr)) { return fp; }