From 276b3e08e5e831c2a59592d578a7bd5a03ea9741 Mon Sep 17 00:00:00 2001 From: Brent <90901032@westernsydney.edu.au> Date: Thu, 7 Sep 2023 11:13:15 +1000 Subject: [PATCH] Bug --- .../VASSAL/build/module/font/VassalFont.java | 2 +- .../BeanShellExpressionConfigurer.java | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/vassal-app/src/main/java/VASSAL/build/module/font/VassalFont.java b/vassal-app/src/main/java/VASSAL/build/module/font/VassalFont.java index 784e29578e..b99ac3ff90 100644 --- a/vassal-app/src/main/java/VASSAL/build/module/font/VassalFont.java +++ b/vassal-app/src/main/java/VASSAL/build/module/font/VassalFont.java @@ -81,7 +81,7 @@ public VassalFont(String fontFileName) { URL url = null; try { final String fileName = "/fonts/JetBrainsMono.ttf"; - logger.warn("Build URL for mono"); + logger.warn("Build URL for mono, classloader = " + getClass().getClassLoader()); url = getClass().getResource(fileName); logger.warn("URL built"); Font.createFont(Font.TRUETYPE_FONT, url.openStream()); diff --git a/vassal-app/src/main/java/VASSAL/configure/BeanShellExpressionConfigurer.java b/vassal-app/src/main/java/VASSAL/configure/BeanShellExpressionConfigurer.java index d494580cbc..c576ce5620 100644 --- a/vassal-app/src/main/java/VASSAL/configure/BeanShellExpressionConfigurer.java +++ b/vassal-app/src/main/java/VASSAL/configure/BeanShellExpressionConfigurer.java @@ -29,6 +29,8 @@ import bsh.BeanShellExpressionValidator; import net.miginfocom.swing.MigLayout; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -54,6 +56,7 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.image.BufferedImage; +import java.net.URL; import java.util.List; /** @@ -61,6 +64,8 @@ */ public class BeanShellExpressionConfigurer extends StringConfigurer { + private static final Logger logger = LoggerFactory.getLogger(BeanShellExpressionConfigurer.class); + /** * enum describing any special processing that needs to be done for particular expression types * @@ -220,6 +225,22 @@ public Component getControls() { nameField.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, null); nameField.setText(getValueString()); + + + try { + final String fileName = "/fonts/JetBrainsMono.ttf"; + + logger.warn("Build URL for mono, classloader = " + getClass().getClassLoader()); + final URL url = getClass().getResource(fileName); + logger.warn("URL built"); + final Font ms = Font.createFont(Font.TRUETYPE_FONT, url.openStream()); + logger.warn("Font built"); + nameField.setFont(ms.deriveFont(Font.PLAIN, 14)); + } + catch (Exception e) { + logger.warn("Mono load exception: " + e.getMessage()); + } + panel.add(nameField, "grow"); //NON-NLS nameField.addKeyListener(new KeyAdapter() { @Override