Class DoubleByteFont

All Implemented Interfaces:
FontMetrics

public class DoubleByteFont extends AbstractOutlineFont
Implementation of AbstractOutlineFont that supports double-byte fonts (CID Keyed font (Type 0)). The width of characters that are not prescribed a width metrics in the font resource use a fallback width. The default width is 1 em. A character can be supplied and queried for the fallback width of all non-ideograph characters.
  • Field Details

    • log

      private static final org.apache.commons.logging.Log log
    • charsProcessed

      private final Set<Integer> charsProcessed
    • IDEOGRAPHIC

      private static final Set<Character.UnicodeBlock> IDEOGRAPHIC
  • Constructor Details

    • DoubleByteFont

      public DoubleByteFont(String name, boolean embeddable, CharacterSet charSet, AFPEventProducer eventProducer)
      Constructor for an double-byte outline font.
      Parameters:
      name - the name of the font
      embeddable - whether or not this font is embeddable
      charSet - the character set
      eventProducer - Handles any AFP related events
  • Method Details

    • getWidth

      public int getWidth(int character, int size)
      Return the width (in 1/1000ths of point size) of the character at code point i.
      Parameters:
      character - code point index
      size - font size
      Returns:
      the width of the character
    • getDefaultCharacterWidth

      private int getDefaultCharacterWidth(int character)
    • getBoundingBox

      public Rectangle getBoundingBox(int character, int size)
      Description copied from class: AFPFont
      Returns the bounding box of the glyph at the given index, for the given font size.
      Specified by:
      getBoundingBox in interface FontMetrics
      Specified by:
      getBoundingBox in class AFPFont
      Parameters:
      character - glyph index
      size - font size
      Returns:
      the scaled bounding box scaled in 1/1000ths of the given size
    • getBoundingBoxOrNull

      private Rectangle getBoundingBoxOrNull(int character, int size)
    • getDefaultCharacterBox

      private Rectangle getDefaultCharacterBox(int character, int size)
    • inferCharWidth

      private int inferCharWidth(int character)