Commits

Akira TAGOH  committed 6f63002

Update for new APIs

  • Participants
  • Parent commits 98bd24e

Comments (0)

Files changed (1)

File tests/ezfc-tool.py

     opts, args = getopt.getopt(argv, 'a:hl:',
                                ['alias=', 'help', 'lang=', 'no-load',
                                 'hinting=', 'autohint=', 'antialias=',
-                                'embeddedbitmap='])
+                                'embeddedbitmap=', 'rgba=', 'hintstyle='])
     opts.append(('', None)) # just to ensure entering the loop
     loadconf = True
     alias = None
     autohint = None
     antialias = None
     embeddedbitmap = None
+    rgba = None
+    hintstyle = None
     for o, a in opts:
         if o in ('-h', '--help') or len(args) != 1:
             print 'Usage: %s add [options] <family>' % os.path.basename(sys.argv[0])
             print '  --autohint=<bool>        Set a boolean value for auto-hinting'
             print '  --antialias=<bool>       Set a boolean value for antialiasing'
             print '  --embeddedbitmap=<bool>  Set a boolean value for embeddedbitmap'
+            print '  --rgba=<const>           Set rgba'
+            print '  --hintstyle=<const>      Set hintstyle'
             sys.exit()
         elif o in ('-a', '--alias'):
             alias = a
                 embeddedbitmap = True
             else:
                 embeddedbitmap = False
+        elif o == '--rgba':
+            map = {
+                'unknown': 0,
+                'rgb': 1,
+                'bgr': 2,
+                'vrgb': 3,
+                'vbgr': 4,
+                'none': 5,
+                }
+            if map.has_key(a.lower()):
+                rgba = map[a.lower()]
+        elif o == '--hintstyle':
+            map = {
+                'hintnone': 1,
+                'hintslight': 2,
+                'hintmedium': 3,
+                'hintfull': 4,
+                }
+            if map.has_key(a.lower()):
+                hintstyle = map[a.lower()]
 
-    if (hinting != None or autohint != None or antialias != None or embeddedbitmap != None) and alias != None:
-        print "E: --alias can't be used with --hinting, --autohint, --antialias or --embeddedbitmap"
+    if (hinting != None or autohint != None or antialias != None or embeddedbitmap != None or rgba != None or hintstyle != None) and alias != None:
+        print "E: --alias can't be used with --hinting, --autohint, --antialias, --embeddedbitmap, --rgba or --hintstyle"
         sys.exit()
 
     config = Easyfc.Config()
         config.add_alias(lang, eza)
         msg = '%s has been added as the alias of %s for %s' % (args[0], alias, lang)
     else:
-        ezf = Easyfc.Font.new()
+        ezf = Easyfc.Font()
         ezf.set_family(args[0])
         amsg = []
         if hinting != None:
         if embeddedbitmap != None:
             ezf.set_embedded_bitmap(embeddedbitmap)
             amsg.append('embedded bitmap is %s for %s' % ('enabled' if embeddedbitmap else 'disabled', args[0]))
+        if rgba != None:
+            ezf.set_rgba(rgba)
+            amsg.append('rgba is set to %s for %s' % (rgba, args[0]))
+        if hintstyle != None:
+            ezf.set_hintstyle(hintstyle)
+            amsg.append('hintstyle is set to %s for %s' % (hintstyle, args[0]))
+
         msg = '\n'.join(amsg)
         config.add_font(ezf)