Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public interface RasterFont
Known subtypesTrueTypeFont
The seam through which RasterGraphics.drawString(String, double, double)
draws text: a font turns a string into an outline, and the graphics fills
it like any other path.
TrueTypeFont is the implementation that ships: TrueType fonts read from
bytes, with an embedded default. Another font engine plugs in here
without any change to the graphics.
Methods
public abstract RasterPath getOutline(String text, double x, double y) | Returns the outline of text with its baseline starting at (x, y). |
public abstract double stringWidth(String text) | Returns the advance width of text. |
public abstract double getAscent() | Returns the distance from the top of the line to the baseline. |
public abstract double getDescent() | Returns the distance from the baseline to the bottom of the line. |
Method details
getOutline
public abstract RasterPath getOutline(String text, double x, double y)Returns the outline of
text with its baseline starting at (x, y).Parameters
textString- the string to lay out
xdouble- left end of the baseline
ydouble- the baseline
Returns
the glyph outlines, filled with the non-zero rule
stringWidth
public abstract double stringWidth(String text)Returns the advance width of
text.Parameters
textString- the string
Returns
the width in user-space units
getAscent
public abstract double getAscent()Returns the distance from the top of the line to the baseline.
Returns
the ascent in user-space units
getDescent
public abstract double getDescent()Returns the distance from the baseline to the bottom of the line.
Returns
the descent in user-space units