Interface Font

All Known Implementing Classes:
AbstractFont, DummyFont, FailoverFont, PdfBoxFont, SmallCapsFont, TrackingFont

public interface Font
Interface for a font in our system.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    The metrics for a character or text, in scaled points.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    draw(String text, double fontSize, long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents)
    Draw the text.
    getCharacterMetrics(int ch, double fontSize)
    Return the size of a code point in the specified font size.
    long
    getKerning(int leftChar, int rightChar, double fontSize)
    Get the kerning between the two code points.
    long
    The width of a space for a 1pt font, in scaled points.
    default Font.Metrics
    getStringMetrics(String text, double fontSize)
    Get the size of the text in the specified font size.
    boolean
    hasCharacter(int ch)
    Whether this font handles this character.
    Replaces all ligatures (supported by this font) in the string.
  • Method Details

    • hasCharacter

      boolean hasCharacter(int ch)
      Whether this font handles this character.
    • getKerning

      long getKerning(int leftChar, int rightChar, double fontSize)
      Get the kerning between the two code points. The result is in scaled points.
      Parameters:
      fontSize - the size of the font in points.
    • transformLigatures

      String transformLigatures(String text)
      Replaces all ligatures (supported by this font) in the string.
    • getSpaceWidth

      long getSpaceWidth()
      The width of a space for a 1pt font, in scaled points.
    • getCharacterMetrics

      Font.Metrics getCharacterMetrics(int ch, double fontSize)
      Return the size of a code point in the specified font size.
    • draw

      void draw(String text, double fontSize, long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException
      Draw the text.
      Parameters:
      text - the text to draw.
      fontSize - the size in points.
      x - the left-hand edge of the text in scaled points.
      y - the baseline of the text in scaled points.
      contents - the stream to write to.
      Throws:
      IOException
    • getStringMetrics

      default Font.Metrics getStringMetrics(String text, double fontSize)
      Get the size of the text in the specified font size. Does not include kerning.