JDK-4138871 : JCK regression for Font.getFamily()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.2.0
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_2.5
  • CPU: sparc
  • Submitted: 1998-05-15
  • Updated: 1998-05-16
  • Resolved: 1998-05-16
Related Reports
Duplicate :  
Description

Name: dsC58869			Date: 05/15/98



The following JCK1.2beta2 tests fail under jdk1.2beta4:
api/java_awt/Font/manual.html#GetFamily

This is a compatibility problem for jdk1.2beta4.
The tests do not fail under jdk1.2beta3, jdk1.1.7.

The reason is the incompatible API change:
Method Font.getFamily() returns the 'awt.font.fontname' property to provide 
family name in jdk1.1.x, jdk1.2beta3. In jdk1.2beta4 it returns empty string.

==== Here is the test demonstrating the bug ====
import java.awt.Font;

public class TestFont0001 {
  public static void main(String[] args) {
    Font f=new Font("SomeName", Font.PLAIN, 12);
    System.out.println(f);
    System.out.println("Family: " + f.getFamily());
  }
}

==== Here is the output of the test ====
----- (JDK-1.2beta4) -----
(sda@spear@/home/sda/temp/tests)41%java -fullversion
java full version "JDK-1.2beta4-F"
(sda@spear@/home/sda/temp/tests)42%javac TestFont0001.java
(sda@spear@/home/sda/temp/tests)43%java TestFont0001
JAVA2D_USEPLATFORMFONT not set
Disabling platform fonts
java.awt.Font[family=,name=SomeName,style=plain,size=12]
Family: 
^C(sda@spear@/home/sda/temp/tests)44%

----- (JDK-1.2beta3) -----
(sda@spear@/home/sda/temp/tests)118%java -fullversion
java full version "JDK-1.2beta3-N"
(sda@spear@/home/sda/temp/tests)119%javac TestFont0001.java
(sda@spear@/home/sda/temp/tests)120%
java TestFont0001
java.awt.Font[family=SomeName,name=Times Roman,style=plain,size=12]
Family: SomeName

----- Here is the output of the test (JDK1.1.7) -----
(sda@spear@/home/sda/temp/tests)101%java -fullversion
java full version "JDK1.1.7d3"
(sda@spear@/home/sda/temp/tests)102%javac TestFont0001.java
(sda@spear@/home/sda/temp/tests)103%java TestFont0001
java.awt.Font[family=SomeName,name=SomeName,style=plain,size=12]
Family: SomeName
^C(sda@spear@/home/sda/temp/tests)104%


======================================================================
 Justification:
JCK regression. 

======================================================================