File: makeccmpcomp.py

package info (click to toggle)
fonts-ebgaramond 0.016-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 141,248 kB
  • ctags: 72
  • sloc: python: 919; makefile: 90
file content (19 lines) | stat: -rw-r--r-- 762 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
import argparse
from glyphcomponents import glyphComponents

argparser = argparse.ArgumentParser(description=
    'Writes the feature file (ccmpcomp.fea) for glyph composition '
    '(the "ccmp" table in OpenType) for a given style.')
argparser.add_argument('style', 
                       help='The style for which to generate the ccmp feature file. '
                            'Actually the directory names in ../featurefiles, so e.g. "Regular".')
style = argparser.parse_args().style

with open('../featurefiles/%s/ccmpcomp.fea' % style, 'w') as f:
    f.write('lookup CCMP_Precomp {\n')
    
    for sub, by in glyphComponents.iteritems():
        f.write('    sub ' + sub + ' by ' + " ".join(by) + ' ;\n')
    
    f.write('} CCMP_Precomp;\n')