Skip to content

Commit

Permalink
Do not write empty keys (#89)
Browse files Browse the repository at this point in the history
This adds two if-conditions to check if layer-lib keys are empty.

- in the lib of every `layerinfo.plist`, write the `org.unifiedfontobject.normalizer.imageReferences` dict only if there are images in the UFO
- consequently, only write the lib in `layerinfo.plist` if it does contain anything at all
  • Loading branch information
frankrolf authored Sep 10, 2021
1 parent f28ef21 commit 2d4c06c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/ufonormalizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,10 @@ def normalizeGlyphsDirectory(ufoPath, layerDirectory,
modTimes[fileName] = subpathGetModTime(ufoPath, layerDirectory, fileName)
if writeModTimes:
storeModTimes(layerLib, modTimes)
storeImageReferences(layerLib, imageReferences)
layerInfo["lib"] = layerLib
if imageReferences:
storeImageReferences(layerLib, imageReferences)
if layerLib:
layerInfo["lib"] = layerLib
subpathWritePlist(layerInfo, ufoPath, layerDirectory, "layerinfo.plist")
normalizeLayerInfoPlist(ufoPath, layerDirectory)
referencedImages = set(imageReferences.values())
Expand Down

0 comments on commit 2d4c06c

Please sign in to comment.