JDK-7183458 : Metrics of space character in algorithmically emboldened font have changed in JDK 7.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2012-07-11
  • Updated: 2020-04-14
  • Resolved: 2012-07-24
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u6Fixed 8 b49Fixed
Related Reports
Relates :  
Description
The following test program shows different metrics between JDK 6 and JDK 7
Its extreme if you use the "all spaces" string.
Note run on Windows as its using a Windows font.


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

public class Gulim extends JComponent {

  public static void main(String args[]) {
    JFrame frame = new JFrame("Korean font test");
    frame.setBounds(100, 100, 600, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(new Gulim());
   frame.setVisible(true);
}
public Dimension getPreferredSize() {
  return new Dimension(600,500);
}
public void paintComponent(Graphics g) {

     
     int y=20;
      String text = " X. ABCDEFGabcdefg What type of request do you want to run?";
      //String text = "ZX.ZABCDEFGabcdefgZWhatZtypeofZrequestZdoZyouZwantZtoZrun?";
      //String text = "                                                      ";
      for (int sz=9; sz<18;sz++) {
         Font f = new Font("Gulim", Font.BOLD, sz);
         g.setFont(f);
         String s = text + " " + Integer.valueOf(sz);
         g.drawString(s, 0, y);
         y+=sz+2;
     }
}
 
}

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/a18a547546a4
14-08-2012

EVALUATION JDK 7 is now widening the advance of all spaces in algorithmically emboldened fonts. You can debate whether spaces can/should be widened in such a case but that was not the intention here. The behaviour can be traced back to JDK 7 b28, and a fix from May 2008 - over 4 years ago. 6686365: bolded zero width space has non zero width in FM or LCD modes Unfortunately looking at the webrev discussion :- and then looking at the actual code in JDK today, it appears that version 0 of the fix was accidentally pushed instead of version 1. And version 0 was wrong because it would cause this problem ..
11-07-2012