To keep data in one place, we store how we want to break the static familes apart in the instance_names.csv file. Read this to get the correct family and style names for the static fonts.
()
| 33 | |
| 34 | |
| 35 | def buildNameMap(): |
| 36 | """ |
| 37 | To keep data in one place, we store how we want to break the static |
| 38 | familes apart in the instance_names.csv file. Read this to get the |
| 39 | correct family and style names for the static fonts. |
| 40 | """ |
| 41 | |
| 42 | import csv |
| 43 | names = {} |
| 44 | with open('data/instance_names.csv', newline='') as csvfile: |
| 45 | reader = csv.DictReader(csvfile) |
| 46 | for row in reader: |
| 47 | varFamily = row["Var Instance Family Name"] |
| 48 | varStyle = row["Var Instance Style Name"] |
| 49 | staticFamily = row["Static Family Name"] |
| 50 | staticStyle = row["Static Style Name"] |
| 51 | familymap = row["familymap"] |
| 52 | stylemap = row["stylemap"] |
| 53 | staticPS = row["Static postscript"] |
| 54 | if stylemap != "Regular": |
| 55 | fn = f"{familymap} {stylemap}" |
| 56 | else: |
| 57 | fn = f"{familymap}" |
| 58 | names[(varFamily, varStyle)] = (staticFamily, staticStyle, fn, |
| 59 | staticPS, familymap) |
| 60 | |
| 61 | return names |
| 62 | |
| 63 | |
| 64 | def getBlueScale(fonts): |