def _pys2fonts(self, line):
        """Updates custom font list"""

        font_name, ascii_font_data = self._split_tidy(line)
        font_data = base64.b64decode(ascii_font_data)

        # Get system font names
        system_fonts = font_manager.findSystemFonts()

        system_font_names = []
        for sys_font in system_fonts:
            system_font_names.append(
                font_manager.FontProperties(fname=sys_font).get_name()
            )

        # Use the system font if applicable
        if font_name not in system_font_names:
            self.code_array.custom_fonts[font_name] = font_data

        with open(self.temp_fontdir + os.sep + font_name, "wb") as font_file:
            font_file.write(font_data)

        with tempfile.NamedTemporaryFile() as fontsconf_tmpfile:
            fontsconf_tmpfile_name = fontsconf_tmpfile.name
            fontsconf_tmpfile.write(self.temp_fontdir)

        os.environ["FONTCONFIG_FILE"] = fontsconf_tmpfile_name
def _pys2fonts ( self , line ) : font_name , ascii_font_data = self . _split_tidy ( line ) font_data = base64 . b64decode ( ascii_font_data ) system_fonts = font_manager . findSystemFonts ( ) system_font_names = [ ] for sys_font in system_fonts : system_font_names . append ( font_manager . FontProperties ( fname = sys_font ) . get_name ( ) ) if font_name not in system_font_names : self . code_array . custom_fonts [ font_name ] = font_data with open ( self . temp_fontdir + os . sep + font_name , "wb" ) as font_file : font_file . write ( font_data ) with tempfile . NamedTemporaryFile ( ) as fontsconf_tmpfile : fontsconf_tmpfile_name = fontsconf_tmpfile . name fontsconf_tmpfile . write ( self . temp_fontdir ) os . environ [ "FONTCONFIG_FILE" ] = fontsconf_tmpfile_name
Updates custom font list