title: How to set a custom font's size and other attributes (bold, italic, etc) in Java SWING
body: <p>Usually, when I initialize the fonts I want to use in my SWING applications, I do it this way:</p>
  
  <pre><code>public static final Font TITLEFONT = new Font("Calibri", Font.BOLD, 40);
  </code></pre>
  
  <p>Now, I have to do it a bit differently since I'm using some custom fonts from a .ttf file. I initialize the font this way:</p>
  
  <pre><code>try
  {
      InputStream is = OptionsValues.class.getResourceAsStream("fonts//KOMIKAX_.ttf");
      TITLEFONT = Font.createFont(Font.TRUETYPE_FONT, is);
  }
  catch (Exception ex)
  {
      ex.printStackTrace();
      System.err.println("Font not loaded.  Using Calibri font.");
      TITLEFONT = new Font("Calibri", Font.BOLD, 40);
  }
  </code></pre>
  
  <p>I'm pretty sure it initializes it correctly (I can't tell for sure since it is too small for me to see), but I'd like to know how I can manually set the font's size (and if it's bold / other attributes) when loading a font this way.</p>
  
  <p>Thanks a lot in advance!</p>