Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Font differs from Windows and Linux ?

 
Jhun Hoon
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic