title: Java: using deriveFont does not change font size
body: <p>I am loading a custom font (from ttf file) into my project, and using deriveFont(float f) to change the size. However, the size is not actually being set (stuck at 1). Here is my code:</p>
  
  <pre><code>public static void main(String[] args) {
      GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
      try {
          Font mont =
                  Font.createFont(
                          Font.TRUETYPE_FONT,
                          new File(System.getProperty("user.dir") + "/data/Montserrat-MediumItalic.ttf"))
                          .deriveFont(20f);
          ge.registerFont(mont);
  
          Arrays.stream(ge.getAllFonts())
                  .filter(font -&gt; font.getFontName().contains("Mont"))
                  .forEach(font -&gt; System.out.println(font.getFontName() + ", Size: " + font.getSize()));
  
      } catch (FontFormatException | IOException e) {
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>output:
  <code>Montserrat Medium Italic, Size: 1</code></p>
  
  <p>note: replacing <code>font.getSize()</code> with <code>font.getSize2D</code> prints <code>1.0</code>.</p>
  
  <p>New: Using decode:</p>
  
  <p>I am now using this </p>
  
  <pre><code>Font test = Font.decode("Montserrat Medium Italic-ITALIC-20");
  </code></pre>
  
  <p>(fixed class not loading)</p>
  
  <p>Update 2:</p>
  
  <p>this line:
  <code>Font mont = Font.createFont(Font.ITALIC, new File(System.getProperty("user.dir") + "/data/Montserrat-MediumItalic.ttf"));
  </code>
  throws <code>IllegalArgumentException: font format not recognized</code></p>