Ejemplo n.º 1
0
 def apply_callback(self, sender):
     ufo_paths = walk(self._ufos_folder, 'ufo')
     if len(ufo_paths) > 0:
         print 'transforming all fonts in folder...\n'
         self.w.bar.start()
         for ufo_path in ufo_paths:
             font = RFont(ufo_path, showUI=False)
             print '\ttransforming %s...' % get_full_name(font)
             if self._round:
                 print '\t\trounding points...'
                 font.round()
             if self._decompose:
                 print '\t\tdecomposing...'
                 decompose(font)
             if self._overlaps:
                 print '\t\tremoving overlaps...'
                 font.removeOverlap()
             if self._order:
                 print '\t\tauto contour order...'
                 auto_contour_order(font)
             if self._direction:
                 print '\t\tauto contour direction...'
                 auto_contour_direction(font)
             if self._extremes:
                 print '\t\tadding extreme points...'
                 add_extremes(font)
             if self._save:
                 print '\t\tsaving font...'
                 font.save()
             print '\t...done.\n'
         self.w.bar.stop()
         print '...done.\n'
     # no font open
     else:
         print 'the selected directory contains no .ufo font.\n'
Ejemplo n.º 2
0
 def apply_callback(self, sender):
     ufo_paths = walk(self.ufos_folder, 'ufo')
     if len(ufo_paths) > 0:
         print 'transforming all fonts in folder...\n'
         self.w.bar.start()
         for ufo_path in ufo_paths:
             font = RFont(ufo_path, showUI=False)
             print '\ttransforming %s...' % get_full_name(font)
             if self.round:
                 print '\t\trounding points...'
                 font.round()
             if self.decompose:
                 print '\t\tdecomposing...'
                 decompose(font)
             if self.overlaps:
                 print '\t\tremoving overlaps...'
                 font.removeOverlap()
             if self.order:
                 print '\t\tauto contour order...'
                 auto_contour_order(font)
             if self.direction:
                 print '\t\tauto contour direction...'
                 auto_contour_direction(font)
             if self.extremes:
                 print '\t\tadding extreme points...'
                 add_extremes(font)
             if self.remove_features:
                 print '\t\tremoving all OpenType features...'
                 clear_features(font)
             if self.save:
                 print '\t\tsaving font...'
                 font.save()
             print '\t...done.\n'
         self.w.bar.stop()
         print '...done.\n'
     # no font in folder
     else:
         print no_font_in_folder
Ejemplo n.º 3
0
 def apply_callback(self, sender):
     ufo_paths = walk(self.ufos_folder, 'ufo')
     if len(ufo_paths) > 0:
         print('transforming all fonts in folder...\n')
         self.w.bar.start()
         for ufo_path in ufo_paths:
             font = RFont(ufo_path, showUI=False)
             print('\ttransforming %s...' % get_full_name(font))
             if self.round:
                 print('\t\trounding points...')
                 font.round()
             if self.decompose:
                 print('\t\tdecomposing...')
                 decompose(font)
             if self.overlaps:
                 print('\t\tremoving overlaps...')
                 font.removeOverlap()
             if self.order:
                 print('\t\tauto contour order...')
                 auto_contour_order(font)
             if self.direction:
                 print('\t\tauto contour direction...')
                 auto_contour_direction(font)
             if self.extremes:
                 print('\t\tadding extreme points...')
                 add_extremes(font)
             if self.remove_features:
                 print('\t\tremoving all OpenType features...')
                 clear_features(font)
             if self.save:
                 print('\t\tsaving font...')
                 font.save()
             print('\t...done.\n')
         self.w.bar.stop()
         print('...done.\n')
     # no font in folder
     else:
         print(no_font_in_folder)
Ejemplo n.º 4
0
from hTools2.modules.fontutils import decompose, autoContourOrderDirection

# settings

ufos_folder = u"/Users/gferreira0/Desktop/_Guarana/_ufos/"
_remove_overlaps = True
_decompose = True
_auto_order_direction = True

# transform fonts

ufo_paths = walk(ufos_folder, 'ufo')
print 'batch transforming fonts...\n'
for ufo_path in ufo_paths:
    ufo = RFont(ufo_path, showUI=False)
    print '\ttransforming %s %s...' % (ufo.info.familyName, ufo.info.styleName)
    if _decompose:
        print '\t\tdecomposing...'
        decompose(ufo)
    if _remove_overlaps:
        print '\t\tremoving overlaps...'
        ufo.removeOverlap()
    if _auto_order_direction:
        print '\t\tsetting auto contour order & direction...'
        autoContourOrderDirection(ufo)
    ufo.save()
    ufo.close()
    print
print '...done.\n'