| 1 | import os |
| 2 | import argparse |
| 3 | from glyphcomponents import glyphComponents |
| 4 | |
| 5 | argparser = argparse.ArgumentParser(description= |
| 6 | 'Writes the feature file (ccmpcomp.fea) for glyph composition ' |
| 7 | '(the "ccmp" table in OpenType) for a given style.') |
| 8 | argparser.add_argument('style', |
| 9 | help='The style for which to generate the ccmp feature file. ' |
| 10 | 'Actually the directory names in ../featurefiles, so e.g. "Regular".') |
| 11 | style = argparser.parse_args().style |
| 12 | |
| 13 | with open('../featurefiles/%s/ccmpcomp.fea' % style, 'w') as f: |
| 14 | f.write('lookup CCMP_Precomp {\n') |
| 15 | |
| 16 | for sub, by in glyphComponents.iteritems(): |
| 17 | f.write(' sub ' + sub + ' by ' + " ".join(by) + ' ;\n') |
| 18 | |
| 19 | f.write('} CCMP_Precomp;\n') |