Class AFMParser


  • public class AFMParser
    extends java.lang.Object
    Parses the contents of a Type 1 AFM font metrics file into an object structure (AFMFile).
    • Constructor Detail

      • AFMParser

        public AFMParser()
        Main constructor.
    • Method Detail

      • parse

        public AFMFile parse​(java.io.InputStream in,
                             java.lang.String afmFileName)
                      throws java.io.IOException
        Parses an AFM file from a stream.
        Parameters:
        in - the stream to read from
        afmFileName - the name of the AFM file
        Returns:
        the parsed AFM file
        Throws:
        java.io.IOException - if an I/O error occurs
      • parse

        public AFMFile parse​(java.io.BufferedReader reader,
                             java.lang.String afmFileName)
                      throws java.io.IOException
        Parses an AFM file from a BufferedReader.
        Parameters:
        reader - the BufferedReader instance to read from
        afmFileName - the name of the AFM file
        Returns:
        the parsed AFM file
        Throws:
        java.io.IOException - if an I/O error occurs
      • parseLine

        private java.lang.String parseLine​(java.lang.String line,
                                           java.util.Stack<java.lang.Object> stack)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • parseCharMetrics

        private java.lang.String parseCharMetrics​(java.lang.String line,
                                                  java.util.Stack<java.lang.Object> stack,
                                                  java.lang.String afmFileName)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • skipToNonWhiteSpace

        private static int skipToNonWhiteSpace​(java.lang.String line,
                                               int startpos)
      • skipToWhiteSpace

        private static int skipToWhiteSpace​(java.lang.String line,
                                            int startpos)
      • isWhitespace

        private static boolean isWhitespace​(char ch)