-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: 7
-
Component/s: client-libs
-
generic
-
generic
A bug in the method java.awt.Font.equals. Different fonts with a different font size with the same displayname are compare to equals. This is wrong.
public static void main( String[] args ) throws Exception {
Font font1 = Font.createFont( Font.TRUETYPE_FONT, new File( TestFontEquals.class.getResource( "font1.ttf" ).getPath() ) );
Font font2 = Font.createFont( Font.TRUETYPE_FONT, new File( TestFontEquals.class.getResource( "font2.ttf" ).getPath() ) );
// compare 2 different fonts with different size but same display name
// expected is false but it is true
System.out.println( font1.equals( font2 ) );
}
This bug produce some exception in font rendering if both fonts was used for rendering.
Think the bug is in the class sun.font.PhysicalFont.equals. This method must also compare the field platName. This field contains the location of the font file.
Not find any workaround. The problem occur with every Java version and every platform (Windows, Linux)
public static void main( String[] args ) throws Exception {
Font font1 = Font.createFont( Font.TRUETYPE_FONT, new File( TestFontEquals.class.getResource( "font1.ttf" ).getPath() ) );
Font font2 = Font.createFont( Font.TRUETYPE_FONT, new File( TestFontEquals.class.getResource( "font2.ttf" ).getPath() ) );
// compare 2 different fonts with different size but same display name
// expected is false but it is true
System.out.println( font1.equals( font2 ) );
}
This bug produce some exception in font rendering if both fonts was used for rendering.
Think the bug is in the class sun.font.PhysicalFont.equals. This method must also compare the field platName. This field contains the location of the font file.
Not find any workaround. The problem occur with every Java version and every platform (Windows, Linux)