enrich-glypnames.py 文件源码

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

项目:inter 作者: rsms 项目源码 文件源码
def renameUFOLib(ufoPath, newNames, dryRun=False, print=print):
  filename = os.path.join(ufoPath, 'lib.plist')
  plist = plistlib.readPlist(filename)

  glyphOrder = plist.get('public.glyphOrder')
  if glyphOrder is not None:
    plist['public.glyphOrder'] = renameStrings(glyphOrder, newNames)

  roboSort = plist.get('com.typemytype.robofont.sort')
  if roboSort is not None:
    for entry in roboSort:
      if isinstance(entry, dict) and entry.get('type') == 'glyphList':
        asc = entry.get('ascending')
        desc = entry.get('descending')
        if asc is not None:
          entry['ascending'] = renameStrings(asc, newNames)
        if desc is not None:
          entry['descending'] = renameStrings(desc, newNames)

  print('Writing', filename)
  if not dryRun:
    plistlib.writePlist(plist, filename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号