Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Font differs from Windows and Linux ?  RSS feed

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
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...
author and iconoclast
Posts: 24220
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.
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!