X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Ffont2swf.c;h=972f2943084e17afb744fc427039ac6e299b77b5;hb=8589e0d1f5e47c05458033e750fd6182ca704fbe;hp=6e355a775672c75153cbbe8bef0308f2f594a9f9;hpb=f9cd3d326142683da50bf7095a8b8985c01b13e2;p=swftools.git diff --git a/src/font2swf.c b/src/font2swf.c index 6e355a7..972f294 100644 --- a/src/font2swf.c +++ b/src/font2swf.c @@ -30,15 +30,18 @@ static char * filename = 0; static char * destfilename = "output.swf"; static int all=0; static int verbose=0; +static char * fontname = 0; +static char config_flashtype = 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"}, +{"T", "flashtype"}, +{"o", "output"}, +{"V", "version"}, +{0,0} }; + int args_callback_option(char*name,char*val) { if(!strcmp(name, "V")) { @@ -53,6 +56,14 @@ int args_callback_option(char*name,char*val) verbose ++; return 0; } + else if(!strcmp(name, "T")) { + config_flashtype=1; + return 0; + } + else if(!strcmp(name, "n")) { + fontname = val; + return 1; + } else if(!strcmp(name, "a")) { all = 1; return 0; @@ -67,22 +78,23 @@ 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("-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; } @@ -91,7 +103,11 @@ static void convertFont(char*infile, char*outfile) { SWFFONT * font; - font = swf_LoadFont(infile); + font = swf_LoadFont(infile, config_flashtype); + swf_FontCreateAlignZones(font); + + if(fontname) + font->name = strdup(fontname); swf_WriteFont(font, outfile); swf_FontFree(font);