Class PdfBoxFont

java.lang.Object
com.teamten.font.AbstractFont
com.teamten.font.PdfBoxFont
All Implemented Interfaces:
Font

public class PdfBoxFont extends AbstractFont
Wrapper around a PDFBOX font.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.teamten.font.Font

    Font.Metrics
  • Constructor Summary

    Constructors
    Constructor
    Description
    PdfBoxFont(org.apache.pdfbox.pdmodel.PDDocument pdf, File file)
     
  • 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.
    org.apache.pdfbox.pdmodel.font.PDFont
    The PDFont that this font is based on.
    long
    The width of a space for a 1pt font, in scaled points.
    boolean
    hasCharacter(int ch)
    Whether this font handles this character.
    The basename ("Times New Roman") of the font filename.

    Methods inherited from class com.teamten.font.AbstractFont

    setLigatures, transformLigatures

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.teamten.font.Font

    getStringMetrics
  • Constructor Details

  • Method Details

    • getPdFont

      public org.apache.pdfbox.pdmodel.font.PDFont getPdFont()
      The PDFont that this font is based on.
    • hasCharacter

      public boolean hasCharacter(int ch)
      Description copied from interface: Font
      Whether this font handles this character.
    • getKerning

      public long getKerning(int leftChar, int rightChar, double fontSize)
      Get the kerning between the two code points. The result is in scaled points.
      Specified by:
      getKerning in interface Font
      Overrides:
      getKerning in class AbstractFont
      Parameters:
      fontSize - the size of the font in points.
    • getSpaceWidth

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

      public String toString()
      The basename ("Times New Roman") of the font filename.
      Overrides:
      toString in class Object
    • getCharacterMetrics

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

      public void draw(String text, double fontSize, long x, long y, org.apache.pdfbox.pdmodel.PDPageContentStream contents) throws IOException
      Description copied from interface: Font
      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