Skip to content

Commit

Permalink
Fix bug for loading font with windows 10
Browse files Browse the repository at this point in the history
damn windows :)
  • Loading branch information
vincenzopalazzo committed Mar 1, 2019
1 parent 775c9ed commit a12dcc9
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/mdlaf/utils/MaterialFontFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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){
Expand Down

0 comments on commit a12dcc9

Please sign in to comment.