Interface Font


  • public interface Font
    Represents a PDF font.
    Version:
    ©2004-2024 Snowtide
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      char[] getCharSeqForCode​(int charCode)
      Returns the character sequence that corresponds to the given character code for this Font.
      String getFontName()
      Returns the name of this font as specified in the PDF file.
      boolean isBold()
      Returns true if this font is bold.
      boolean isItalic()
      Returns true if this font is italic.
    • Method Detail

      • getFontName

        String getFontName()

        Returns the name of this font as specified in the PDF file. Developers should not expect this to be a 'clean' font name, such as 'Helvetica'; names like '/EHFHIL+Helvetica' are common.

        This name is sourced from the /BaseFont value supplied with the font information in the PDF file, if any.

      • isBold

        boolean isBold()
        Returns true if this font is bold. This indicator is not 100% reliable, as some fonts may appear bold when printed or displayed but are not identified as bold internally within a PDF document.
      • isItalic

        boolean isItalic()
        Returns true if this font is italic. This indicator is not 100% reliable, as some fonts may appear bold when printed or displayed but are not identified as bold internally within a PDF document.
      • getCharSeqForCode

        char[] getCharSeqForCode​(int charCode)

        Returns the character sequence that corresponds to the given character code for this Font. This function is used by PDFxStream to determine the value of TextUnit.getCharacterSequence() for each character code yielded by TextUnit.getCharCode().

        This function can return null if no character sequence is associated with the given character code, in which case the Unicode character corresponding with the character code should be used when rendering a TextUnit instance whose TextUnit.getCharCode() function returns the given charater code.