File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Applets and the fly likes Font differs from Windows and Linux ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Font differs from Windows and Linux ?" Watch "Font differs from Windows and Linux ?" New topic

Font differs from Windows and Linux ?

Jhun Hoon

Joined: Nov 19, 2001
Posts: 28
Hi, i just want to ask, are fonts different from windows and linux in applet. I use a standard courier font.

For example, if i make an applet with courier font texts in linux, and make the texts wrap themselves, they will run ok in linux. But if i run the compiled applet in windows, the wrapped text somewhow got truncated.

But if i compile the applet in windows, it will look ok in linux and windows.

I've tried replacing my courier fonts in my /usr/java/jdk/jre/lib/fonts/cour*.ttf with the cour*.ttf from c:\windows\fonts with no effects .. Applets compiled and run ok in linux doesnt work in windows. They must be compiled in windows to run ok in both.

Why is that ?

Does the compilation use the fonts in the jdk lib or the system fonts ?

I'm so confused T_T

Please help
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
As far as I know this has absolutely nothing to do with the font.

Are you using Swing or AWT (or Other)? You did not mention how you draw text on the applet...

Remember, the AWT uses native components (inputboxes, dropdown lists, labels etc.) So if you're just using the AWT, you have two different operating systems trying to draw the same text using their OWN implementations. Which MIGHT be the source of your problems...

We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

WHere the class files are compiled will not affect how fonts are displayed; you must be mistaken. But where they are executed will, indeed, affect their appearance because fonts are different on the different machines. How font files are located can be a black art on Linux, so I'm not surprised that replacing the ones in the Java lib directory had no effect. In general, you need to design AWT applications to be tolerant of font differences across platforms.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Font differs from Windows and Linux ?
It's not a secret anymore!