fixup-kerning.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:inter 作者: rsms 项目源码 文件源码
def fixupGroups(fontPath, dstGlyphNames, srcToDstMap, dryRun, stats):
  filename = os.path.join(fontPath, 'groups.plist')
  groups = plistlib.readPlist(filename)
  groups2 = {}
  glyphToGroups = {}

  for groupName, glyphNames in groups.iteritems():
    glyphNames2 = []
    for glyphName in glyphNames:
      if glyphName in srcToDstMap:
        gn2 = srcToDstMap[glyphName]
        stats.renamedGlyphs[glyphName] = gn2
        glyphName = gn2
      if glyphName in dstGlyphNames:
        glyphNames2.append(glyphName)
        glyphToGroups[glyphName] = glyphToGroups.get(glyphName, []) + [groupName]
      else:
        stats.removedGlyphs.add(glyphName)
    if len(glyphNames2) > 0:
      groups2[groupName] = glyphNames2
    else:
      stats.removedGroups.add(groupName)

  print('Writing', filename)
  if not dryRun:
    plistlib.writePlist(groups2, filename)

  return groups2, glyphToGroups
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号