Ejemplo n.º 1
0
from bakery_cli.logger import logger
from bakery_cli.fixers import ResetFSTypeFlagFixer


description = 'Fixes TTF fsType to 0'

parser = argparse.ArgumentParser(description=description)
parser.add_argument('ttf_font', nargs='+',
                    help="Font in OpenType (TTF/OTF) format")
parser.add_argument('--autofix', action="store_true",
                    help="Autofix font metrics")
parser.add_argument('--verbose', action='store_true',
                    help='Print output in verbose')

args = parser.parse_args()

if args.verbose:
    logger.setLevel(logging.INFO)

for path in args.ttf_font:
    if not os.path.exists(path):
        continue

    fixer = ResetFSTypeFlagFixer(None, path)

    if args.autofix:
        fixer.apply()
    else:
        fixer.fix(check=True)
Ejemplo n.º 2
0
description = ''

parser = argparse.ArgumentParser(description=description)
parser.add_argument('ttf_font', nargs='+',
                    help="Font in OpenType (TTF/OTF) format")
parser.add_argument('--autofix', action="store_true",
                    help="Autofix font metrics")
parser.add_argument('--verbose', action='store_true',
                    help='Print output in verbose')

args = parser.parse_args()


if args.verbose:
    logger.setLevel(logging.DEBUG)


class FixNotApplied(Exception):

    def __init__(self, message):
        self.message = message


def fontStyleIsBold(fontStyle):
    try:
        fontStyle.index('Bold')
    except ValueError:
        return False
    return True