Class Type3FontValidator

    • Method Detail

      • checkMandatoryField

        protected void checkMandatoryField()
      • checkFontBBox

        private void checkFontBBox()
        Check that the FontBBox element has the right format as declared in the PDF reference document.
      • checkFontMatrix

        private void checkFontMatrix()
        Check that the FontMatrix element has the right format as declared in the PDF reference document.
      • checkEncoding

        protected void checkEncoding()
        For a Type3 font, the mapping between the Character Code and the Character name is entirely defined in the /Encoding entry. The /Encoding Entry can be a Name (For the 5 predefined encodings) or a dictionary. If it is a dictionary, the /Differences array contains the correspondence between a character code and a set of character name which are different from the encoding entry of the dictionary. This method checks that the encoding is :
        • An existing encoding name.
        • A dictionary with an existing encoding name (the name is optional) and a well formed "Differences" array (the array is optional)
        Overrides:
        checkEncoding in class FontValidator<Type3Container>
      • checkEncodingAsString

        private void checkEncodingAsString​(java.lang.String enc)
        This method is called by the CheckEncoding method if the /Encoding entry is a String. In this case, the String must be an existing encoding name. (WinAnsi, MacRoman...)
        Parameters:
        enc - The name of the encoding.
      • checkEncodingAsDictionary

        private void checkEncodingAsDictionary​(COSDictionary encodingDictionary)
        This method is called by the CheckEncoding method if the /Encoding entry is an instance of COSDictionary. If that dictionary has a /BaseEncoding entry, the name is checked. In any case, the /Differences array is validated.
        Parameters:
        encodingDictionary - the encoding dictionary.
      • checkCharProcsAndMetrics

        private void checkCharProcsAndMetrics()
        CharProcs is a dictionary where the key is a character name and the value is a Stream which contains the glyph representation of the key. This method checks that all characters codes defined in the Widths Array exist in the CharProcs dictionary. If the CharProcs doesn't know the Character, it is mapped with the .notdef one. For each character, the Glyph width must be the same as the Width value declared in the Widths array.
      • getWidths

        public java.util.List<java.lang.Float> getWidths​(PDFont font)
      • getWidthFromCharProc

        private float getWidthFromCharProc​(PDType3CharProc charProc)
                                    throws java.io.IOException
        Parse the Glyph description to obtain the Width
        Returns:
        the width of the character
        Throws:
        java.io.IOException
      • checkResources

        private void checkResources()
                             throws ValidationException
        If the Resources entry is present, this method checks its content. Only fonts and images are checked because this resource describes glyphs.
        Throws:
        ValidationException