本文整理汇总了Python中bakery_cli.ttfont.Font.get_bounding方法的典型用法代码示例。如果您正苦于以下问题:Python Font.get_bounding方法的具体用法?Python Font.get_bounding怎么用?Python Font.get_bounding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bakery_cli.ttfont.Font
的用法示例。
在下文中一共展示了Font.get_bounding方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: metricfix
# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import get_bounding [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')
示例2: apply
# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import get_bounding [as 别名]
def apply(self, override_origin=False):
from bakery_cli.ttfont import Font
ymin = 0
ymax = 0
for f in self.fonts:
metrics = Font(f)
font_ymin, font_ymax = metrics.get_bounding()
ymin = min(font_ymin, ymin)
ymax = max(font_ymax, ymax)
for f in self.fonts:
fixer = VmetFixer(self.testcase, f)
fixer.apply(ymin, ymax, override_origin=override_origin)
command = "$ {0} {1}".format(Vmet.SCRIPTPATH, ' '.join(self.fonts))
logger.debug(command)
import StringIO
for l in StringIO.StringIO(metricview(self.fonts)):
logger.debug(l)
示例3: Font
# 需要导入模块: from bakery_cli.ttfont import Font [as 别名]
# 或者: from bakery_cli.ttfont.Font import get_bounding [as 别名]
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:
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:
fixer = VmetFixer(None, f)
fixer.apply(ymin, ymax)
else:
print(vmet.metricview(fonts))