Description
TextFlow with the following text and font set to "Noto Sans Arabic Regular 12" throws ArrayIndexOutOfBoundsException at certain width.
To reproduce, one can use the monkey tester, TextFlow page, select Wrap Index Bug text, select "Noto Sans Arabic Regular 12" font and try to reduce the width of the TextFlow pane.
The issue cannot be reproduced with Al Bayan Bold font, for example.
Oriya MN - fails
American Typewriter - fails
Al Tarikh Regular - ok (baseline issue?)
Apple Chancery - fails
Arial - fails
Verdana - fails
Tahoma - ok
```
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 14
at javafx.graphics/com.sun.javafx.text.TextRun.getWrapIndex(TextRun.java:291)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1104)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:230)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:256)
at javafx.graphics/javafx.scene.text.TextFlow.computePrefHeight(TextFlow.java:273)
at javafx.graphics/javafx.scene.text.TextFlow.computeMinHeight(TextFlow.java:282)
at javafx.graphics/javafx.scene.Parent.minHeight(Parent.java:1069)
at javafx.graphics/javafx.scene.layout.Region.minHeight(Region.java:1570)
at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaHeight(Region.java:1980)
at javafx.graphics/javafx.scene.layout.BorderPane.getAreaHeight(BorderPane.java:629)
at javafx.graphics/javafx.scene.layout.BorderPane.computeMinHeight(BorderPane.java:423)
at javafx.graphics/javafx.scene.Parent.minHeight(Parent.java:1069)
at javafx.graphics/javafx.scene.layout.Region.minHeight(Region.java:1570)
at javafx.graphics/javafx.scene.layout.Region.boundedNodeSizeWithBias(Region.java:2210)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2611)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2524)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2465)
at javafx.graphics/javafx.scene.layout.StackPane.layoutChildren(StackPane.java:344)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1208)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:594)
at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2596)
at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$2(Toolkit.java:398)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:427)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:592)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$11(QuantumToolkit.java:352)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
```
The failure was noticed on Mac OS Ventura 13.1 with jfx 21 master branch.
Also fails on Windows 11 with the 'system' font and Arial font.
To reproduce, one can use the monkey tester, TextFlow page, select Wrap Index Bug text, select "Noto Sans Arabic Regular 12" font and try to reduce the width of the TextFlow pane.
The issue cannot be reproduced with Al Bayan Bold font, for example.
Oriya MN - fails
American Typewriter - fails
Al Tarikh Regular - ok (baseline issue?)
Apple Chancery - fails
Arial - fails
Verdana - fails
Tahoma - ok
```
Exception in thread "JavaFX Application Thread" java.lang.ArrayIndexOutOfBoundsException: Index 14 out of bounds for length 14
at javafx.graphics/com.sun.javafx.text.TextRun.getWrapIndex(TextRun.java:291)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1104)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:230)
at javafx.graphics/com.sun.javafx.text.PrismTextLayout.getBounds(PrismTextLayout.java:256)
at javafx.graphics/javafx.scene.text.TextFlow.computePrefHeight(TextFlow.java:273)
at javafx.graphics/javafx.scene.text.TextFlow.computeMinHeight(TextFlow.java:282)
at javafx.graphics/javafx.scene.Parent.minHeight(Parent.java:1069)
at javafx.graphics/javafx.scene.layout.Region.minHeight(Region.java:1570)
at javafx.graphics/javafx.scene.layout.Region.computeChildMinAreaHeight(Region.java:1980)
at javafx.graphics/javafx.scene.layout.BorderPane.getAreaHeight(BorderPane.java:629)
at javafx.graphics/javafx.scene.layout.BorderPane.computeMinHeight(BorderPane.java:423)
at javafx.graphics/javafx.scene.Parent.minHeight(Parent.java:1069)
at javafx.graphics/javafx.scene.layout.Region.minHeight(Region.java:1570)
at javafx.graphics/javafx.scene.layout.Region.boundedNodeSizeWithBias(Region.java:2210)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2611)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2524)
at javafx.graphics/javafx.scene.layout.Region.layoutInArea(Region.java:2465)
at javafx.graphics/javafx.scene.layout.StackPane.layoutChildren(StackPane.java:344)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1208)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Parent.layout(Parent.java:1215)
at javafx.graphics/javafx.scene.Scene.doLayoutPass(Scene.java:594)
at javafx.graphics/javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2596)
at javafx.graphics/com.sun.javafx.tk.Toolkit.lambda$2(Toolkit.java:398)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at javafx.graphics/com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:397)
at javafx.graphics/com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:427)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:592)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:572)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.pulseFromQueue(QuantumToolkit.java:565)
at javafx.graphics/com.sun.javafx.tk.quantum.QuantumToolkit.lambda$11(QuantumToolkit.java:352)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
```
The failure was noticed on Mac OS Ventura 13.1 with jfx 21 master branch.
Also fails on Windows 11 with the 'system' font and Arial font.