Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8017773

OpenJDK7 returns incorrect TrueType font metrics

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 7, 8, 9
    • Fix Version/s: 9
    • Component/s: client-libs
    • Subcomponent:
      2d
    • Resolved In Build:
      b36
    • OS:
      linux_oracle_6.0

      Backports

        Description

        FULL PRODUCT VERSION :
        Java HotSpot(TM) 64-Bit Server VM 1.7.0_19

        ADDITIONAL OS VERSION INFORMATION :
        RedHat Enterprise Linux 6.4

        A DESCRIPTION OF THE PROBLEM :
        The getAscent() and the getDescent() in java.awt.FontMetrics Class of OpenJDK1.7 returns incorrect TrueType font metrics.

        Here is the comparison table.

        **********************************
        Oracle Corporation
        OpenJDK 65-Bit Server VM
        1.7.0_19
        **********************************
        font namefont stylefont sizeascentdescent

        IPAMinchoBOLD9.191
        IPAMinchoBOLD10.3102
        IPAMinchoBOLD11.4112
        IPAMinchoBOLD12.5122
        IPAMinchoBOLD13.6132
        IPAMinchoBOLD13.7132
        IPAMinchoBOLD14.7142
        IPAMinchoBOLD14.8142
        IPAMinchoBOLD15.8152
        IPAMinchoBOLD15.9152
        IPAMinchoBOLD17162
        IPAMinchoBOLD17.1162
        IPAMinchoBOLD18.1172
        IPAMinchoBOLD18.2172



        **********************************
        Sun Microsystems Inc.
        Java HotSpot(TM) 64-Bit Server VM
        1.6.0_38
        **********************************
        font namefont stylefont sizeascentdescent
        IPAMinchoBOLD9.182
        IPAMinchoBOLD10.392
        IPAMinchoBOLD11.4102
        IPAMinchoBOLD12.5112
        IPAMinchoBOLD13.6122
        IPAMinchoBOLD13.7122
        IPAMinchoBOLD14.7132
        IPAMinchoBOLD14.8132
        IPAMinchoBOLD15.8142
        IPAMinchoBOLD15.9142
        IPAMinchoBOLD17152
        IPAMinchoBOLD17.1153
        IPAMinchoBOLD18.1163
        IPAMinchoBOLD18.2163



        **********************************
        Oracle Corporation
        Java HotSpot(TM) 64-Bit Server VM
        1.7.0_17
        **********************************
        font namefont stylefont sizeascentdescent
        IPAMinchoBOLD9.182
        IPAMinchoBOLD10.392
        IPAMinchoBOLD11.4102
        IPAMinchoBOLD12.5112
        IPAMinchoBOLD13.6122
        IPAMinchoBOLD13.7122
        IPAMinchoBOLD14.7132
        IPAMinchoBOLD14.8132
        IPAMinchoBOLD15.8142
        IPAMinchoBOLD15.9142
        IPAMinchoBOLD17152
        IPAMinchoBOLD17.1153
        IPAMinchoBOLD18.1163
        IPAMinchoBOLD18.2163


        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Attached test code in " Source code for an executable test case: " below.

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        OpenJDK1.7 returns the same ascent and descent value with Returns of Oracle JDK1.6 and 1.7.
        ACTUAL -
        Returns of the getAscent() and the getDscent() are different between in OpenJDK1.7 and Sun JDK1.6/Oracle JDK 1.7.

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------

        import java.awt.*;

        public class FontMetricsTest {

        private static String[] fontNames = { " IPAMincho " , " IPAGothic " };
        private static int[] fontStyles = { Font.PLAIN, Font.BOLD, Font.ITALIC };
        private static String[] fontStyleNames = { " PLAIN " , " BOLD " , " ITALIC " };


        /**
         * @param args
         */
        public static void main(String[] args) {
        System.out.println( " === FONT METRICS TEST === " );
        System.out.println( " java vendor, " +System.getProperty( " java.vendor " ));
        System.out.println( " java version, " +System.getProperty( " java.version " ));
        System.out.println( " java vm name, " +System.getProperty( " java.vm.name " ));
        System.out.println( " font name,font style,font size,ascent,descent " );
        for (int n=0 ; n<fontNames.length ; n++) {
        for (int s=0 ; s<fontStyles.length ; s++) {
        Font baseFont = new Font(fontNames[n], fontStyles[s], 16);
        if ((!baseFont.getFamily().equals(fontNames[n])) && (! baseFont.getFontName().equals(fontNames[n]))) {
        System.out.println(fontNames[n]+ " ,not found " );
        }
        for (int i=5; i<=100 ; i++) {
        for (int j=0 ; j<10 ; j++) {
        float fontSize = (float)i + ((float)j)/10.0f;
        Font dFont = baseFont.deriveFont(fontSize);
        Component comp = new TestComp();
        FontMetrics metrics = comp.getFontMetrics(dFont);
        double ascent = metrics.getAscent();
        double descent = metrics.getDescent();
        System.out.println(fontNames[n]+ " , " +fontStyleNames[s]+ " , " +fontSize+ " , " +ascent+ " , " +descent);
        }
        }
        }
        }
        }

        private static class TestComp extends Component {

        public TestComp(){
        super();
        }

        }

        }

        ---------- END SOURCE ----------

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  prr Philip Race
                  Reporter:
                  webbuggrp Webbug Group
                • Votes:
                  1 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: