Proposing new API: [Text,TextFlow].getLayoutInfo()
Andy Goryachev
andy.goryachev at oracle.com
Thu Oct 10 19:26:04 UTC 2024
Additional questions:
There is a need to extract a few more data points from the text layout in addition to the text lines, specifically:
* bounds of the (selection) range, as rectangles
* strikethrough range shape (as PathElement[] and/or rectangles)
* underline range shape (as PathElement[] and/or rectangles)
We currently have Text/TextFlow.underlineShape(int,int), .rangeShape(int,int) which return PathElement[] in an undocumented way.
There is no corresponding .strikeThroughShape() method, or a way to retrieve the geometric bounds as lines/rectangles.
Granted, one can attempt to analyze the PathElement[] and convert it to geometry, but it seems we should avoid asking the clients to do that.
So the question are:
* should we add these data points to LayoutInfo?
* if so, in what form? i.e. as individual methods or as an array of Line/Rectangle objects?
* should we add the .strikeThroughShape() to Text/TextFlow, or simply adding it here should be sufficient?
Thanks,
-andy
From: Andy Goryachev <andy.goryachev at oracle.com>
Date: Tuesday, October 8, 2024 at 11:46
To: openjfx-dev at openjdk.org <openjfx-dev at openjdk.org>
Subject: Proposing new API: [Text,TextFlow].getLayoutInfo()
Dear fellow developers:
I'd like to propose a new (missing) API in Text and TextFlow which will extract some information about the current text layout [0], [1].
At the moment, it provides information about the text lines (offsets and bounds) plus the overall layout bounds. The internal API provide more information, for example about individual text runs within each text line, but capturing those will have some overhead, and I am not sure of any use cases right now.
Are there any thoughts or suggestions as to what other information might be useful for the application developers?
Thanks!
-andy
References
[0] https://bugs.openjdk.org/browse/JDK-8341670
[1] https://github.com/openjdk/jfx/pull/1596
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/openjfx-dev/attachments/20241010/2f5c37c9/attachment-0001.htm>
More information about the openjfx-dev
mailing list