From f9a117db99d9d7e742d7971ce71c11587da2f19d Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 3 Mar 2002 19:18:42 +0000 Subject: --outdir added git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4936 b3059339-0415-0410-9bf9-f77b7e298cf2 --- TOOLS/subfont-c/subfont.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'TOOLS/subfont-c') diff --git a/TOOLS/subfont-c/subfont.c b/TOOLS/subfont-c/subfont.c index 74a24affaf..15729fb38a 100644 --- a/TOOLS/subfont-c/subfont.c +++ b/TOOLS/subfont-c/subfont.c @@ -46,6 +46,8 @@ double thickness = 1.5; /* outline thickness */ char* font_desc = "font.desc"; //char* font_desc = "/dev/stdout"; +char *outdir = "."; + //// constants int const colors = 256; int const maxcolor = 255; @@ -122,7 +124,7 @@ void write_bitmap(void *buffer, char type) { int const max_name = 128; char name[max_name]; - snprintf(name, max_name, "%s-%c.raw", encoding_name, type); + snprintf(name, max_name, "%s/%s-%c.raw", outdir, encoding_name, type); f = fopen(name, "wb"); if (f==NULL) ERROR("fopen failed."); write_header(f); @@ -228,7 +230,13 @@ void render() { /* create font.desc */ - f = fopen(font_desc, append_mode ? "a":"w"); +{ + int const max_name = 128; + char name[max_name]; + + snprintf(name, max_name, "%s/%s", outdir, font_desc); + f = fopen(name, append_mode ? "a":"w"); +} if (f==NULL) ERROR("fopen failed."); @@ -668,10 +676,11 @@ void alpha() { void usage() { - printf("Usage: %s [--append] [--unicode] [--blur b] [--outline o] encoding ppem font\n", command); + printf("Usage: %s [--outdir dir] [--append] [--unicode] [--blur b] [--outline o] encoding ppem font\n", command); printf("\n" " Program creates 3 files: font.desc, -a.raw, -b.raw.\n" "\n" + " --outdir output directory to place files.\n" " --append append results to existing font.desc, suppress info header.\n" " --unicode use Unicode in font.desc. This will work with -utf8 option of mplayer.\n" " --blur b specify blur radius, float.\n" @@ -694,6 +703,14 @@ void parse_args(int argc, char **argv) { else ++command; ++a; --argc; + if (argc>=1 && strcmp(argv[a], "--outdir")==0) { + ++a; --argc; + if (argc==0) usage(); + + outdir = strdup(argv[a]); + ++a; --argc; + } + if (argc>=1 && strcmp(argv[a], "--append")==0) { append_mode = 1; ++a; --argc; -- cgit v1.2.3