[prev in list] [next in list] [prev in thread] [next in thread]
List: openjdk-openjfx-dev
Subject: Re: RFR: 8286867: Update #getGlyphCode return a negative number
From: Tomator <duke () openjdk ! java ! net>
Date: 2022-05-26 6:07:51
Message-ID: 2kmr2iSiKyGxtcyFn5NDJrONETCg_8SNxop_uFvFVTQ=.76b061f0-68f0-40ca-9913-4283f8100b02 () github ! com
[Download RAW message or body]
On Fri, 13 May 2022 05:34:08 GMT, Tomator <duke@openjdk.java.net> wrote:
> 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. The crash demo like this:
> `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();
>
> }
> } `
>
> 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)
> `
I can repeated this issue on uos when the linux doesn't have \
/usr/share/fonts/wps-office/FZSongS_20100603.TTF file ,openjfx version 11,method \
getGlyphCode will return a negative number
-------------
PR: https://git.openjdk.java.net/jfx/pull/795
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic