| 182 | |
| 183 | |
| 184 | def getsubset(subset, font_in): |
| 185 | subsets = subset.split('+') |
| 186 | quotes = [ |
| 187 | 0x2013, # endash |
| 188 | 0x2014, # emdash |
| 189 | 0x2018, # quoteleft |
| 190 | 0x2019, # quoteright |
| 191 | 0x201A, # quotesinglbase |
| 192 | 0x201C, # quotedblleft |
| 193 | 0x201D, # quotedblright |
| 194 | 0x201E, # quotedblbase |
| 195 | 0x2022, # bullet |
| 196 | 0x2039, # guilsinglleft |
| 197 | 0x203A, # guilsinglright |
| 198 | ] |
| 199 | |
| 200 | latin = [ |
| 201 | *range(0x20, 0x7f), # Basic Latin (A-Z, a-z, numbers) |
| 202 | *range(0xa0, 0x100), # Western European symbols and diacritics |
| 203 | 0x20ac, # Euro |
| 204 | 0x0152, # OE |
| 205 | 0x0153, # oe |
| 206 | 0x003b, # semicolon |
| 207 | 0x00b7, # periodcentered |
| 208 | 0x0131, # dotlessi |
| 209 | 0x02c6, # circumflex |
| 210 | 0x02da, # ring |
| 211 | 0x02dc, # tilde |
| 212 | 0x2074, # foursuperior |
| 213 | 0x2215, # division slash |
| 214 | 0x2044, # fraction slash |
| 215 | 0xe0ff, # PUA: Font logo |
| 216 | 0xeffd, # PUA: Font version number |
| 217 | 0xf000, # PUA: font ppem size indicator: run |
| 218 | # `ftview -f 1255 10 Ubuntu-Regular.ttf` to see it in action! |
| 219 | ] |
| 220 | |
| 221 | result = quotes |
| 222 | |
| 223 | if 'menu' in subsets: |
| 224 | font = fontforge.open(font_in) |
| 225 | result = [ |
| 226 | *map(ord, font.familyname), |
| 227 | 0x0020, |
| 228 | ] |
| 229 | |
| 230 | if 'latin' in subsets: |
| 231 | result += latin |
| 232 | if 'latin-ext' in subsets: |
| 233 | # These ranges include Extended A, B, C, D, and Additional with the |
| 234 | # exception of Vietnamese, which is a separate range |
| 235 | result += [ |
| 236 | *range(0x100, 0x370), |
| 237 | *range(0x1d00, 0x1ea0), |
| 238 | *range(0x1ef2, 0x1f00), |
| 239 | *range(0x2070, 0x20d0), |
| 240 | *range(0x2c60, 0x2c80), |
| 241 | *range(0xa700, 0xa800), |