class_docstr: A class representing a Type-1 font, for use by backends.
  
  Attributes
  ----------
  parts : tuple
      A 3-tuple of the cleartext part, the encrypted part, and the finale of
      zeros.
  
  decrypted : bytes
      The decrypted form of ``parts[1]``.
  
  prop : dict[str, Any]
      A dictionary of font properties. Noteworthy keys include:
  
      - FontName: PostScript name of the font
      - Encoding: dict from numeric codes to glyph names
      - FontMatrix: bytes object encoding a matrix
      - UniqueID: optional font identifier, dropped when modifying the font
      - CharStrings: dict from glyph names to byte code
      - Subrs: array of byte code subroutines
      - OtherSubrs: bytes object encoding some PostScript code
class_docstr_tok: ["A","class","representing","a","Type-1","font",",","for","use","by","backends",".","Attributes","--","--","--","--","--","parts",":","tuple","A","3-tuple","of","the","cleartext","part",",","the","encrypted","part",",","and","the","finale","of","zeros",".","decrypted",":","bytes","The","decrypted","form","of","``","parts","[","1","]","``",".","prop",":","dict","[","str",",","Any","]","A","dictionary","of","font","properties",".","Noteworthy","keys","include",":","-","FontName",":","PostScript","name","of","the","font","-","Encoding",":","dict","from","numeric","codes","to","glyph","names","-","FontMatrix",":","bytes","object","encoding","a","matrix","-","UniqueID",":","optional","font","identifier",",","dropped","when","modifying","the","font","-","CharStrings",":","dict","from","glyph","names","to","byte","code","-","Subrs",":","array","of","byte","code","subroutines","-","OtherSubrs",":","bytes","object","encoding","some","PostScript","code"]
docstr: Read the font from a file, decoding into usable parts.
code: def _read(self, file):
      """Read the font from a file, decoding into usable parts."""
      rawdata = file.read()
      if not rawdata.startswith(b"\x80"):
          return rawdata
  
      data = b""
      while rawdata:
          if not rawdata.startswith(b"\x80"):
              raise RuntimeError(
                  "Broken pfb file (expected byte 128, "
                  "got %d)" % rawdata[0]
              )
          type = rawdata[1]
          if type in (1, 2):
              (length,) = struct.unpack("<i", rawdata[2:6])
              segment = rawdata[6 : 6 + length]
              rawdata = rawdata[6 + length :]
  
          if type == 1:  # ASCII text: include verbatim
              data += segment
          elif type == 2:  # binary data: encode in hexadecimal
              data += binascii.hexlify(segment)
          elif type == 3:  # end of file
              break
          else:
              raise RuntimeError(
                  "Unknown segment type %d in pfb file" % type
              )
  
      return data
  
imports: import binascii
  import functools
  import logging
  import re
  import string
  import struct
  import numpy
  from matplotlib.cbook import _format_approx
  from .None import _api
label_desc: Use image node_id 2 for calling the Type1Font obj's underlying member method code with example usage: obj._read(file) and returns: data, rawdata