# faults = False # if args.source is None: # faults = True # print( '=\n=> Please Provide Source fontinfo.JSON File: -s "/fontinfo.json"\n=' ) # if args.output is None: # #faults = True # print( '=\n=> Output Directory for EFO is fontinfo.JSON Parent Directory or Provide: -o "dir/"\n=' ) # if faults == False: # EFO = EFO(args.source, args.output) # EFO._ufos_to_efo() # fontinfo_json = EFO.fontinfo # #print(fontinfo_json) # #
{ "font_files": [] }, { "font_info": [] }, { "font_kerning_settings": [] } ] # if faults == False: # EFO_temp = os.path.join(args.source,"temp") # EFO = EFO(args.source,EFO_temp) # EFO._efo_to_ufos(args.fonts, True, "flat") # source_efo_flat_kern_dir = os.path.join(EFO._in, "kerning/flat") source_efo_similarity_kern_plist = os.path.join(EFO._in, "groups/kerning.plist") # f_files_class = [] # for x in EFO.all_exported_ufo_dst: # for k, v in x.items(): # copy_ufo_for_class_compress = v.split('.ufo')[0]+'_class.ufo' # generic_tools.copyDirectory(v, copy_ufo_for_class_compress)
def get_classes(self): # tree = ET.parse(os.path.join(self._efo, "glyphlib.xml")) root = tree.getroot() # # def get_uni_chr(_chr): # return str('\\u' + _chr).encode('utf-8').decode("unicode-escape") # # def get_glyphlib_info(name): # # for x in root: # if x.attrib['name'] == name: # uni_char = "" # if len(x.attrib["unicode"]): # uni_char = get_uni_chr(x.attrib["unicode"]) # # return [ x.attrib["glif"], name, uni_char, x.attrib["unicode"] ] # # # # def get_glyphlib(): # json_glyphlib = {} # for x in root: # uni_char = "" # if len(x.attrib["unicode"]): # uni_char = get_uni_chr(x.attrib["unicode"]) # # json_glyphlib.update({ x.attrib["name"]: [uni_char, x.attrib["glif"], x.attrib["unicode"]] }) # # return json_glyphlib # # from Lib.efo import EFO from Lib.efo.efo_fontinfo import get_font_file_array from Lib.generic.generic_tools import plist_to_json # EFO = EFO(self._efo) # fontinfo_json = EFO.fontinfo # kerning_plist = plist_to_json( os.path.join(self._efo, "groups", "kerning.plist")) # new_plist = {} # for k, v in kerning_plist.items(): # new_v = [] # for y in v: # new_v.append(get_glyphlib_info(y)) # # new_plist[k] = new_v # # return json.dumps({ "get_classes": new_plist, "get_weights": get_font_file_array(EFO), "get_glyphlib": get_glyphlib() })