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

CompositeGlyphMapper.java#getGlyphCode return a negative number

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4
    • tbd
    • jfx11, 8, jfx17, jfx19
    • javafx
    • In Windows 10, JDK 8 Pool, Chinese character in the menu item character encoding issue observed,
      Issue not observed openjfx11 - openjfx19ea6

    • generic
    • generic

    Description

      A DESCRIPTION OF THE PROBLEM :
      When I used BlueJ, I found a problem with Chinese display. /javafx.graphics/com/sun/javafx/font/CompositeGlyphMapper.java#getGlyphCode may return a negative number when no font library is specified in Linux,and this could cause java.lang.ArrayIndexOutOfBoundsException error.So javafx.graphics/com/sun/prism/impl/GlyphCache.java#getCachedGlyph shou check the glyphCode.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      run the crash demo

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      i expect show chinese by javafx
      ACTUAL -
      the error:
      java.lang.ArrayIndexOutOfBoundsException: Index -25 out of bounds for length 32 at com.sun.prism.impl.GlyphCache.getCachedGlyph(GlyphCache.java:332) at com.sun.prism.impl.GlyphCache.render(GlyphCache.java:148) at com.sun.prism.impl.ps.BaseShaderGraphics.drawString(BaseShaderGraphics.java:2101) at com.sun.javafx.sg.prism.NGText.renderText(NGText.java:312) at com.sun.javafx.sg.prism.NGText.renderContent2D(NGText.java:270) at com.sun.javafx.sg.prism.NGShape.renderContent(NGShape.java:261) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:270) at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:578) at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2072) at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1964) at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:479) at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:328) at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)

      ---------- BEGIN SOURCE ----------
      the crash demo:

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.control.Menu;
      import javafx.scene.control.MenuBar;
      import javafx.scene.control.MenuItem;
      import javafx.scene.layout.BorderPane;
      import javafx.stage.Stage;

      public class MenuExample extends Application {
          public static void main(String[] args) {
          launch(args);
              }
        
          @Override
          public void start(Stage primaryStage) throws Exception {
              BorderPane root = new BorderPane();
              Scene scene = new Scene(root,200,300);
              MenuBar menubar = new MenuBar();
              Menu FileMenu = new Menu("文本");
              MenuItem filemenu1=new MenuItem("新建");
              MenuItem filemenu2=new MenuItem("Save");
              MenuItem filemenu3=new MenuItem("Exit");
              Menu EditMenu=new Menu("Edit");
              MenuItem EditMenu1=new MenuItem("Cut");
              MenuItem EditMenu2=new MenuItem("Copy");
              MenuItem EditMenu3=new MenuItem("Paste");
              EditMenu.getItems().addAll(EditMenu1,EditMenu2,EditMenu3);
              root.setTop(menubar);
              FileMenu.getItems().addAll(filemenu1,filemenu2,filemenu3);
              menubar.getMenus().addAll(FileMenu,EditMenu);
              primaryStage.setScene(scene);
              primaryStage.setTitle("TEST");
              primaryStage.show();
                
          }
      }

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

      Attachments

        Issue Links

          Activity

            People

              kcr Kevin Rushforth
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: