I am looking for a way to get the position coordinates for an offset of a Draw2D TextFlow. For example SWT's StyledText supports that directly (getLocationAtOffset), but none of the Draw2D text figures supports this. Any ideas how I could calculate the position with the given methods of TextFlow?
我正在寻找一种方法来获取Draw2D TextFlow偏移的位置坐标。例如,SWT的StyledText直接支持(getLocationAtOffset),但没有Draw2D文本数字支持这一点。有关如何使用TextFlow的给定方法计算位置的任何想法?
Regards, Kai
1 个解决方案
#1
You can try TextUtilities#getTextExtents.
您可以尝试TextUtilities#getTextExtents。
#1
You can try TextUtilities#getTextExtents.
您可以尝试TextUtilities#getTextExtents。