How to use the cffsubr.subroutinize function in cffsubr

To help you get started, we’ve selected a few cffsubr 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 alif-type / mada / tools / mkinstance.py View on Github external
from fontTools.pens.ttGlyphPen import TTGlyphPen
            pen = TTGlyphPen(None)
            path.draw(pen)
            ttGlyphs[name] = pen.glyph()
        else:
            from fontTools.pens.t2CharStringPen import T2CharStringPen
            charString = charStrings[name]
            pen = T2CharStringPen(None, None, CFF2=CFF2)
            path.draw(pen)
            charStrings[name] = pen.getCharString(charString.private)
            if not CFF2:
                charStrings[name].program.insert(0, charString.width)

    if charStrings is not None:
        from cffsubr import subroutinize
        subroutinize(font, cff_version=1)
github googlefonts / ufo2ft / Lib / ufo2ft / postProcessor.py View on Github external
def _subroutinize_with_cffsubr(cls, otf, cffVersion):
        import cffsubr

        cffInputVersion = cls._get_cff_version(otf)
        assert cffInputVersion is not None, "Missing required 'CFF ' or 'CFF2' table"

        msg = f"Subroutinizing {cffInputVersion.name} table with cffsubr"
        if cffInputVersion != cffVersion:
            msg += f" (output format: {cffVersion.name})"
        logger.info(msg)

        return cffsubr.subroutinize(otf, cff_version=cffVersion, keep_glyph_names=False)
github alif-type / mada / tools / rmoverlap.py View on Github external
charStrings = font["CFF "].cff.topDictIndex[0].CharStrings
    for name in names:
        glyph = glyphs[name]
        path = Path()
        glyph.draw(path.getPen())
        path.simplify(fix_winding=True, keep_starting_points=True)
        if charStrings is not None:
            charString = charStrings[name]
            pen = T2CharStringPen(None, None, CFF2=CFF2)
            path.draw(pen)
            charStrings[name] = pen.getCharString(charString.private)
            if not CFF2:
                charStrings[name].program.insert(0, charString.width)

    if charStrings is not None:
        subroutinize(font, cff_version=1)
        font["post"].formatType = 3.0

    font.save(options.output)

cffsubr

Standalone CFF subroutinizer based on the AFDKO tx tool

Apache-2.0
Latest version published 11 months ago

Package Health Score

50 / 100
Full package analysis

Popular cffsubr functions