On Mon, 29 Jan 2024 16:22:56 GMT, Andy Goryachev <ango...@openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   Move test that needs QuantumToolkit to system tests
>
> MonkeyTester won't start:
> 
> 
> Exception in thread "JavaFX Application Thread" 
> java.lang.ArrayIndexOutOfBoundsException: Index 44 out of bounds for length 38
>       at 
> javafx.graphics/com.sun.javafx.text.TextRun.getAdvance(TextRun.java:362)
>       at 
> javafx.graphics/com.sun.javafx.text.PrismTextLayout.computeTrailingSpaceWidth(PrismTextLayout.java:1049)
>       at 
> javafx.graphics/com.sun.javafx.text.PrismTextLayout.createLine(PrismTextLayout.java:1017)
>       at 
> javafx.graphics/com.sun.javafx.text.PrismTextLayout.layout(PrismTextLayout.java:1333)
>       at 
> javafx.graphics/com.sun.javafx.text.PrismTextLayout.ensureLayout(PrismTextLayout.java:231)
>       at 
> javafx.graphics/com.sun.javafx.text.PrismTextLayout.getVisualBounds(PrismTextLayout.java:1461)
>       at javafx.graphics/javafx.scene.text.Text.getVisualBounds(Text.java:424)
>       at 
> javafx.graphics/javafx.scene.text.Text.doComputeGeomBounds(Text.java:1191)
>       at 
> javafx.graphics/javafx.scene.text.Text$1.doComputeGeomBounds(Text.java:150)
>       at 
> javafx.graphics/com.sun.javafx.scene.shape.TextHelper.computeGeomBoundsImpl(TextHelper.java:90)
>       at 
> javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117)
>       at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3845)
>       at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3807)
>       at javafx.graphics/javafx.scene.Node.getLocalBounds(Node.java:3755)
>       at javafx.graphics/javafx.scene.Node.updateTxBounds(Node.java:3909)
>       at 
> javafx.graphics/javafx.scene.Node.getTransformedBounds(Node.java:3701)
>       at 
> javafx.graphics/javafx.scene.Parent.getChildTransformedBounds(Parent.java:1849)
>       at 
> javafx.graphics/javafx.scene.Parent.updateCachedBounds(Parent.java:1710)
>       at javafx.graphics/javafx.scene.Parent.recomputeBounds(Parent.java:1649)
>       at 
> javafx.graphics/javafx.scene.Parent.doComputeGeomBounds(Parent.java:1502)
>       at 
> javafx.graphics/javafx.scene.Parent$1.doComputeGeomBounds(Parent.java:115)
>       at 
> javafx.graphics/com.sun.javafx.scene.ParentHelper.computeGeomBoundsImpl(ParentHelper.java:84)
>       at 
> javafx.graphics/com.sun.javafx.scene.NodeHelper.computeGeomBounds(NodeHelper.java:117)
>       at javafx.graphics/javafx.scene.Node.updateGeomBounds(Node.java:3845)
>       at javafx.graphics/javafx.scene.Node.getGeomBounds(Node.java:3807)
>       at 
> javafx.graphics/javafx.scene.Node.doComputeLayoutBounds(Node.java:3655)
>       at 
> javafx.graphics/javafx.scene.Node$1.doComputeLayoutBounds(Node.java:449)
>       at 
> javafx.graphics/com.sun.javafx.scene.NodeHelper.computeLayoutBoundsImpl(NodeHelper.java:168)
>       at javafx.graphics/com.sun.javafx....

@andy-goryachev-oracle about MonkeyTester not starting, I've reproduced this in 
a unit test.

The `TextRun` code is more complex than I figured.  The trailing space 
calculation does not take into account that a single char can match to multiple 
glyphs, and so it is using the wrong offset to call `getAdvance` with.  I'll 
try and have a fix + additional tests ready by tomorrow.

For reference: the positions array in `TextRun` when compact is a simple array 
with advance values per glyph, otherwise it is an array of x/y positions.  The 
advance is then calculated by substracting the next glyph's x position minus 
the current glyph's x position.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1236#issuecomment-1915247197

Reply via email to