Solved

What fonts can I use in a Java application?

Posted on 2006-07-08
9
263 Views
Last Modified: 2013-12-03
If I want my java application to run on a Windows box or a Unix box, What fonts can I use with Java such that I can be guaranteed of the font’s availability on all target operating systems?  Will Java allow me to define and use any font?  Or is there a list of fonts that I have to use with Java?  (Or per target operating system?)

Note that this will run locally on the machine - this will not be an applet or web-based program.
0
Comment
Question by:stev0931
  • 4
  • 3
  • 2
9 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 17065506
I always restrict myself to Arial Times and Courier.
That's enough for me and safe.
;JOOP!
0
 

Author Comment

by:stev0931
ID: 17065522
This doesn't really answer my question.  I need more than 2 fonts and need to know what fonts I have to choose from.
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17065583
Those were 3; for the rest ... I am sorry.

;JOOP!
0
 

Author Comment

by:stev0931
ID: 17065594
Must have hit the wrong key on the board.  
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 26

Accepted Solution

by:
ksivananth earned 125 total points
ID: 17066386
Font fonts[] = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();

will return all the fonts installed in the system!
0
 

Author Comment

by:stev0931
ID: 17066394
Great!  Thanks!
0
 
LVL 26

Expert Comment

by:ksivananth
ID: 17066396
then you can decide which font to use based on the availability!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17067190
Just a note: I cross develop between LINUX and MSWindows.
I found that equal named fonts sometimes look very different on both systems.
Further, the size might be unexpectedly different when you think texts will fit.
I have to test all my GUI stuff again and again.
I was told that all this trouble comes from the patenting of some fonts and display techniques
by Adobe. True? We surely suffer.
That's why I restricted my font choice.
;JOOP!
0
 

Author Comment

by:stev0931
ID: 17068317
That helps, thanks!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now