• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Font differs from Windows and Linux ?

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ice is for people that are not already cool. Chill with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic