Esempio n. 1
0
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 _filterObjectToRepresentationFactory(self):
        theFilter = self._makeGlyphFilter()

        key = makeFilterKey(self.name)
        if key in _addedRepresentationFactories:
            removeRepresentationFactory(key)
        elif key not in _addedRepresentationFactories:
            _addedRepresentationFactories.append(key)
        addRepresentationFactory(key, theFilter)
Esempio n. 3
0
    def _filterObjectToRepresentationFactory(self):
        theFilter = self._makeGlyphFilter()

        key = makeFilterKey(self.name)
        if key in _addedRepresentationFactories:
            removeRepresentationFactory(key)
        elif key not in _addedRepresentationFactories:
            _addedRepresentationFactories.append(key)
        addRepresentationFactory(key, theFilter)
Esempio n. 4
0
def _registerFactory():
    # always register if debugging
    # otherwise only register if it isn't registered
    from defcon import addRepresentationFactory, removeRepresentationFactory
    from defcon.objects import glyph as _xxxHackGlyph
    if DEBUG:
        if "com.typesupply.GlyphNanny.Report" in _xxxHackGlyph._representationFactories:
            removeRepresentationFactory("com.typesupply.GlyphNanny.Report")
        addRepresentationFactory("com.typesupply.GlyphNanny.Report", GlyphNannyReportFactory)
    else:
        if "com.typesupply.GlyphNanny.Report" not in _xxxHackGlyph._representationFactories:
            addRepresentationFactory("com.typesupply.GlyphNanny.Report", GlyphNannyReportFactory)
Esempio n. 5
0
def _registerFactory():
    # always register if debugging
    # otherwise only register if it isn't registered
    from defcon import addRepresentationFactory, removeRepresentationFactory
    from defcon.objects import glyph as _xxxHackGlyph
    if DEBUG:
        if "com.typesupply.GlyphNanny.Report" in _xxxHackGlyph._representationFactories:
            removeRepresentationFactory("com.typesupply.GlyphNanny.Report")
        addRepresentationFactory("com.typesupply.GlyphNanny.Report",
                                 GlyphNannyReportFactory)
    else:
        if "com.typesupply.GlyphNanny.Report" not in _xxxHackGlyph._representationFactories:
            addRepresentationFactory("com.typesupply.GlyphNanny.Report",
                                     GlyphNannyReportFactory)
Esempio n. 6
0
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 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", RedArrowReportFactory)
    else:
        if "de.kutilek.RedArrow.report" not in _xxxHackGlyph._representationFactories:
            addRepresentationFactory("de.kutilek.RedArrow.report", RedArrowReportFactory)