def _registerFactory(): # From https://github.com/typesupply/glyph-nanny/blob/master/Glyph%20Nanny.roboFontExt/lib/glyphNanny.py # always register if debugging # otherwise only register if it isn't registered if roboFontVersion >= "2.0b": from defcon import registerRepresentationFactory, Glyph if DEBUG: if "de.kutilek.RedArrow.report" in Glyph.representationFactories: for font in AllFonts(): for glyph in font: glyph.naked().destroyAllRepresentations() registerRepresentationFactory(Glyph, "de.kutilek.RedArrow.report", RedArrowReportFactory) else: if "de.kutilek.RedArrow.report" not in Glyph.representationFactories: registerRepresentationFactory(Glyph, "de.kutilek.RedArrow.report", RedArrowReportFactory) else: from defcon import addRepresentationFactory, removeRepresentationFactory from defcon.objects import glyph as _xxxHackGlyph if DEBUG: if "de.kutilek.RedArrow.report" in _xxxHackGlyph._representationFactories: for font in AllFonts(): for glyph in font: glyph.naked().destroyAllRepresentations() removeRepresentationFactory("de.kutilek.RedArrow.report") addRepresentationFactory("de.kutilek.RedArrow.report", RedArrowReportFactoryUFO2) else: if "de.kutilek.RedArrow.report" not in _xxxHackGlyph._representationFactories: addRepresentationFactory("de.kutilek.RedArrow.report", RedArrowReportFactoryUFO2)
def registerAllFactories(): for name, (factory, destructiveNotifications) in _glyphFactories.items(): registerRepresentationFactory( Glyph, name, factory, destructiveNotifications=destructiveNotifications ) for name, (factory, destructiveNotifications) in _imageFactories.items(): registerRepresentationFactory( Image, name, factory, destructiveNotifications=destructiveNotifications )
def _filterObjectToRepresentationFactory(self): theFilter = self._makeGlyphFilter() key = makeFilterKey(self.name) if key in _addedRepresentationFactories: unregisterRepresentationFactory(Glyph, key) elif key not in _addedRepresentationFactories: _addedRepresentationFactories.append(key) registerRepresentationFactory(Glyph, key, theFilter)
def registerAllFactories(): for name, (factory, destructiveNotifications) in _glyphFactories.items(): registerRepresentationFactory( Glyph, name, factory, destructiveNotifications=destructiveNotifications) for name, (factory, destructiveNotifications) in _imageFactories.items(): registerRepresentationFactory( Image, name, factory, destructiveNotifications=destructiveNotifications)
def registerAllFactories(): for name, (factory, destructiveNotifications) in _glyphFactories.items(): registerRepresentationFactory( Glyph, name, factory, destructiveNotifications=destructiveNotifications) for name, (factory, destructiveNotifications) in \ _componentFactories.items(): registerRepresentationFactory( Component, name, factory, destructiveNotifications=destructiveNotifications)
def _registerFactory(): # From https://github.com/typesupply/glyph-nanny/blob/master/Glyph%20Nanny.roboFontExt/lib/glyphNanny.py # always register if debugging # otherwise only register if it isn't registered from defcon import registerRepresentationFactory, Glyph if DEBUG: if rf_guide_key in Glyph.representationFactories: for font in AllFonts(): for glyph in font: glyph.naked().destroyAllRepresentations() registerRepresentationFactory(rf_guide_key, NibGuideGlyphFactory) else: if rf_guide_key not in Glyph.representationFactories: registerRepresentationFactory( Glyph, rf_guide_key, NibGuideGlyphFactory )
def registerAllFactories(): for name, (factory, destructiveNotifications) in _fontFactories.items(): registerRepresentationFactory( Font, name, factory, destructiveNotifications=destructiveNotifications) for name, (factory, destructiveNotifications) in _glyphFactories.items(): registerRepresentationFactory( Glyph, name, factory, destructiveNotifications=destructiveNotifications) for name, (factory, destructiveNotifications) in \ _componentFactories.items(): registerRepresentationFactory( Component, name, factory, destructiveNotifications=destructiveNotifications)
pen.drawSettings(drawInner=True, drawOuter=True) dest = RGlyph() pen.drawPoints(dest.getPointPen()) setGoldGradient(minx, miny, maxx, maxy, 4) drawBot.drawGlyph(dest) pdf = drawBot.pdfImage() page = pdf.pageAtIndex_(0) image = NSImage.alloc().initWithData_(page.dataRepresentation()) return image, (minx-margin, miny-margin) if version >= "3.0": registerRepresentationFactory(Glyph, "money.money.money", GoldFactory) else: addRepresentationFactory("money.money.money", GoldFactory) class GoldMaker(object): def __init__(self): text = "Every thing you space will be gold!" message = "To disable this Goldener extension, simply uninstall it from the preferences and restart." dontShowAgainMessage(text, message, dontShowAgainKey="Goldener.warning") addObserver(self, "goldie", "drawPreview") addObserver(self, "goldie", "spaceCenterDraw") def goldie(self, notification): g = notification["glyph"]