Client API. The Codename One framework your app is built on: this runs on the device, not in a backend.
public interface Measurer
Known subtypesPdfMeasurer, ScreenMeasurer
Measures text for DocumentLayout, in points.
Pagination depends on every width, so the screen and a PDF only show the same pages when
both are laid out with the same measurer. DocumentView uses ScreenMeasurer by default
and the PDF export PdfMeasurer.
Methods
public abstract float width(String text, TextStyle style) | The advance width of text drawn in a style. |
public abstract float ascent(TextStyle style) | The distance from the top of a line of this style to its baseline. |
public abstract float descent(TextStyle style) | The distance from the baseline to the bottom of a line of this style. |
Method details
width
public abstract float width(String text, TextStyle style)The advance width of text drawn in a style.
Parameters
textString- the text, never containing a line break
styleTextStyle- the style
Returns
the width in points
ascent
public abstract float ascent(TextStyle style)The distance from the top of a line of this style to its baseline.
Parameters
styleTextStyle- the style
Returns
the ascent in points
descent
public abstract float descent(TextStyle style)The distance from the baseline to the bottom of a line of this style.
Parameters
styleTextStyle- the style
Returns
the descent in points, positive