Example #1
0
    def _parse_config(self, conffile):
        config = ConfigParser()

        if hasattr(conffile, 'read'):
            config.readfp(conffile)
        elif os.path.isfile(conffile):
            config.read(conffile)
        else:
            msg = "fontmap file is not found: %s" % conffile
            raise RuntimeError(msg)

        if config.has_section('fontmap'):
            for name, path in config.items('fontmap'):
                self.append_font(name, path)

        if config.has_section('fontalias'):
            for name, family in config.items('fontalias'):
                self.aliases[name] = family
Example #2
0
    def _parse_config(self, conffile):
        config = ConfigParser()

        if hasattr(conffile, 'read'):
            config.read_file(conffile)
        elif os.path.isfile(conffile):
            config.read(conffile)
        else:
            msg = "fontmap file is not found: %s" % conffile
            raise RuntimeError(msg)

        if config.has_section('fontmap'):
            for name, path in config.items('fontmap'):
                self.append_font(name, path)

        if config.has_section('fontalias'):
            for name, family in config.items('fontalias'):
                self.aliases[name] = family