Java Solaris Communities Sun Store Join SDN My Profile Why Join?
 
Bug Database
Bug Detail
Quick Lists
Top 25 Bugs
Top 25 RFE's
Recently Closed Bugs
Printable Page Printable Page


Bug Database
Bug ID: 4371514
Votes 0
Synopsis Bold and Italic attributes don't work properly.
Category java:classes_2d
Reported Against 1.3
Release Fixed 1.4(merlin-beta)
State 10-Fix Delivered, bug
Priority: 4-Low
Related Bugs
Submit Date 15-SEP-2000
Description




java version 1.3.0
Java 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot Client VM (build 1.3.0-C, mixed mode)

The bold and italic fonts aren't rendered properly. Just compile the following
code and you can see what I mean:

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;


//----------------------------------------------------------------

public class Fonts
{
	public static void main(String[] args)
	{
        JFrame frame = new MainFrame();
        frame.pack();
        frame.show();
	}
}

//----------------------------------------------------------------

class MainFrame extends JFrame
{
    public MainFrame()
    {
        setTitle("Fonts: Bold and Italic do not seem to work");
        setLocation(300, 300);

        addWindowListener(new WindowAdapter()
        { public void windowClosing(WindowEvent e) { System.exit(0); }});

        getContentPane().add(new FontPanel());
    }
}

//----------------------------------------------------------------

class FontPanel extends JPanel implements ItemListener
{
    JComboBox  combo;
    Font[]     fonts;
    JTextField text;

    public FontPanel()
    {
        text = new JTextField("Font Sample");
        text.setEditable(false);
        text.setBackground(Color.white);
        text.setBorder(BorderFactory.createEtchedBorder());

        combo = new JComboBox();
        combo.addItemListener(this);
        /*
        This statement creates a 1 point version of ALL of the fonts - and
their variants - that
        are on the system. This means, for example, instead of getting
just "Courier New" you get
        "Courier New", "Courier New Bold", "Courier New Italic", and "Courier
New Bold Italic".
        On my system, the number of font names (retrieved
by 'getAvailableFontFamilyNames()')
        grew from 85 to 143 due to all of these variants now being listed.
        */
        fonts = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();

        for (int i = 0; i < fonts.length; i++)
            combo.addItem(fonts[i].getFontName());

        setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
        add(combo);
        add(text);
        add(Box.createHorizontalStrut(50));
    }

    public void itemStateChanged(ItemEvent anEvent)
    {
        if (anEvent.getStateChange() == ItemEvent.DESELECTED)
            return;

        /* This statement should create a new font with the same style and the
specified size.
         Bold and italic attributes do not seem to be working.
*/
        text.setFont(fonts[combo.getSelectedIndex()].deriveFont(19.0F));

        text.invalidate();
        validate();
    }
}
(Review ID: 108216) 
======================================================================
Work Around
N/A
Evaluation
Reproducible on NT4, but not on Solaris8/sparc.  Rendering is being in a Swing JTextField, so I'm going to have 2D have a look.

  xxxxx@xxxxx   2000-09-15

This is fixed in the merlin (1.4) beta that will be out soon.  
  xxxxx@xxxxx   2001-05-21
Comments
  
  Include a link with my name & email   

Submitted On 05-FEB-2001
DBTEL
Same problem with my Views for my EditorKit. All works only 
if I specify different sizes or styles between fonts. 
Asking for different attribute but same style and size 
returns same font as before.


Submitted On 19-APR-2001
javajimd
This bug will make all our GUI apps look goofy.


Submitted On 19-APR-2001
olater
Fix it Sun.... 


Submitted On 20-APR-2001
dempseys3
Fix it!


Submitted On 20-APR-2001
dempseys3
Fix it!


Submitted On 20-APR-2001
dempseys3
Fix it!


Submitted On 20-APR-2001
bgaynor
Fix it!


Submitted On 23-APR-2001
pony_boy
Fix it!!!


Submitted On 23-APR-2001
pony_boy
It will make all GUI apps look goofy


Submitted On 23-APR-2001
pony_boy
Fix this bug so quality of our GUI's will improve


Submitted On 01-MAY-2001
ronove
We've had the same problem under the JDK for Linux.  The
users of our product are tired of hearing, "We know it
doesn't *look* bold or italic, but trust us, it is."


Submitted On 15-MAY-2001
lhannay
C'mon, guys. I informed you of this 8 stinking months ago 
and you've got 135 votes for it, yet as of May 15 you've 
done NOTHING. As the comments below indicate, this is a 
*visual* bug which means it's easy to give users a "bad 
taste about Java".
Instead of releasing new APIs every other week, why don't 
you try FIXING the EXISTING code?!!?
-- Larry Hannay


Submitted On 18-MAY-2001
DBTEL
I'm going to release a visual WYSIWYG XML editor in Java 
and it will look horrible because of this bug.
My compliments >;-( .


Submitted On 18-MAY-2001
charamuga
How well do you think it would fly if the Windows or 
Solaris API could not gaurantee that Fonts would appear as 
Bold or Italic?  Come on, this is a serious bug.  I've got 
countless panels with all Bold labels that now display as 
Plain (most of the time, that is).  This may be a "GUI" bug 
but it has major negative impact on the look and feel of 
our application.  For the love of all that's holy, fix it.


Submitted On 25-JUL-2001
ironside
Face it people. Sun is interested in pushing the hype of 
java. It doesn't matter that their current code is shit. In 
all my years working with MS products I've never seen such 
a smoke and mirrors product! I will NOT be using Java for 
my NEXT development project. 



PLEASE NOTE: JDK6 is formerly known as Project Mustang