From 905cba8ab7b1b7838638b69092b66b64f3c954ac Mon Sep 17 00:00:00 2001 From: Brendan Robert Date: Sun, 29 Mar 2015 00:31:55 -0500 Subject: [PATCH] Only load font when needed -- this allows the emulator to be more embeddable as a headless appliance --- src/main/java/jace/core/Font.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/jace/core/Font.java b/src/main/java/jace/core/Font.java index 67d57e5..3225982 100644 --- a/src/main/java/jace/core/Font.java +++ b/src/main/java/jace/core/Font.java @@ -30,11 +30,17 @@ import javax.imageio.ImageIO; */ public class Font { static public int[][] font; + static public boolean initialized = false; static public int getByte(int c, int yOffset) { + if (!initialized) { + initalize(); + } return font[c][yOffset]; } - static { + + private static void initalize() { font = new int[256][8]; + initialized = true; try { InputStream in = ClassLoader.getSystemResourceAsStream("jace/data/font.gif"); BufferedImage fontImage = ImageIO.read(in);