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

java renders 2 combining diacriticals poorly

XMLWordPrintable

    • 2d
    • x86_64
    • windows_7

      FULL PRODUCT VERSION :

      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]


      A DESCRIPTION OF THE PROBLEM :
      I believe this particular character combination should "work out" to be one character, with two combining diacritical marks on it. Instead it renders 1 character with one combining diacritical mark, and then another "dash circle" with the second diacritical mark.

      ADDITIONAL REGRESSION INFORMATION:
      Why does it ask for this twice?


      java version "1.7.0_51"
      Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
      Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run attached code


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      should output

      size should be one character long, like:8 but instead is:8

      ACTUAL -
      size should be one character long, like:8 but instead is:14


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import java.awt.image.BufferedImage;

      /**
       */
      public class JavaBug {

        public static void main(String[] args) {
          BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB);
          Graphics2D graphics2D = image.createGraphics();
          StringBuilder text = new StringBuilder();
          text.appendCodePoint(3588);
          text.appendCodePoint(3640); // combining diacritic mark, should combine with previous character (3588) ??
          text.appendCodePoint(3633); // combining diacritic mark, should combine with previous character (3588) ??
          System.out.println("size should be one character long, like:" + graphics2D.getFontMetrics().charWidth(3588) + " but instead is:" + graphics2D.getFontMetrics().stringWidth(text.toString()));
          System.out.println("this should show one character, and no dash circles;" + text.toString());
        }
      }

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

        1. mssansthai.png
          mssansthai.png
          20 kB
        2. thailucida.png
          thailucida.png
          22 kB
        3. fixed in HB.png
          fixed in HB.png
          18 kB

            prr Philip Race
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: