Created
November 26, 2025 14:18
-
-
Save anthrotype/81ac440a267e4828f63a0ab23bc48533 to your computer and use it in GitHub Desktop.
Find masters with duplicate Link Metrics With Master parameters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| """Find masters with duplicate Link Metrics With Master parameters.""" | |
| import sys | |
| from glyphsLib import GSFont | |
| font = GSFont(sys.argv[1]) | |
| duplicates_found = 0 | |
| for master in font.masters: | |
| link_params = [] | |
| for param in master.customParameters: | |
| if param.name == "Link Metrics With Master": | |
| link_params.append(param.value) | |
| if len(link_params) > 1: | |
| duplicates_found += 1 | |
| print(f"Master: {master.name}") | |
| print(f" ID: {master.id}") | |
| for i, val in enumerate(link_params): | |
| # Find what master this ID corresponds to | |
| target_name = "unknown" | |
| for m in font.masters: | |
| if m.id == val: | |
| target_name = m.name | |
| break | |
| print(f" Link Metrics With Master [{i + 1}]: {val}") | |
| print(f" -> {target_name}") | |
| print() | |
| print(f"Total masters with duplicates: {duplicates_found}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment