summaryrefslogtreecommitdiff
path: root/third_party/freetype-py/doc/make_enums.py
blob: f87c67786eeda3be56cf02a93cc518c3c26663e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import freetype

enums = [
    'ft_fstypes',
    'ft_face_flags',
    'ft_encodings',
    'ft_glyph_bbox_modes',
    'ft_glyph_formats',
    'ft_kerning_modes',
    'ft_lcd_filters',
    'ft_load_flags',
    'ft_load_targets',
    'ft_open_modes',
    'ft_outline_flags',
    'ft_pixel_modes',
    'ft_render_modes',
    'ft_stroker_borders',
    'ft_stroker_linecaps',
    'ft_stroker_linejoins',
    'ft_style_flags',
    'tt_adobe_ids',
    'tt_apple_ids',
    'tt_mac_ids',
    'tt_ms_ids',
    'tt_ms_langids',
    'tt_mac_langids',
    'tt_name_ids',
    'tt_platforms'
]

for name in enums:
    print name
    module = getattr(freetype, name)
    doc = getattr(module, '__doc__')
    doc = doc.split('\n')
    file = open( name+'.rst', 'w')

    title = name.upper()
    file.write(title+'\n')
    file.write('='*len(title)+'\n')

    for line in doc:
        if line.startswith('FT_') or line.startswith('TT_'):
            file.write( '.. data:: '+ line + '\n')
        else:
            file.write( line + '\n')
    file.close()