including fonts in Java : Java Glossary


including fonts in Java

Java AWT (Advanced Windowing Toolkit) apps can access five basic logical fonts. Java Swing apps can access any fonts already installed. You can use web fonts in your web apps but how do you include special fonts with your desktop apps or Applets?

  1. Check your font licence to make sure you are allowed to bundle them into your app. Usually free fonts permit you to and pay fonts do not without paying an extra fee.
  2. Bundle the font, usually OpenType format, into the distributable jar as a resource.
  3. Load the resource with getResourceAsStream.
  4. Use Font.createFont to convert the resource to a 1-point Font.
  5. Use Font.deriveFont to convert that tiny Font to the pointsize you need.
Fontspring: flat rates for fonts for desktop, web, ebooks, apps
Google free webfonts: work in your website
logical fonts
web fonts

This page is posted
on the web at:

Optional Replicator mirror
on local hard disk J:

Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.

Your face IP:[]
You are visitor number