How to use the cu2qu.ufo.CURVE_TYPE_LIB_KEY function in cu2qu

To help you get started, we’ve selected a few cu2qu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github googlefonts / ufo2ft / Lib / ufo2ft / filters / cubicToQuadratic.py View on Github external
elif curve_type == "cubic":
                    pass  # keep converting
                else:
                    raise NotImplementedError(curve_type)

        modified = super(CubicToQuadraticFilter, self).__call__(font, glyphSet)
        if modified:
            stats = self.context.stats
            logger.info(
                "New spline lengths: %s"
                % (", ".join("%s: %d" % (l, stats[l]) for l in sorted(stats.keys())))
            )

        if self.options.rememberCurveType:
            # 'lib' here is the layer's lib, as defined in for loop variable
            curve_type = lib.get(CURVE_TYPE_LIB_KEY, "cubic")
            if curve_type != "quadratic":
                lib[CURVE_TYPE_LIB_KEY] = "quadratic"

        return modified
github googlefonts / ufo2ft / Lib / ufo2ft / filters / cubicToQuadratic.py View on Github external
def __call__(self, font, glyphSet=None):
        if self.options.rememberCurveType:
            # check first in the global font lib, then in layer lib
            for lib in (font.lib, getattr(glyphSet, "lib", {})):
                curve_type = lib.get(CURVE_TYPE_LIB_KEY, "cubic")
                if curve_type == "quadratic":
                    logger.info("Curves already converted to quadratic")
                    return set()
                elif curve_type == "cubic":
                    pass  # keep converting
                else:
                    raise NotImplementedError(curve_type)

        modified = super(CubicToQuadraticFilter, self).__call__(font, glyphSet)
        if modified:
            stats = self.context.stats
            logger.info(
                "New spline lengths: %s"
                % (", ".join("%s: %d" % (l, stats[l]) for l in sorted(stats.keys())))
            )

cu2qu

Cubic-to-quadratic bezier curve conversion

MIT
Latest version published 2 years ago

Package Health Score

66 / 100
Full package analysis

Similar packages