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 <[email protected]>
Date: Tuesday, October 8, 2024 at 11:46
To: [email protected] <[email protected]>
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

Reply via email to