-
Bug
-
Resolution: Fixed
-
P3
-
1.2.1
-
beta
-
x86
-
windows_95
Name: rlT66838 Date: 07/27/99
Attempting to use a Type One font that happens to be a multiple master font crashes the VM, at least under Win95 and NT. There seems to be no problem with using ordinary Type One fonts, except that java.awt.Font.getPSName() is *not implemented* in the Font.java source (it just calls getFontName(); yes, I filed a separate bug report).
This problem is not unique to my program. Co-workers of mine have duplicated it with code they built from scratch. MM type one fonts are definitely VERY broken.
I have included some helpful transcripts and some sample source.
Contents:
1. Instructions for duplicating the error and a relevant
line from font.properties.
2. Windows error dump
3. Source code
4. Version info
1. How to duplicate this error.
You will need (1) the source code to vFontView.java below;
(2) a multiple master font .PFB file. It is very important
to me that this bug get duplicated, so contact me if you
have problems getting an MM Type One file, or if you have
further questions.
a) Place any Multiple Master font file in your
\jdk1.2.1\jre\lib\fonts\ directory -- e.g. ZGRG____.PFB
for MinioMM (Minion MM).
b) Add a line to font.properties, e.g. :
font.properties:filename.MinioMM=ZGRG____.PFB
c) Compile and run vFontView.java (see below).
d) vFontView will randomly select and display a font. It
will also show a list of all the fonts the system found.
(If it crashes when you run it, then it selected your MM
font randomly, and you have encountered the bug. If it
does not crash, proceed to e.)
e) Scroll down the list of available fonts until you can
see your MM font. Click on it.
f) Your program will crash. If you're running win95, you'll
get an "illegal operation" dialogue box containing something
similar to the following dump.
2) Win95 error dump.
JAVA caused an invalid page fault in
module FONTMANAGER.DLL at 0217:501fd432.
Registers:
EAX=00fef362 CS=0217 EIP=501fd432 EFLGS=00010202
EBX=0381f402 SS=021f ESP=0381f490 EBP=0344e108
ECX=0000006e DS=021f ESI=03461000 FS=98a7
EDX=00000000 ES=021f EDI=03460ff4 GS=0000
Bytes at CS:EIP:
8a 16 88 17 47 46 48 75 f7 8b 4c 24 18 8b c6 2b
Stack dump:
0080ef18 0080ef40 00000001 0080ef84 50228574 0344e108 0381f4c0 41c80000 00804460 0080ef18 0080ef00 00000000 00012476 50228829 00808540 0080ee40
3) Source code. I'm not sure who wrote this; I found it on the Bug Parade.
/*
* class:vFontView
* date: 23.02.99
*
* description: displays system fonts with user entered text
*/
import java.awt.*;
import java.awt.event.*;
import java.awt.GraphicsEnvironment.*;
import javax.swing.*;
import javax.swing.event.*;
public class vFontView implements ActionListener, ListSelectionListener
{
// containers
private static JFrame baseFrame;
private static JPanel basePanel = new JPanel(new BorderLayout());
private static JPanel controlPanel = new JPanel(new FlowLayout());
private static JPanel buttonPanel = new JPanel(new FlowLayout());
private static JScrollPane displayPanel;
private static JScrollPane listPanel;
// components
private static JTextArea display = new JTextArea();
private static JTextField userText = new JTextField(20);
private static JTextField fontSize = new JTextField("25", 5);
private static JList fontList;
private static JButton show = new JButton("Show");
private static JButton random = new JButton("Random Font");
private static JButton exit = new JButton("Exit");
// primatives
private static String[] availableFonts;
private static String appTitle = "vFontView";
private static int fontSelected, numOfFonts; // which font is selected, total number of fonts
public vFontView()
{
// first thing, get the fonts!
getFonts();
numOfFonts = availableFonts.length;
fontList = new JList(availableFonts);
fontList.addListSelectionListener(this);
fontList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
fontList.setSelectedIndex(0);
userText.setText(appTitle);
controlPanel.add(userText);
controlPanel.add(fontSize);
show.setActionCommand("show");
show.addActionListener(this);
controlPanel.add(show);
basePanel.add(controlPanel, "North");
listPanel = new JScrollPane(fontList);
basePanel.add(listPanel, "West");
display.setLineWrap(true);
displayPanel = new JScrollPane(display);
basePanel.add(displayPanel, "Center");
random.setActionCommand("random");
random.addActionListener(this);
buttonPanel.add(random);
exit.setActionCommand("exit");
exit.addActionListener(this);
buttonPanel.add(exit);
basePanel.add(buttonPanel, "South");
// init font display window with app name as string, 25 point size.
showFont(availableFonts[0], appTitle, 25);
}
public static void main(String args[])
{
vFontView vFV = new vFontView();
baseFrame = new JFrame(appTitle + " - [" + numOfFonts + " Fonts]");
baseFrame.setContentPane(basePanel);
// window close stuff
baseFrame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
baseFrame.pack();
baseFrame.setLocation(32, 24);
baseFrame.setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
String command = ae.getActionCommand();
if(command.equals("show"))
{
showFont(availableFonts[fontSelected], userText.getText(), getSelectedFontSize());
}
if(command.equals("random"))
{
int randomFont = (int) (Math.random() * numOfFonts);
showFont(availableFonts[randomFont] , display.getText(), getSelectedFontSize());
fontList.setSelectedIndex(randomFont);
fontList.ensureIndexIsVisible(randomFont);
}
if(command.equals("exit"))
{
System.exit(0);
}
}
public void valueChanged(ListSelectionEvent lse)
{
JList list = (JList)lse.getSource();
fontSelected = list.getSelectedIndex();
showFont(availableFonts[fontSelected], display.getText(), getSelectedFontSize());
}
public void getFonts()
{
availableFonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames(); // what about spec. names?
}
public void showFont(String fontName, String text, int size)
{
D.gripe("Creating a new font with name " + fontName + " and size " + size);
Font F = new Font(fontName, Font.PLAIN, size);
if(F instanceof java.awt.font.MultipleMaster) D.gripe(F.getPSName() + " is an MM type 1 font.");
display.setFont(F);
D.gripe("Setting text to " + text);
display.setText(text);
D.gripe("About to repaint.");
display.repaint();
D.gripe("end showFont()");
}
public void errorDialog(String message)
{
System.out.println(message);
}
public int getSelectedFontSize()
{
int sizeOfFont;
try
{
sizeOfFont = Integer.parseInt(fontSize.getText());
}
catch(NumberFormatException nfe)
{
errorDialog("Font size invalid.");
sizeOfFont = 25;
}
return sizeOfFont;
}
}
4) Version info:
D:\Isis>e:\jdk1.2.1\bin\java -fullversion
JAVA.EXE full version "JDK-1.2.1-A"
D:\Isis>e:\jdk1.2.1\bin\java -version
java version "1.2.1"
HotSpot VM (1.0fcs, mixed mode, build E)
I have also duplicated this bug under 1.2/classic:
D:\Isis>d:\jdk1.2\bin\java -version
java version "1.2"
Classic VM (build JDK-1.2-V, native threads)
D:\Isis>d:\jdk1.2\bin\java -fullversion
JAVA.EXE full version "JDK-1.2-V"
Our company depends on the API working at least approximately as documented. We cannot make progress on our new product line without a fix or a workaround.
Thanks.
Mike
(Review ID: 83399)
======================================================================