Interface RasterFont

All Known Implementing Classes:
TrueTypeFont

public interface RasterFont

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.

  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Returns the distance from the top of the line to the baseline.
    double
    Returns the distance from the baseline to the bottom of the line.
    getOutline(String text, double x, double y)
    Returns the outline of text with its baseline starting at (x, y).
    double
    Returns the advance width of text.
  • Method Details

    • getOutline

      RasterPath getOutline(String text, double x, double y)

      Returns the outline of text with its baseline starting at (x, y).

      Parameters
      • text: the string to lay out
      • x: left end of the baseline
      • y: the baseline
      Returns

      the glyph outlines, filled with the non-zero rule

    • stringWidth

      double stringWidth(String text)

      Returns the advance width of text.

      Parameters
      • text: the string
      Returns

      the width in user-space units

    • getAscent

      double getAscent()

      Returns the distance from the top of the line to the baseline.

      Returns

      the ascent in user-space units

    • getDescent

      double getDescent()

      Returns the distance from the baseline to the bottom of the line.

      Returns

      the descent in user-space units