-
Bug
-
Resolution: Fixed
-
P3
-
1.2.0
-
beta
-
x86
-
windows_nt
Name: tb29552 Date: 08/04/99
Java2 modified how fonts worked to allow access to locally installed true type fonts. I found that I can access all but the symbol style fonts. For instance I can access Tohoma or Century Gothic but I cannot access Webdings. The following code illustrates the problem:
/* Copyright (c) 1999 by SAS Institute Inc., Cary, NC 27513 */
import java.awt.*;
public class FontTest extends java.awt.Frame
implements java.awt.event.WindowListener
{
Font font1;
Font font2;
Font font3;
Font font4;
public FontTest(String t)
{
setBounds(0,0,400,400);
Font[] f = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
int i;
for(i=0;i<f.length;++i)
{
System.out.println(f[i].getName());
if (f[i].getName().equals("Wingdings"))
font1 = f[i].deriveFont((float)12.0);
if (f[i].getName().equals("Tahoma"))
font2 = f[i].deriveFont((float)12.0);
}
font3 = new Font("WingDQings", Font.PLAIN, 12);
font4 = new Font("Tahoma", Font.PLAIN, 12);
System.out.println(font1);
System.out.println(font2);
System.out.println(font3);
System.out.println(font4);
addWindowListener(this);
}
public void paint(Graphics g)
{
char[] ch = {'a', 'b', 'c', 'd'};
g.setFont(font1);
g.drawChars(ch, 0, 4, 20, 40);
g.setFont(font2);
g.drawChars(ch, 0, 4, 20, 60);
g.setFont(font3);
g.drawChars(ch, 0, 4, 20, 80);
g.setFont(font4);
g.drawChars(ch, 0, 4, 20, 100);
}
public static void main(String[] args)
{
FontTest f = new FontTest("Test");
f.setVisible(true);
}
//Defined in java.awt.event.WindowListener
public void windowOpened(java.awt.event.WindowEvent p0 )
{
}
//Defined in java.awt.event.WindowListener
public void windowClosing(java.awt.event.WindowEvent p0 )
{
dispose();
}
//Defined in java.awt.event.WindowListener
public void windowClosed(java.awt.event.WindowEvent p0 )
{
System.exit(0);
}
//Defined in java.awt.event.WindowListener
public void windowIconified(java.awt.event.WindowEvent p0 )
{
}
//Defined in java.awt.event.WindowListener
public void windowDeiconified(java.awt.event.WindowEvent p0 )
{
}
//Defined in java.awt.event.WindowListener
public void windowActivated(java.awt.event.WindowEvent p0 )
{
}
//Defined in java.awt.event.WindowListener
public void windowDeactivated(java.awt.event.WindowEvent p0 )
{
}
}
Running the application should show symbol characters. Instead it shows squares which, I bieleve, represent an illegal character. Using a text editor that supports fonts I would get symbols.
(Review ID: 93347)
======================================================================