How to use psautohint - 6 common examples

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 / makeinstancesufo.py View on Github external
fontInstancePath)
        co_args = ['-e', '-q', fontInstancePath]
        if options.no_round:
            co_args.insert(0, '-d')
        try:
            checkoutlinesUFO(co_args)
        except (Exception, SystemExit):
            raise

    if options.doAutoHint:
        logger.info("Running psautohint on %s ..." % fontInstancePath)
        ah_args = ['--no-zones-stems', fontInstancePath]
        if options.no_round:
            ah_args.insert(0, '-d')
        try:
            psautohint(ah_args)
        except (Exception, SystemExit):
            raise
github adobe-type-tools / afdko / python / afdko / ufotools.py View on Github external
def _get_glyph_width(glyph):
    hash_pen = HashPointPen(glyph)
    glyph.drawPoints(hash_pen)
    return getattr(glyph, 'width', 0)
github adobe-type-tools / afdko / python / afdko / ufotools.py View on Github external
def recalcHashEntry(self, glyphName, glyph):
        hashBefore, historyList = self.hashMap[glyphName]

        hash_pen = HashPointPen(glyph)
        glyph.drawPoints(hash_pen)
        hashAfter = hash_pen.getHash()

        if hashAfter != hashBefore:
            self.hashMap[glyphName] = [hashAfter, historyList]
            self.hashMapChanged = True
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"))
github adobe-type-tools / afdko / python / afdko / ufotools.py View on Github external
def convertGLIFToBez(ufoFontData, glyphName, doAll=0):
    width, skip = ufoFontData.getOrSkipGlyph(glyphName, doAll)
    if skip:
        return None, width

    glyph = ufoFontData.glyphSet[glyphName]
    round_coords = not ufoFontData.allowDecimalCoords
    bez = psahUFOFontData.get_glyph_bez(glyph, round_coords)
    bezString = "\n".join(bez)
    bezString = "\n".join(["% " + glyphName, "sc", bezString, "ed", ""])

    return bezString, width

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