glifLib.py 文件源码

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

项目:otRebuilder 作者: Pal3love 项目源码 文件源码
def writeLayerInfo(self, info):
        if self.ufoFormatVersion < 3:
            raise GlifLibError("layerinfo.plist is not allowed in UFO %d." % self.ufoFormatVersion)
        # gather data
        infoData = {}
        for attr in list(layerInfoVersion3ValueData.keys()):
            if hasattr(info, attr):
                try:
                    value = getattr(info, attr)
                except AttributeError:
                    raise GlifLibError("The supplied info object does not support getting a necessary attribute (%s)." % attr)
                if value is None or (attr == 'lib' and not value):
                    continue
                infoData[attr] = value
        # validate
        infoData = validateLayerInfoVersion3Data(infoData)
        # write file
        path = os.path.join(self.dirName, LAYERINFO_FILENAME)
        with open(path, "wb") as f:
            writePlist(infoData, f)

    # read caching
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号