Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

JRE included fonts



All,

 

I am new to Java development on the Mac, so I hope that this question has a simple answer and I am just overlooking something that is obvious to those who are more experienced.

 

I have created a simple test case to illustrate my issue.  Essentially, it seems that the jre is not picking the correct font when I specify one of the fonts included with the jre in a JEditorPane, and that font I choose is not Lucida Sans (e.g. when I’ve chosen Lucida Sans Typewriter or Lucida Bright).  I have tested this under Windows and do not observe this behavior.  One of my co-workers did diffs on the ttf files on both platforms to verify that the Windows fonts are the same as installed on the Mac (they are).

 

The test case below creates 2 JEditorPanes, sets the font of one to Lucida Sans and the other to Lucida Sans Typewriter, adds text to each, and displays both JEditorPanes in a JFrame.  On the Mac, I see both panes using Lucida Sans.  On Windows, I see the panes using the fonts as specified.

 

I’m running 1.4.2_05.  Any help would be much appreciated.

-David Mikesell

 

Test case:

import java.awt.BorderLayout;

import java.awt.Font;

 

import javax.swing.JEditorPane;

import javax.swing.JFrame;

 

public class TextPaneComparison {

 

    public static void main(String[] args) {

        JFrame frame = new JFrame();

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JEditorPane p1 = new JEditorPane();

        p1.setFont(new Font("Lucida Sans Typewriter", Font.PLAIN, 24));

        p1.setText("Lucida Sans Typewriter abcdefghijklmnopqrstuvwxyz");

        JEditorPane p2 = new JEditorPane();

        p2.setFont(new Font("Lucida Sans", Font.PLAIN, 24));

        p2.setText("Lucida Sans abcdefghijklmnopqrstuvwxyz");

        frame.getContentPane().add(p1, BorderLayout.NORTH);

        frame.getContentPane().add(p2, BorderLayout.CENTER);

        frame.setSize(600,100);

        frame.show();

    }

}


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.806 / Virus Database: 548 - Release Date: 12/5/2004

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.