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

Regression in GlyphVector.getGlyphCharIndex behaviour

    XMLWordPrintable

Details

    • 2d
    • b137
    • x86
    • windows_8

    Description

      FULL PRODUCT VERSION :
      java version "9-ea"
      Java(TM) SE Runtime Environment (build 9-ea+107-2016-02-24-182456.javare.4520.nc)
      Java HotSpot(TM) 64-Bit Server VM (build 9-ea+107-2016-02-24-182456.javare.4520.nc, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Tested on Windows 8.1:
      Microsoft Windows [Version 6.3.9600]
      but this seems to be a platform-independent issue.

      A DESCRIPTION OF THE PROBLEM :
      In Java 9 latest builds getGlyphCharIndex method for a GlyphVector instance can return a wrong value in some cases. The problem is related to Harfbuzz integration, as the issue is not observed when the application is run with 'sun.font.layoutengine' system property set to 'icu'.

      REGRESSION. Last worked in version 8u74

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.8.0_74"
      Java(TM) SE Runtime Environment (build 1.8.0_74-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 25.74-b02, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the sample program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      0 is printed.
      ACTUAL -
      1 is printed.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.Font;
      import java.awt.font.FontRenderContext;
      import java.awt.font.GlyphVector;

      public class GlyphVectorTest {
          public static void main(String[] args) {
              Font font = new Font(Font.MONOSPACED, Font.PLAIN, 12);
              FontRenderContext frc = new FontRenderContext(null, false, false);
              GlyphVector gv = font.layoutGlyphVector(frc, "abc".toCharArray(), 1, 3, Font.LAYOUT_LEFT_TO_RIGHT);
              System.out.println(gv.getGlyphCharIndex(0));
          }
      }

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: