X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ffont2swf.c;h=36ac40b0a2a78d01193b69ed94b671b2a6c71830;hb=f0f4599a8cc05f18859d2bb8d0afe447f3e00813;hp=6e355a775672c75153cbbe8bef0308f2f594a9f9;hpb=f9cd3d326142683da50bf7095a8b8985c01b13e2;p=swftools.git diff --git a/src/font2swf.c b/src/font2swf.c index 6e355a7..36ac40b 100644 --- a/src/font2swf.c +++ b/src/font2swf.c @@ -30,15 +30,16 @@ 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[] = -{ - {"a","all"}, - {"o","output"}, - {"v","verbose"}, - {"V","version"}, - {0,0} +static struct options_t options[] = { +{"h", "help"}, +{"v", "verbose"}, +{"o", "output"}, +{"V", "version"}, +{0,0} }; + int args_callback_option(char*name,char*val) { if(!strcmp(name, "V")) { @@ -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; @@ -67,22 +72,24 @@ int args_callback_longoption(char*name,char*val) { return args_long2shortoption(options, name, val); } -void args_callback_usage(char*name) -{ +void args_callback_usage(char *name) +{ printf("\n"); - printf("Usage: %s [...]\n", name); - printf(" OR: %s --all\n", name); + printf("Usage: %s \n", name); printf("\n"); - printf("Options:\n"); - printf("\t-h , --help\t\t Print help and exit\n"); - printf("\t-o , --output filename\t set output filename\n"); - printf("\t-a , --all\t\tGenerate a set of standard fonts into the current directory\n"); - printf("\t-v , --verbose\t\t Be more verbose\n"); - printf("\t-V , --version\t\t Print program version and exit\n"); + printf("-h , --help Print short help message and exit\n"); + printf("-v , --verbose Be verbose. Use more than one -v for greater effect.\n"); + printf("-n , --name Name of the font (class) in the output file\n"); + printf("-o , --output Write output to file .\n"); + printf("-V , --version Print version info and exit\n"); printf("\n"); } int args_callback_command(char*name,char*val) { + if(filename) { + fprintf(stderr, "Please specify only one font\n"); + exit(1); + } filename = name; return 0; } @@ -93,6 +100,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); }