Пример #1
0
 def add_mti_features_to_master(self):
     ufoWithMtiData = []
     if self.UIVersionedFeaturesExists:
         mti_source = self.mti_file
     else:
         mti_source = self.simple_mti_file
     mti_paths = readPlist(mti_source)
     for master in self.masters:
         key = master.info.familyName.replace(
             " ", "") + "-" + master.info.styleName.replace(" ", "")
         for table, path in mti_paths[key].items():
             with open(os.path.join(self.mtiFolderPath, path),
                       "rb") as mti_:
                 ufo_path = (
                     "com.github.googlei18n.ufo2ft.mtiFeatures/%s.mti" %
                     table.strip())
                 master.data[ufo_path] = mti_.read()
             # If we have MTI sources, any Adobe feature files derived from
             # the Glyphs file should be ignored. We clear it here because
             # it only contains junk information anyway.
             master.features.text = ""
             ufoWithMtiData.append(master)
             # Don't save the ufo, to keep them clean from mti data
     print("    ufos updated with MTI data")
     return ufoWithMtiData
Пример #2
0
 def add_mti_features_to_master_ufos(self, mti_source, masters):
     mti_dir = os.path.dirname(mti_source)
     with open(mti_source, "rb") as mti_file:
         mti_paths = readPlist(mti_file)
     for master_path, master in masters.items():
         key = os.path.basename(master_path).rstrip(".ufo")
         for table, path in mti_paths[key].items():
             with open(os.path.join(mti_dir, path), "rb") as mti_source:
                 ufo_path = (
                     "com.github.googlei18n.ufo2ft.mtiFeatures/%s.mti" %
                     table.strip())
                 master.data[ufo_path] = mti_source.read()
             # If we have MTI sources, any Adobe feature files derived from
             # the Glyphs file should be ignored. We clear it here because
             # it only contains junk information anyway.
             master.features.text = ""
Пример #3
0
 def add_ui_mti_features_to_master_ufos(self):
     mti_source = self.mti_file_for_UI_Version
     mti_paths = readPlist(mti_source)
     for master in self.masters:
         key = master.info.familyName.replace(
             " ", "") + "UI-" + master.info.styleName.replace(" ", "")
         for table, path in mti_paths[key].items():
             with open(os.path.join(self.mtiFolderPath, path),
                       "rb") as mti_:
                 ufo_path = (
                     "com.github.googlei18n.ufo2ft.mtiFeatures/%s.mti" %
                     table.strip())
                 master.data[ufo_path] = mti_.read()
             # If we have MTI sources, any Adobe feature files derived from
             # the Glyphs file should be ignored. We clear it here because
             # it only contains junk information anyway.
             master.features.text = ""
             # master.save()
     print("\tufos updated with UI versioned MTI data")