title: How to embed .ttf fonts in JavaFx 2.2?
body: <p>Firstly, I am quite a new guy in coding. I need to embed a font in my java FXML-based app and don't know how to do it. I have pasted the font, <code>fontName.ttf</code> in a &quot;resources&quot; folder in the root of the sources of my project, ie <code>App/src/app/resources</code>. I have set the CSS for the component (text) as</p>
  <pre><code>#text {
      -fx-font-family: url(resources/fontName.ttf);
  }
  </code></pre>
  <p>I have also tried adding inverted commas in the url, ie <code>url(&quot;resources/fontName.ttf&quot;);</code>, but it doesn't work. I have also set the CSS id for the component, so that can't be the problem. Is there any other working way to do so? I have seen <a href="http://fxexperience.com/2010/05/how-to-embed-fonts/" rel="nofollow noreferrer">http://fxexperience.com/2010/05/how-to-embed-fonts/</a>, but it doesn't work since I have JDK 1.7 u21. Any ideas for a correct way to embed fonts?</p>