• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I include a custom font in a NetBean project?

 
Daniel Gallant
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So, here is the situation, I have a project in NetBeans and I want to include a custom font used by the application.

How would I include this font in the jar so that it was included automatically on the client system?

Thanks!
 
Daniel Gallant
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After a little more Google-Foo, I have found the answer:

http://java.sun.com/j2se/1.3/docs/guide/intl/addingfonts.html

In a nutshell:

Physical font files can be installed in either an operating system's standard location for fonts or in the jre/lib/fonts library of the Java 2 SDK (or in the lib/fonts directory of the Java 2 Runtime Environment). Fonts in either the operating system's standard location or in the lib/font directory will be on the Java runtime's "font path" and can be used by applications and applets.

So, to get this, I need to use FontPath (http://www.davisor.com/offisor-docs/api/com/davisor/font/FontPath.html).

I hope this helps others.
 
Campbell Ritchie
Sheriff
Posts: 51349
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well done, sorting it out.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15627
46
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that your link points to the documentation of an old version of Java (1.3), the same docs for Java 6 can be found here:
http://java.sun.com/javase/6/docs/technotes/guides/intl/font.html (part of the docs about internationalization support)

(although I think that not much has changed with regard to this subject).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic