From f664406299addbedcca83aa02abf19568a7ba1d7 Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 20 Apr 2024 20:23:04 +0100 Subject: [PATCH] install fontconfig - docker --- Dockerfile | 2 ++ src/main/java/xyz/mcutils/backend/common/Fonts.java | 5 ++++- .../common/renderer/impl/server/ServerPreviewRenderer.java | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9b9ff94..c310adc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ FROM maven:3.8.5-openjdk-17-slim +RUN apt install fontconfig -y + # Set the working directory WORKDIR /home/container diff --git a/src/main/java/xyz/mcutils/backend/common/Fonts.java b/src/main/java/xyz/mcutils/backend/common/Fonts.java index 216aab2..f5b7715 100644 --- a/src/main/java/xyz/mcutils/backend/common/Fonts.java +++ b/src/main/java/xyz/mcutils/backend/common/Fonts.java @@ -1,11 +1,13 @@ package xyz.mcutils.backend.common; +import lombok.extern.log4j.Log4j2; import xyz.mcutils.backend.Main; import java.awt.*; import java.io.IOException; import java.io.InputStream; +@Log4j2(topic = "Fonts") public class Fonts { public static final Font MINECRAFT; @@ -17,7 +19,8 @@ public class Fonts { MINECRAFT = Font.createFont(Font.TRUETYPE_FONT, stream).deriveFont(18f); MINECRAFT_BOLD = MINECRAFT.deriveFont(Font.BOLD); } 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); } } } diff --git a/src/main/java/xyz/mcutils/backend/common/renderer/impl/server/ServerPreviewRenderer.java b/src/main/java/xyz/mcutils/backend/common/renderer/impl/server/ServerPreviewRenderer.java index f4761a4..b0ad17e 100644 --- a/src/main/java/xyz/mcutils/backend/common/renderer/impl/server/ServerPreviewRenderer.java +++ b/src/main/java/xyz/mcutils/backend/common/renderer/impl/server/ServerPreviewRenderer.java @@ -18,6 +18,7 @@ import java.io.ByteArrayInputStream; @Log4j2 public class ServerPreviewRenderer extends Renderer { public static final ServerPreviewRenderer INSTANCE = new ServerPreviewRenderer(); + private static BufferedImage SERVER_BACKGROUND; private static BufferedImage PING_ICON; static {