Example #1
0
    def __init__(self, timing=False, verbose="INFO", validate_ufo=False):
        logging.basicConfig(level=getattr(logging, verbose.upper()))
        logging.getLogger("fontTools.subset").setLevel(logging.WARNING)
        if timing:
            configLogger(logger=timer.logger, level=logging.DEBUG)

        logger.debug("ufoLib UFO validation is %s",
                     "enabled" if validate_ufo else "disabled")
        setUfoLibReadValidate(validate_ufo)
        setUfoLibWriteValidate(validate_ufo)
    def test_ufoLibReadValidate_settingDefaults(self):
        setUfoLibReadValidate(False)
        setUfoLibWriteValidate(False)
        font = Font()
        self.assertFalse(font.ufoLibReadValidate)
        self.assertFalse(font.ufoLibWriteValidate)
        self.assertFalse(font.info.ufoLibReadValidate)
        self.assertFalse(font.info.ufoLibWriteValidate)

        setUfoLibReadValidate(False)
        setUfoLibWriteValidate(True)
        font = Font()
        self.assertFalse(font.ufoLibReadValidate)
        self.assertTrue(font.ufoLibWriteValidate)
        self.assertFalse(font.info.ufoLibReadValidate)
        self.assertTrue(font.info.ufoLibWriteValidate)

        setUfoLibReadValidate(True)
        setUfoLibWriteValidate(False)
        font = Font()
        self.assertTrue(font.ufoLibReadValidate)
        self.assertFalse(font.ufoLibWriteValidate)
        self.assertTrue(font.info.ufoLibReadValidate)
        self.assertFalse(font.info.ufoLibWriteValidate)
Example #3
0
    def test_ufoLibReadValidate_settingDefaults(self):
        setUfoLibReadValidate(False)
        setUfoLibWriteValidate(False)
        font = Font()
        self.assertFalse(font.ufoLibReadValidate)
        self.assertFalse(font.ufoLibWriteValidate)
        self.assertFalse(font.info.ufoLibReadValidate)
        self.assertFalse(font.info.ufoLibWriteValidate)

        setUfoLibReadValidate(False)
        setUfoLibWriteValidate(True)
        font = Font()
        self.assertFalse(font.ufoLibReadValidate)
        self.assertTrue(font.ufoLibWriteValidate)
        self.assertFalse(font.info.ufoLibReadValidate)
        self.assertTrue(font.info.ufoLibWriteValidate)

        setUfoLibReadValidate(True)
        setUfoLibWriteValidate(False)
        font = Font()
        self.assertTrue(font.ufoLibReadValidate)
        self.assertFalse(font.ufoLibWriteValidate)
        self.assertTrue(font.info.ufoLibReadValidate)
        self.assertFalse(font.info.ufoLibWriteValidate)