title: Javafx font derive bold
body: <p>I wanted to change a (loaded) text font dinamically for my javafx application, so I did this code:</p>
  
  <pre><code>Font font = Font.loadFont(Fonts.class.getClassLoader().getResource("path/font.woff").toExternalForm(), 25);
  Font bold = Font.font(font.getFamily(), FontWeight.BOLD, font.getSize());
  Font italic = Font.font(font.getFamily(), FontPosture.ITALIC, font.getSize());
  Font boldItalic = Font.font(font.getFamily(), FontWeight.BOLD, FontPosture.ITALIC, font.getSize());
  </code></pre>
  
  <p>but when I try to change the text font to bold or italic nothing changes, and I don't seem to locate some method like the one in java.awt.Font#deriveFont where you could derive italic or bold from another font.<br>
  Code to apply the font: </p>
  
  <pre><code>public void applyFont(javafx.scene.text.Text text) {
      text.setFont(font);
  }
  </code></pre>
  
  <p>EDIT: More log:<br>
  I put some log that says what font is he getting and prints the Font#toString() result:</p>
  
  <pre><code>getFont(bold=false, italic=false) -&gt; Font[name=&lt;Name&gt; Regular, family=&lt;Name&gt;, style=Regular, size=25.0]
  getFont(bold=true, italic=false) -&gt; Font[name=&lt;Name&gt; Regular, family=&lt;Name&gt;, style=Regular, size=25.0]
  getFont(bold=false, italic=true) -&gt; Font[name=&lt;Name&gt; Regular, family=&lt;Name&gt;, style=Regular, size=25.0]
  getFont(bold=true, italic=true) -&gt; Font[name=&lt;Name&gt; Regular, family=&lt;Name&gt;, style=Regular, size=25.0]
  </code></pre>
  
  <p>But if I replace the first line of code in the font loading with</p>
  
  <pre><code>font = Font.font(null, 25);//get the system's default font
  </code></pre>
  
  <p>It works and I get this output:</p>
  
  <pre><code>getFont(bold=false, italic=false) -&gt; Font[name=System Regular, family=System, style=Regular, size=25.0]
  getFont(bold=true, italic=false) -&gt; Font[name=System Bold, family=System, style=Bold, size=25.0]
  getFont(bold=false, italic=true) -&gt; Font[name=System Italic, family=System, style=Italic, size=25.0]
  getFont(bold=true, italic=true) -&gt; Font[name=System Bold Italic, family=System, style=Bold Italic, size=25.0]
  </code></pre>