# Path: PyDvi/Tools/Logging.py
# def print_card(text, **kwargs):
# 
#     """ Print the string *text* formated by :meth:`format_card`.  The remaining keyword arguments
#     *kwargs* are passed to :meth:`format_card`.
#     """
#     
#     print format_card(text, **kwargs)
# 
# Path: PyDvi/Font/Font.py
# def sort_font_class(*args):
#     def __init__(self, font_manager, font_id, name):
#     def __repr__(self):
#     def _find_font(self, kpsewhich_options=None):
#     def _find_tfm(self):
#     def basename(self):
#     def is_virtual(self):
#     def print_header(self):
#     def print_summary(self):
# class FontNotFound(NameError):
# class FontMetricNotFound(NameError):
# class Font(object):
# 
# Path: PyDvi/Font/VirtualFontParser.py
# class VirtualFontParser(object):
# 
#     _logger = _module_logger.getChild('VirtualFontParser')
# 
#     opcode_parser_set = OpcodeParserSet(opcode_definitions)
# 
#     ##############################################
# 
#     @staticmethod
#     def parse(virtual_font):
# 
#         VirtualFontParser(virtual_font)
# 
#     ##############################################
# 
#     def __init__(self, virtual_font):
# 
#         self.virtual_font = virtual_font
# 
#         self.stream = FileStream(virtual_font.filename)
# 
#         self._process_preambule()
#         self._process_file()
# 
#     ##############################################
# 
#     def _process_preambule(self):
# 
#         """ Process the preamble. """
# 
#         stream = self.stream
# 
#         stream.seek(0)
# 
#         if stream.read_unsigned_byte1() != vf_opcodes.PRE:
#             raise NameError("Virtual font file don't start by PRE opcode")
# 
#         file_id = stream.read_unsigned_byte1()
#         if file_id != VF_ID:
#             raise NameError("Unknown file ID")
# 
#         comment = stream.read(stream.read_unsigned_byte1())
#         checksum = stream.read_signed_byte4()
#         design_font_size = stream.read_fix_word()
# 
# #         string_template = '''
# # Preambule
# #   - Vf ID        %u
# #   - Comment      '%s'
# #   - Design size  %.1f pt
# #   - Checksum     %u
# # '''
# #         print string_template % (
# #             file_id,
# #             comment,
# #             design_font_size,
# #             checksum,
# #             )
#        
#         
#         self.virtual_font._set_preambule_data(file_id, comment, design_font_size, checksum)
# 
#     ##############################################
# 
#     def _process_file(self):
# 
#         """ Process the characters. """
#         
#         stream = self.stream
# 
#         # Fixme: to incorporate pre, check here pre is the first code
# 
#         while True:
#             byte = stream.read_unsigned_byte1()
#             if byte == vf_opcodes.POST:
#                 break
#             else:
#                 # Fixme: self.opcode_parsers[byte]()
#                 opcode_parser = self.opcode_parser_set[byte]
#                 opcode_parser.read_parameters(self) # Fixme: return where


from ..Tools.Logging import print_card
from .Font import Font, font_types
from .VirtualFontParser import VirtualFontParser
        self.design_font_size = design_font_size
        self.checksum = checksum

    ##############################################
        
    def register_font(self, font):

        """ Register a :class:`DviFont` instance. """

        if font.id not in self.dvi_fonts:
            self.dvi_fonts[font.id] = font
        if self.first_font is None:
            self.first_font = font.id
        # else:
        #     print 'Font ID %u already registered' % (font.id)

    ##############################################

    def register_character(self, character):

        self._characters[character.char_code] = character

    ##############################################

    def print_summary(self):

        string_format = """
Preambule
  - Vf ID        %u
  - Comment      '%s'

# Path: PyDvi/Tools/Logging.py
# def print_card(text, **kwargs):
# 
#     """ Print the string *text* formated by :meth:`format_card`.  The remaining keyword arguments
#     *kwargs* are passed to :meth:`format_card`.
#     """
#     
#     print format_card(text, **kwargs)
# 
# Path: PyDvi/Font/Font.py
# def sort_font_class(*args):
#     def __init__(self, font_manager, font_id, name):
#     def __repr__(self):
#     def _find_font(self, kpsewhich_options=None):
#     def _find_tfm(self):
#     def basename(self):
#     def is_virtual(self):
#     def print_header(self):
#     def print_summary(self):
# class FontNotFound(NameError):
# class FontMetricNotFound(NameError):
# class Font(object):
# 
# Path: PyDvi/Font/VirtualFontParser.py
# class VirtualFontParser(object):
# 
#     _logger = _module_logger.getChild('VirtualFontParser')
# 
#     opcode_parser_set = OpcodeParserSet(opcode_definitions)
# 
#     ##############################################
# 
#     @staticmethod
#     def parse(virtual_font):
# 
#         VirtualFontParser(virtual_font)
# 
#     ##############################################
# 
#     def __init__(self, virtual_font):
# 
#         self.virtual_font = virtual_font
# 
#         self.stream = FileStream(virtual_font.filename)
# 
#         self._process_preambule()
#         self._process_file()
# 
#     ##############################################
# 
#     def _process_preambule(self):
# 
#         """ Process the preamble. """
# 
#         stream = self.stream
# 
#         stream.seek(0)
# 
#         if stream.read_unsigned_byte1() != vf_opcodes.PRE:
#             raise NameError("Virtual font file don't start by PRE opcode")
# 
#         file_id = stream.read_unsigned_byte1()
#         if file_id != VF_ID:
#             raise NameError("Unknown file ID")
# 
#         comment = stream.read(stream.read_unsigned_byte1())
#         checksum = stream.read_signed_byte4()
#         design_font_size = stream.read_fix_word()
# 
# #         string_template = '''
# # Preambule
# #   - Vf ID        %u
# #   - Comment      '%s'
# #   - Design size  %.1f pt
# #   - Checksum     %u
# # '''
# #         print string_template % (
# #             file_id,
# #             comment,
# #             design_font_size,
# #             checksum,
# #             )
#        
#         
#         self.virtual_font._set_preambule_data(file_id, comment, design_font_size, checksum)
# 
#     ##############################################
# 
#     def _process_file(self):
# 
#         """ Process the characters. """
#         
#         stream = self.stream
# 
#         # Fixme: to incorporate pre, check here pre is the first code
# 
#         while True:
#             byte = stream.read_unsigned_byte1()
#             if byte == vf_opcodes.POST:
#                 break
#             else:
#                 # Fixme: self.opcode_parsers[byte]()
#                 opcode_parser = self.opcode_parser_set[byte]
#                 opcode_parser.read_parameters(self) # Fixme: return where


# Path: PyDvi/Font/VirtualFont.py
from ..Tools.Logging import print_card
from .Font import Font, font_types
from .VirtualFontParser import VirtualFontParser

        self.design_font_size = design_font_size
        self.checksum = checksum

    ##############################################
        
    def register_font(self, font):

        """ Register a :class:`DviFont` instance. """

        if font.id not in self.dvi_fonts:
            self.dvi_fonts[font.id] = font
        if self.first_font is None:
            self.first_font = font.id
        # else:
        #     print 'Font ID %u already registered' % (font.id)

    ##############################################

    def register_character(self, character):

        self._characters[character.char_code] = character

    ##############################################

    def print_summary(self):

        string_format = """
Preambule
  - Vf ID        %u
  - Comment      '%s'

  - Design size  %.1f pt