X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ffont2swf.c;h=36ac40b0a2a78d01193b69ed94b671b2a6c71830;hb=f0f4599a8cc05f18859d2bb8d0afe447f3e00813;hp=be8134b124e8e99d0c9f6d0f02a9b34e51296176;hpb=6f3e9add89a0157ef6552bc154475b43b371e615;p=swftools.git diff --git a/src/font2swf.c b/src/font2swf.c index be8134b..36ac40b 100644 --- a/src/font2swf.c +++ b/src/font2swf.c @@ -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; @@ -74,12 +79,17 @@ void args_callback_usage(char *name) printf("\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; } @@ -90,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); }