| 286 | } |
| 287 | |
| 288 | public static Font loadFont(String fontName, double fontSize) { |
| 289 | if (fontName == null) { |
| 290 | return Font.loadFont("/resources/fonts/Roboto-Regular.ttf", fontSize); |
| 291 | } |
| 292 | |
| 293 | try { |
| 294 | java.net.URL fontUrl = Main.class.getResource(fontName); |
| 295 | if(fontUrl != null) { |
| 296 | return Font.loadFont(fontUrl.toExternalForm(), fontSize); |
| 297 | } else { |
| 298 | return Font.loadFont("file:" + fontName, fontSize); |
| 299 | } |
| 300 | |
| 301 | } catch(IllegalArgumentException | NullPointerException s) { |
| 302 | Logger.warn("\""+ fontName +"\" was not found. Using default font"); |
| 303 | return Font.loadFont("/resources/fonts/Roboto-Regular.ttf", fontSize); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | public static void preStartupCheck() { |
| 308 | File configFile = new File("./config.xml"); |