当前位置: 首页>>代码示例>>Python>>正文


Python Font.save方法代码示例

本文整理汇总了Python中bakery_cli.ttfont.Font.save方法的典型用法代码示例。如果您正苦于以下问题:Python Font.save方法的具体用法?Python Font.save怎么用?Python Font.save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bakery_cli.ttfont.Font的用法示例。


在下文中一共展示了Font.save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fix_style_names

# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import save [as 别名]
def fix_style_names(fontpath):
    from bakery_cli.ttfont import Font
    try:
        font = Font(fontpath)
    except TTLibError as ex:
        print("ERROR: %s" % ex)
        return
    # font['name'].fsType = 0
    font.save(fontpath + '.fix')
开发者ID:anthrotype,项目名称:fontbakery,代码行数:11,代码来源:stylenames.py

示例2: reset_fstype

# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import save [as 别名]
def reset_fstype(fontpath):
    from bakery_cli.ttfont import Font
    try:
        font = Font(fontpath)
    except TTLibError as ex:
        print("ERROR: %s" % ex, file=sys.stderr)
        return
    font['OS/2'].fsType = 0
    font.save(fontpath + '.fix')
开发者ID:anthrotype,项目名称:fontbakery,代码行数:11,代码来源:fstype.py

示例3: metricfix

# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import save [as 别名]
def metricfix(fonts):
    from bakery_cli.ttfont import Font
    ymin = 0
    ymax = 0

    for f in fonts:
        metrics = Font(f)
        font_ymin, font_ymax = metrics.get_bounding()
        ymin = min(font_ymin, ymin)
        ymax = max(font_ymax, ymax)

    for f in fonts:
        metrics = Font(f)
        metrics.ascents.set(ymax)
        metrics.descents.set(ymin)
        metrics.linegaps.set(0)
        metrics.save(f + '.fix')
开发者ID:lowks,项目名称:fontbakery-cli,代码行数:19,代码来源:vmet.py

示例4: fix_name_table

# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import save [as 别名]
def fix_name_table(fontfile):
    try:
        font = Font(fontfile)
    except TTLibError:
        print("Unable to open {}".format(os.path.basename(fontfile)),
              file=sys.stderr)
        return

    for name in font['name'].names:
        title = Font.bin2unistring(name)
        title = normalizestr(title)
        if name.platformID == 3:
            name.string = title.encode('utf-16-be')
        else:
            name.string = title

    font.save(fontfile + '.fix')
开发者ID:anthrotype,项目名称:fontbakery,代码行数:19,代码来源:ascii.py

示例5: Font

# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import save [as 别名]
    for f in fonts:
        try:
            metrics = Font(f)
        except TTLibError, ex:
            print('Error: %s' % ex)
            continue

        # set ascents, descents and linegaps. FontVerticalMetrics will
        # not set those values if None, and overwrite them if concrete
        # argument has been passed
        metrics.ascents.set(options.ascents)
        metrics.descents.set(options.descents)
        metrics.linegaps.set(options.linegaps)

        metrics.ascents.hhea = options.ascents_hhea
        metrics.ascents.os2typo = options.ascents_typo
        metrics.ascents.os2win = options.ascents_win

        metrics.descents.hhea = options.descents_hhea
        metrics.descents.os2typo = options.descents_typo
        metrics.descents.os2win = options.descents_win

        metrics.linegaps.hhea = options.linegaps_hhea
        metrics.linegaps.os2typo = options.linegaps_typo
        metrics.save(f + '.fix')

elif options.autofix:
    vmet.metricfix(fonts)
else:
    print(vmet.metricview(fonts))
开发者ID:lowks,项目名称:fontbakery-cli,代码行数:32,代码来源:bakery-vmet-fix.py


注:本文中的bakery_cli.ttfont.Font.save方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。