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 Detail

      • log

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

        private final java.util.Set<java.lang.Integer> charsProcessed
      • IDEOGRAPHIC

        private static final java.util.Set<java.lang.Character.UnicodeBlock> IDEOGRAPHIC
    • Constructor Detail

      • DoubleByteFont

        public DoubleByteFont​(java.lang.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 Detail

      • 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 java.awt.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 java.awt.Rectangle getBoundingBoxOrNull​(int character,
                                                        int size)
      • getDefaultCharacterBox

        private java.awt.Rectangle getDefaultCharacterBox​(int character,
                                                          int size)
      • inferCharWidth

        private int inferCharWidth​(int character)