added gfx2gfx to Makefile, small fix in as3compile
[swftools.git] / src / font2swf.c
index be8134b..cd30118 100644 (file)
@@ -30,6 +30,7 @@ static char * filename = 0;
 static char * destfilename = "output.swf";
 static int all=0;
 static int verbose=0;
+static char * fontname = 0;
 
 static struct options_t options[] = {
 {"h", "help"},
@@ -53,6 +54,10 @@ int args_callback_option(char*name,char*val)
        verbose ++;
        return 0;
     }
+    else if(!strcmp(name, "n")) {
+       fontname = val;
+       return 1;
+    }
     else if(!strcmp(name, "a")) {
        all = 1;
        return 0;
@@ -80,6 +85,10 @@ void args_callback_usage(char *name)
 }
 int args_callback_command(char*name,char*val)
 {
+    if(filename) {
+        fprintf(stderr, "Please specify only one font\n");
+        exit(1);
+    }
     filename = name;
     return 0;
 }
@@ -90,6 +99,9 @@ static void convertFont(char*infile, char*outfile)
     
     font = swf_LoadFont(infile);
 
+    if(fontname)
+        font->name = strdup(fontname);
+
     swf_WriteFont(font, outfile);
     swf_FontFree(font);
 }