Skip to content

Commit 8858bdc

Browse files
committed
Add support for elidedFallbackName
Add a setter and getter for the doc.elidedFallbackName. This is already part of the DS5 work in fonttools. The name is added as attribute of the <axes> tag. doc.elidedFallbackName = None removes the name from the designspace
1 parent 62fee7a commit 8858bdc

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

Lib/ufoProcessor/ufoOperator.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,14 @@ def locationLabels(self, locationLabels):
424424
def variableFonts(self):
425425
return self.doc.variableFonts
426426

427+
@property
428+
def elidedFallbackName(self):
429+
return self.doc.elidedFallbackName
430+
431+
@elidedFallbackName.setter
432+
def elidedFallbackName(self, name):
433+
self.doc.elidedFallbackName = name
434+
427435
@property
428436
def writerClass(self):
429437
return self.doc.writerClass
@@ -448,7 +456,7 @@ def loadFonts(self, reload=False):
448456
# we have a logger before proceding.
449457
self.startLog()
450458
# check excluded glyphs and muted glyphs when making this list
451-
self.glyphNames = list({glyphname for font in self.fonts.values() for glyphname in font.keys()})
459+
self.glyphNames = list({glyphname for font in self.fonts.values() for glyphname in font.keys() if font is not None})
452460
if self._fontsLoaded and not reload:
453461
if self.debug:
454462
self.logger.info("\t\t-- loadFonts called, but fonts are loaded already and no reload requested")
@@ -2031,3 +2039,15 @@ def _copyFontInfo(self, sourceInfo, targetInfo):
20312039
doc.includeGlyph("glyphOne")
20322040
print(doc.reportExcludedGlyphs())
20332041
print(doc.lib)
2042+
2043+
# expose the doc elidedFallbackName
2044+
# add the elidedFallbackName attribute to the
2045+
# axes tag
2046+
print(doc.elidedFallbackName)
2047+
# this removes the attribute
2048+
doc.elidedFallbackName = None
2049+
# this sets the attribute
2050+
doc.elidedFallbackName = "Regular"
2051+
print(doc.elidedFallbackName)
2052+
doc.write(ds5Path)
2053+
print('ds5Path', ds5Path)

Tests/ds5/ds5.designspace

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version='1.0' encoding='UTF-8'?>
22
<designspace format="5.0">
3-
<axes>
3+
<axes elidedfallbackname="Regular">
44
<axis tag="wdth" name="width" minimum="400" maximum="1000" default="400">
55
<map input="400" output="400"/>
66
<map input="700" output="900"/>

0 commit comments

Comments
 (0)