Fills in the Panose values for a font based on the style name. Uses the panoseWeightMap to set weight values, the presense of 'Mono' to set if it's monospaced, and the presense of 'Italic' to set if it's oblique. 'Casual' and 'Linear' trigger settings for the style. *font*
(font, weight)
| 98 | |
| 99 | |
| 100 | def fillInPanoseValues(font, weight): |
| 101 | """ |
| 102 | Fills in the Panose values for a font based on the style name. |
| 103 | Uses the panoseWeightMap to set weight values, the presense of |
| 104 | 'Mono' to set if it's monospaced, and the presense of 'Italic' to |
| 105 | set if it's oblique. 'Casual' and 'Linear' trigger settings for |
| 106 | the style. |
| 107 | |
| 108 | *font* is a font object (Defcon or FontParts) |
| 109 | *weight* is a `string` of the font's weight value |
| 110 | """ |
| 111 | |
| 112 | names = font.info.postscriptFullName.split() |
| 113 | |
| 114 | if names[1] == "Mono" or names[1] == "Mn": |
| 115 | prop = 9 |
| 116 | else: |
| 117 | prop = 4 |
| 118 | |
| 119 | if "Italic" in names: |
| 120 | form = 11 |
| 121 | else: |
| 122 | form = 4 |
| 123 | |
| 124 | wght = weightMap[weight][1] |
| 125 | |
| 126 | if names[2] == "Csl": |
| 127 | font.info.openTypeOS2Panose = [2, 15, wght, prop, 5, 5, 2, form, 3, 4] |
| 128 | else: |
| 129 | font.info.openTypeOS2Panose = [2, 11, wght, prop, 4, 2, 2, form, 2, 4] |
| 130 | |
| 131 | |
| 132 | def buildTTFfiles(cff_root, ttf_root): |