# 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/Tools/TexCommentedFile.py
# class TexCommentedFile(file):
# 
#     """ This class permits to iterate over lines of a text file and to skip commented line by '%'.
#     """
# 
#     ##############################################
# 
#     def __init__(self, filename):
# 
#         super(TexCommentedFile, self).__init__(filename, mode='r')
# 
#     ##############################################
# 
#     def __iter__(self):
# 
#         while True:
#             line = self.readline()
#             if not line:
#                 raise StopIteration()
#             comment_start_index = line.find('%')
#             if comment_start_index != -1:
#                 line = line[:comment_start_index]
#             line = line.strip()
#             if line:
#                 yield line
# 
#     ##############################################
# 
#     def concatenate_lines(self):
# 
#         """ Concatenate the lines and return the corresponding string. """
# 
#         return ''.join(self)


from ..Tools.Logging import print_card
from ..Tools.TexCommentedFile import TexCommentedFile

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

__all__ = ['Encoding']

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


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

class Encoding(object):

    """
    Parse an encoding file and store the association between the index and the glyph's name.

    Public attributes are:

      ``name``
    """

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

    def __init__(self, filename):

        self.name = None

        self._glyph_indexes = [] # Map glyph index to glyph name
        self._glyph_names = {} # Map glyph name  to glyph index

        try:

# 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/Tools/TexCommentedFile.py
# class TexCommentedFile(file):
# 
#     """ This class permits to iterate over lines of a text file and to skip commented line by '%'.
#     """
# 
#     ##############################################
# 
#     def __init__(self, filename):
# 
#         super(TexCommentedFile, self).__init__(filename, mode='r')
# 
#     ##############################################
# 
#     def __iter__(self):
# 
#         while True:
#             line = self.readline()
#             if not line:
#                 raise StopIteration()
#             comment_start_index = line.find('%')
#             if comment_start_index != -1:
#                 line = line[:comment_start_index]
#             line = line.strip()
#             if line:
#                 yield line
# 
#     ##############################################
# 
#     def concatenate_lines(self):
# 
#         """ Concatenate the lines and return the corresponding string. """
# 
#         return ''.join(self)


# Path: PyDvi/Font/Encoding.py
from ..Tools.Logging import print_card
from ..Tools.TexCommentedFile import TexCommentedFile


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

__all__ = ['Encoding']

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


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

class Encoding(object):

    """
    Parse an encoding file and store the association between the index and the glyph's name.

    Public attributes are:

      ``name``
    """

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

    def __init__(self, filename):

        self.name = None

        self._glyph_indexes = [] # Map glyph index to glyph name
        self._glyph_names = {} # Map glyph name  to glyph index

        try:

            with TexCommentedFile(filename) as encoding_file: