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: 4950890
Votes 0
Synopsis "Arial Black" font shows as italic when weight set to a value of f2.0
Category java:classes_2d
Reported Against 1.4.1
Release Fixed
State 11-Closed, duplicate of 4641861, bug
Priority: 3-Medium
Related Bugs 4641861
Submit Date 07-NOV-2003
Description




FULL PRODUCT VERSION :
1.41_02

FULL OS VERSION :
Windows XP 5.1

A DESCRIPTION OF THE PROBLEM :
When displaying text using the specific font "Arial Black" the output is italicized if the weight is set to the exact value f2.0 or a font's 'bold' style is set.



STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached program. Pay attention to the functions test1, test2. They output text to the screen. Notice the text's font is not set to italic yet is displayed that way when you run the program.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I Expect that changing the weight of a font should not change the posture of the text.
ACTUAL -
The text is italicized as mentioned.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ComponentEvent;
import java.awt.font.FontRenderContext;
import java.awt.font.LineBreakMeasurer;
import java.awt.font.TextAttribute;
import java.awt.font.TextLayout;
import java.text.AttributedCharacterIterator;
import java.text.AttributedString;

import javax.swing.JPanel;

/**
 * (c) Copyright 2001 Crystal Decisions.
 * All Rights Reserved.
 */
public class GraphViewer extends Frame
{
    public static void main(String[] args)
     {
         Component viewer = new GraphViewer(new test());
         viewer.show();
         
     }

    public GraphViewer( Component component)
    {
        setLayout(new BorderLayout(0,0));
        setVisible(true);
        setSize(800,600);
        setTitle("Viewer");
        add("Center", component);
        addWindowListener(new SymWindow());
    }
    
    public void paint(Graphics2D graphics)
    {
        graphics.clearRect(0,0,800, 600);
        super.paint(graphics);
    }

    public class SymComponent extends java.awt.event.ComponentAdapter
    {
        public void ComponentResized(ComponentEvent event)
        {
            Object  customer  = event.getSource();
            if( customer  == GraphViewer.this)
            {
                   
            }
        }
        
    }

    public class SymWindow extends java.awt.event.WindowAdapter
    {

        public void windowClosing(java.awt.event.WindowEvent event)
        {
            Object  customer  = event.getSource();
            if ( customer  == GraphViewer.this)
                FrameApp_WindowClosing(event);
        }

        void FrameApp_WindowClosing(java.awt.event.WindowEvent event)
        {

            setVisible(false); // hide the Frame
            dispose(); // free the system resources
            System.exit(0); // close the application
        }
    }
    
}
class test extends JPanel
{

    public Font getFont()
    {
        return new Font("Arial Black", Font.BOLD, 15);
    }
        
        
        
    synchronized public void paintComponent(Graphics g)
    {
        test1(g);
        test2(g);
    }
        
    void test1(Graphics g)
    {
        Graphics2D g2 = (Graphics2D)g;
        FontRenderContext frc = g2.getFontRenderContext();
        
        AttributedString result = new AttributedString ("This should NOT be italicized");
        
        result.addAttribute(TextAttribute.FAMILY, "Arial Black");
        result.addAttribute(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD); // Weight_Bold is defined as f2.0
//            result.addAttribute(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
        
        LineBreakMeasurer measurer = new LineBreakMeasurer(result.getIterator(), frc);
        TextLayout layout = measurer.nextLayout(1000);
        layout.draw(g2, 100,100);
    }

    void test2(Graphics g)
    {
        Graphics2D g2 = (Graphics2D)g;
        FontRenderContext frc = g2.getFontRenderContext();
        TextLayout text = new TextLayout("This should NOT be italicized either", getFont(), frc);
        text.draw(g2, 200,200);
    }
        
        
        
}
---------- END SOURCE ----------
(Incident Review ID: 193782) 
======================================================================
Work Around
N/A
Evaluation
The test doesn't use AWT components, so I'm guessing this is a 2D issue. 
  xxxxx@xxxxx   2003-11-07

This was fixed with the font rearchitecture in 1.5.
  xxxxx@xxxxx   2003-11-12
Comments
  
  Include a link with my name & email   


PLEASE NOTE: JDK6 is formerly known as Project Mustang