def clear_anchors(self, gstring=None): """Delete all anchors in the font.""" if gstring is not None: _glyph_names = self.project.parse_gstring(gstring) else: _glyph_names = self.project.all_glyphs() clear_anchors(self.ufo, glyph_names=_glyph_names)
def apply_callback(self, sender): f = CurrentFont() if f is not None: _top = self.w.top.get() _bottom = self.w.bottom.get() _top_pos = int(self.w.spinner_top.value.get()) _bottom_pos = int(self.w.spinner_bottom.value.get()) _accent = self.w.accent.get() _clear = self.w.clear.get() print _top_delta, type(_top_delta) print _bottom_delta, type(_bottom_delta) glyph_names = get_glyphs(f) if len(glyph_names) > 0: if _clear: print 'removing anchors...\n' clear_anchors(f, glyph_names) print '...done.\n' print 'creating anchors in glyphs...\n' print '\t', for glyph_name in glyph_names: print glyph_name, f[glyph_name].prepareUndo('create anchors') create_anchors(f[glyph_name], top=_top, bottom=_bottom, accent=_accent, top_pos=_top_pos, bottom_pos=_bottom_pos) f[glyph_name].performUndo() f.update() print print "\n...done.\n" else: print no_glyph_selected else: print no_font_open
# [h] clear anchors """Delete all anchors in the selected glyphs.""" # imports try: from mojo.roboFont import CurrentFont except ImportError: from robofab.world import CurrentFont from hTools2.modules.anchors import clear_anchors from hTools2.modules.fontutils import get_glyphs from hTools2.modules.messages import no_glyph_selected, no_font_open # run f = CurrentFont() if f is not None: glyph_names = get_glyphs(f) if len(glyph_names) > 0: clear_anchors(f, glyph_names) else: print no_glyph_selected else: print no_font_open
def clear_anchors(self, gstring=None): if gstring is not None: glyph_names = self.project.parse_gstring(gstring) clear_anchors(self.ufo, glyph_names=glyph_names)
# [h] clear anchors """Delete all anchors in the selected glyphs.""" # imports try: from mojo.roboFont import CurrentFont except ImportError: from fontParts.world import CurrentFont from hTools2.modules.anchors import clear_anchors from hTools2.modules.fontutils import get_glyphs from hTools2.modules.messages import no_glyph_selected, no_font_open # run f = CurrentFont() if f is not None: glyph_names = get_glyphs(f) if len(glyph_names) > 0: clear_anchors(f, glyph_names) else: print(no_glyph_selected) else: print(no_font_open)