MCPcopy
hub / github.com/arrowtype/recursive / checkFamilyName

Function checkFamilyName

mastering/prep_fonts.py:155–174  ·  view source on GitHub ↗

Checks that all the sources for a designspace have the same family name. Returns `True` if so, prints an error and returns `False` if not. *fonts* is a `list` of font objects (Defcon or FontParts).

(fonts)

Source from the content-addressed store, hash-verified

153
154
155def checkFamilyName(fonts):
156 """
157 Checks that all the sources for a designspace have the same family name.
158
159 Returns `True` if so, prints an error and returns `False` if not.
160
161 *fonts* is a `list` of font objects (Defcon or FontParts).
162 """
163
164 familyName = []
165 for font in fonts:
166 if font.info.familyName not in familyName:
167 familyName.append(font.info.familyName)
168
169 if len(familyName) != 1:
170 print("🛑 source UFOs have different family names, stopping")
171 print(f"{', '.join(familyName)}")
172 return False
173 else:
174 return True
175
176
177def clearGuides(font):

Callers 1

prepFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected