How to use the psautohint.ufoFont.norm_float function in psautohint

To help you get started, we’ve selected a few psautohint 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 adobe-type-tools / afdko / python / afdko / ufotools.py View on Github external
def _rd_val(str_val):
        """Round and normalize a (string) GLIF value"""
        return repr(norm_float(round(ast.literal_eval(str_val), 9)))
github adobe-type-tools / afdko / python / afdko / ufotools.py View on Github external
def buildGlyphHashValue(self, width, outlineXML, glyphName,
                            useDefaultGlyphDir, level=0):
        """
        glyphData must be the official  XML from a GLIF.
        We skip contours with only one point.
        """
        dataList = ["w%s" % norm_float(round(width, 9))]
        if level > 10:
            raise UFOParseError(
                "In parsing component, exceeded 10 levels of reference. "
                "'%s'. " % (glyphName))
        #  tag is optional per spec., e.g. space glyph
        # does not necessarily have it.
        if outlineXML is not None:
            for childContour in outlineXML:
                if childContour.tag == "contour":
                    if len(childContour) < 2:
                        continue
                    for child in childContour:
                        if child.tag == "point":
                            ptType = child.get("type")
                            pointType = '' if ptType is None else ptType[0]
                            x = self._rd_val(child.get("x"))

psautohint

Python wrapper for Adobe's PostScript autohinter

Apache-2.0
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis

Similar packages