install fontconfig - docker

This commit is contained in:
Lee 2024-04-20 20:23:04 +01:00
parent c5b5b3b105
commit f664406299
3 changed files with 7 additions and 1 deletions

@ -1,5 +1,7 @@
FROM maven:3.8.5-openjdk-17-slim FROM maven:3.8.5-openjdk-17-slim
RUN apt install fontconfig -y
# Set the working directory # Set the working directory
WORKDIR /home/container WORKDIR /home/container

@ -1,11 +1,13 @@
package xyz.mcutils.backend.common; package xyz.mcutils.backend.common;
import lombok.extern.log4j.Log4j2;
import xyz.mcutils.backend.Main; import xyz.mcutils.backend.Main;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@Log4j2(topic = "Fonts")
public class Fonts { public class Fonts {
public static final Font MINECRAFT; public static final Font MINECRAFT;
@ -17,7 +19,8 @@ public class Fonts {
MINECRAFT = Font.createFont(Font.TRUETYPE_FONT, stream).deriveFont(18f); MINECRAFT = Font.createFont(Font.TRUETYPE_FONT, stream).deriveFont(18f);
MINECRAFT_BOLD = MINECRAFT.deriveFont(Font.BOLD); MINECRAFT_BOLD = MINECRAFT.deriveFont(Font.BOLD);
} catch (FontFormatException | IOException e) { } catch (FontFormatException | IOException e) {
throw new RuntimeException(e); log.error("Failed to load Minecraft font", e);
throw new RuntimeException("Failed to load Minecraft font", e);
} }
} }
} }

@ -18,6 +18,7 @@ import java.io.ByteArrayInputStream;
@Log4j2 @Log4j2
public class ServerPreviewRenderer extends Renderer<MinecraftServer> { public class ServerPreviewRenderer extends Renderer<MinecraftServer> {
public static final ServerPreviewRenderer INSTANCE = new ServerPreviewRenderer(); public static final ServerPreviewRenderer INSTANCE = new ServerPreviewRenderer();
private static BufferedImage SERVER_BACKGROUND; private static BufferedImage SERVER_BACKGROUND;
private static BufferedImage PING_ICON; private static BufferedImage PING_ICON;
static { static {