title: Java Load Custom Font File (.ttf)
body: <p>I have used this code below, and it comes up with this stack trace:</p>
  
  <pre><code>java.io.FileNotFoundException: font.ttf (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:101)
      at com.ominious.core.graphics.Assets.getFont(Assets.java:55)
      at com.ominious.core.graphics.Assets.loadImages(Assets.java:37)
      at com.ominious.core.GamePanel.init(GamePanel.java:63)
      at com.ominious.core.GamePanel.run(GamePanel.java:69)
      at java.lang.Thread.run(Thread.java:744)
  Exception in thread "Thread-1" java.lang.NullPointerException
      at com.ominious.core.graphics.Assets.loadImages(Assets.java:49)
      at com.ominious.core.GamePanel.init(GamePanel.java:63)
      at com.ominious.core.GamePanel.run(GamePanel.java:69)
      at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>I use this code (I call the method in a resource file that I know works)</p>
  
  <pre><code>    private static Font getFont(String name) throws Exception {
  
      Font font = Font.createFont(Font.TRUETYPE_FONT, new FileInputStream(name));
  
      return font;
  }
  </code></pre>
  
  <p>And I call it here:</p>
  
  <pre><code>try {
          FONT = getFont("font.ttf");
  
          tileSprites = ImageIO.read(getClass().getResourceAsStream("/mom.gif"));
  
          SPLASH_BACKGROUND = ImageIO.read(getClass().getResourceAsStream("/swag.gif"));
  
      } catch (Exception e) {
          Game.logger.log(LogType.ERROR_STACKTRACE);
  
          e.printStackTrace();
      }
  </code></pre>
  
  <p>(The class above works, my image loads)</p>
  
  <p>Is there a reason why this doesn't work? Is there a better method? (And yes, I do have it in my directory)</p>