Esempio n. 1
0
    def test_correctly_finds_yanone_kaffeesatz_bold(self):
        logging.basicConfig(level=logging.DEBUG)

        f = TTFFont(get_file_in_test_directory('YanoneKaffeesatz-Bold.otf'))
        print(f.get_info().weight)
        f.print_headers()

        stat = AssParser.get_fonts_statistics(get_file_in_test_directory('3.ass'), True, True)
        loader = FontLoader([get_file_in_test_directory('')])
        found, not_found = loader.get_fonts_for_list(stat)
        self.assertFalse(not_found)

        logging.disable(logging.DEBUG)
Esempio n. 2
0
    def test_correctly_finds_yanone_kaffeesatz_bold(self):
        logging.basicConfig(level=logging.DEBUG)

        f = TTFFont(get_file_in_test_directory('YanoneKaffeesatz-Bold.otf'))
        print(f.get_info().weight)
        f.print_headers()

        stat = AssParser.get_fonts_statistics(
            get_file_in_test_directory('3.ass'), True, True)
        loader = FontLoader([get_file_in_test_directory('')])
        found, not_found = loader.get_fonts_for_list(stat)
        self.assertFalse(not_found)

        logging.disable(logging.DEBUG)
Esempio n. 3
0
    def parse(self, path):
        with open(path, "rb") as file:
            data = struct.unpack(">4sIL", file.read(12))
            ttc_header = TTCHeader(data[0].decode("ascii"), data[1], data[2])
            if ttc_header.tag != "ttcf":
                return

            ttf_offsets = []
            for i in range(ttc_header.num_fonts):
                ttf_offsets.append(struct.unpack(">I", file.read(4))[0])

        for offset in ttf_offsets:
            ttf_font = TTFFont(path, offset)
            self.__info.append(ttf_font.get_info())
Esempio n. 4
0
    def parse(self, path):
        with open(path, 'rb') as file:
            data = struct.unpack('>4sIL', file.read(12))
            ttc_header = TTCHeader(data[0].decode('ascii'), data[1], data[2])
            if ttc_header.tag != 'ttcf':
                return

            ttf_offsets = []
            for i in range(ttc_header.num_fonts):
                ttf_offsets.append(struct.unpack('>I', file.read(4))[0])

        for offset in ttf_offsets:
            ttf_font = TTFFont(path, offset)
            self.__info.append(ttf_font.get_info())