Interface Measurer

All Known Implementing Classes:
PdfMeasurer, ScreenMeasurer

public interface Measurer

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.

  • Method Summary

    Modifier and Type
    Method
    Description
    float
    The distance from the top of a line of this style to its baseline.
    float
    The distance from the baseline to the bottom of a line of this style.
    float
    width(String text, TextStyle style)
    The advance width of text drawn in a style.
  • Method Details

    • width

      float width(String text, TextStyle style)

      The advance width of text drawn in a style.

      Parameters
      • text: the text, never containing a line break

      • style: the style

      Returns

      the width in points

    • ascent

      float ascent(TextStyle style)

      The distance from the top of a line of this style to its baseline.

      Parameters
      • style: the style
      Returns

      the ascent in points

    • descent

      float descent(TextStyle style)

      The distance from the baseline to the bottom of a line of this style.

      Parameters
      • style: the style
      Returns

      the descent in points, positive