Class SmallCapsFont

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

public class SmallCapsFont extends AbstractFont
Wraps another font, converting it to small caps by shrinking the size of lower-case letters.
  • Constructor Details

    • SmallCapsFont

      public SmallCapsFont(Font underlyingFont, double smallSize)
      Parameters:
      underlyingFont - the font to draw.
      smallSize - fraction of font size to use for the small capitals. A value of 0.8 is recommended.
  • Method Details

    • 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)
      Description copied from interface: Font
      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
      fontSize - the size of the font in points.
    • getSpaceWidth

      public long getSpaceWidth()
      Description copied from interface: Font
      The width of a space for a 1pt font, in scaled points.
    • getCharacterMetrics

      public Font.Metrics getCharacterMetrics(int ch, double fontSize)
      Description copied from interface: Font
      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