I need to know the size of a text using a textlayout object. I found the following bunch of codes
final TextLayout LAYOUT = Toolkit.getToolkit().getTextLayoutFactory().createLayout();
LAYOUT.setContent(text != null ? text : "", font.impl_getNativeFont());
LAYOUT.setLineSpacing(1.0f);
LAYOUT.setWrapWidth(100.0f);
LAYOUT.setBoundsType(TextLayout.BOUNDS_CENTER);
return LAYOUT.getBounds().getHeight();
The code is working properly except I have a warning message concerning getNativeFont which seems to be deprecated, knowing that what I need is the height of the text
So my question : What is the appropriate method ?
Thanks in advance !