#!/usr/bin/env python
import sys;sys.path.append('./')
import scenethecizer
import lm_util
import pangocairo

google_fonts_url="https://github.com/google/fonts/archive/master.zip"

def list_fonts():
    fontnames = [f.get_name() for f in pangocairo.cairo_font_map_get_default().list_families()]
    print("\n".join(fontnames))
    print("\nTotal fonts available: %d"%len(fontnames))

def main():
    switches = {"quantum": "textlines", "letter_height": 30, 'plot_page': True, "max_pages_count": 0,
                "img_path_expr": "/tmp/example_ds/{}_{}.png","mode":"handwriting"}
    switches, help_str = lm_util.get_arg_switches(switches, argv=None)
    mode=switches['mode']
    del switches['mode']
    if mode == "handwriting":
        scenethecizer.demo_handwriting(**switches)
    elif mode == "printed":
        scenethecizer.demo_printed(**switches)
    elif mode == "listfonts":
        list_fonts()
    else:
        print("Mode "+mode+" unrecognized aborting.")
    sys.exit()

if __name__=="__main__":
    sys.path.append('./')
    print sys.path
    main()