Let's see 4 cases:
1) first font is equal to the second one:
Font f1 = new Font( "serif", Font.BOLD, 12 );
Font f2 = new Font( "serif", Font.BOLD, 12 );
System.out.println( f1.equals( f2 ) );
EXPECT: true
ACTUAL: true
2) first font is equal to the second one:
Font f1 = new Font( "serif", Font.BOLD, 12 ); f1.getAttributes();
Font f2 = new Font( "serif", Font.BOLD, 12 );
System.out.println( f1.equals( f2 ) );
EXPECT: true
ACTUAL: false
3) first font is equal to the second one:
Font f1 = new Font( "serif", Font.BOLD, 12 );
Font f2 = new Font( "serif", Font.BOLD, 12 ); f2.getAttributes();
System.out.println( f1.equals( f2 ) );
EXPECT: true
ACTUAL: false
4) first font is equal to the second one:
Font f1 = new Font( "serif", Font.BOLD, 12 ); f1.getAttributes();
Font f2 = new Font( "serif", Font.BOLD, 12 ); f2.getAttributes();
System.out.println( f1.equals( f2 ) );
EXPECT: true
ACTUAL: true
Sources are attached.