From a12dcc9fa478adf8960af1021689f548e93a9444 Mon Sep 17 00:00:00 2001 From: Vincenzo Palazzo Date: Fri, 1 Mar 2019 17:28:08 +0100 Subject: [PATCH] Fix bug for loading font with windows 10 damn windows :) --- src/mdlaf/utils/MaterialFontFactory.java | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/mdlaf/utils/MaterialFontFactory.java b/src/mdlaf/utils/MaterialFontFactory.java index 5200dea..b2246ef 100644 --- a/src/mdlaf/utils/MaterialFontFactory.java +++ b/src/mdlaf/utils/MaterialFontFactory.java @@ -51,21 +51,23 @@ private MaterialFontFactory() { private void loadOsPropries() throws IOException { String os = System.getProperty("os.name", "generic").toLowerCase(); - String pathProperties = "/resources/config/font-" + os + ".properties"; - if (isOsSupportted(os)) { + System.out.print(os); + String osSupport = isOsSupportted(os); + if (osSupport != null) { + String pathProperties = "/resources/config/font-" + osSupport + ".properties"; properties.load(getClass().getResourceAsStream(pathProperties)); return; } - properties.load(getClass().getResourceAsStream("resources/config/font-linux.properties")); + properties.load(getClass().getResourceAsStream("/resources/config/font-linux.properties")); } - private boolean isOsSupportted(String os) { + private String isOsSupportted(String os) { for (int i = 0; i < SISTEM_SUPPORTED.length; i++) { - if (os.equals(SISTEM_SUPPORTED[i])) { - return true; + if (os.contains(SISTEM_SUPPORTED[i])) { + return SISTEM_SUPPORTED[i]; } } - return false; + return null; } public Font getFont(String typeFont){