Technology musings
September 2004

Fun With the JVM

Companies like Microsoft have been the target of a lot of criticism lately. This is not completely without merit. Microsoft is guilty of a few dirty deeds. Among the relevant matters, the XP look and feel (crayon, as I like to call it) seems to play funny tricks with JButtons and JComboBox. Even in the MetalLookAndFeel, which was supposed to remain consistent across platforms, this funny business still occurs. Microsoft is not alone this time.

There is a font folder that ships with Java. This is intended to be a safe place for the JVM (Java Virtual Machine) to pick up standard fonts while not disturbing the sacred font folders of Desktop Publishing systems. The problem with Apple’s implementation is that the JVM does not look here. The call for fonts is made to the system, in native code, and the OS returns the desired font.In speaking with some members of the Sun/Java team I learned that Apple was pulling a few tricks of their own. It seems that in order to make Java applications look more like a native application, Apple was playing the Look and Feel game.

If you read the previous post (Mac Font Musings) you know of another issue that pertains to fonts. A long standing practice of removing fonts from Desktop Publishing machines wreaks havoc on the system, as well as the JVM. Since the JVM passes it’s font calls to the system, how would the system handle a missing font? To my horror I found out how.

We have all seen the LastResort font on our Macs at one point or another. What I’m sure most of you have not seen is that Helvetica is a default font for the JVM. The Native Code that returns fonts to the JVM has a hardcoded value to return Helvetica if a requested font does not exist. What happens when Helvetica has been removed? If Helvetica has been removed from the system, you are treated to all the stack traces you care to read in the Application Crash Log.

I don’t mean to make light of the work that the Apple Java team does. I’ve had a chance to meet and converse with several of them. They are all very nice, highly intelligent people. I’m sure that some of the Look and Feel madness has been handed to them from up above. I know all about company policy and mandates.

Apple does have a good system setup for bug reporting and enhancement requests. I have contributed to both systems and have always received a courteous, knowledgeable response.

In closing I must repeat the oft heard phrase, “Write once, test everywhere”.

Tagged with: ,
No Comments

Leave a Reply

Your email address will not be published.