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)
| 153 | |
| 154 | |
| 155 | def 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 | |
| 177 | def clearGuides(font): |