diff options
author | Tor Lillqvist <tml@iki.fi> | 2002-02-07 01:27:39 +0000 |
---|---|---|
committer | Tor Lillqvist <tml@src.gnome.org> | 2002-02-07 01:27:39 +0000 |
commit | 086c5d631cc7949d152415505012c88cce1c9ec8 (patch) | |
tree | 5eb50d6385083294445849cf47d6eab3b7d3c08e /examples | |
parent | 1858a68664742dea972e8ef22f4bdc220cdfa7c5 (diff) | |
download | pango-086c5d631cc7949d152415505012c88cce1c9ec8.tar.gz |
Accept also outfile name on command line, fopen it separately then. Needed
2002-02-07 Tor Lillqvist <tml@iki.fi>
* examples/pangoft2topgm.c (main): Accept also outfile name on
command line, fopen it separately then. Needed on Windows where
stdout is in text mode.
* modules/arabic/Makefile.am
* modules/hebrew/Makefile.am: Use -no-undefined on Windows,
otherwise libtool won't produce DLLs, and there will be no such to
install
Diffstat (limited to 'examples')
-rw-r--r-- | examples/pangoft2topgm.c | 21 | ||||
-rw-r--r-- | examples/renderdemo.c | 21 |
2 files changed, 30 insertions, 12 deletions
diff --git a/examples/pangoft2topgm.c b/examples/pangoft2topgm.c index db5c0c3c..f00294f6 100644 --- a/examples/pangoft2topgm.c +++ b/examples/pangoft2topgm.c @@ -134,6 +134,7 @@ split_paragraphs (char *text) int main(int argc, char *argv[]) { + FILE *outfile; int dpi_x = 100, dpi_y = 100; char *init_family = "sans"; int init_scale = 24; @@ -190,9 +191,9 @@ int main(int argc, char *argv[]) exit(1); } - if (argp + 1 != argc) + if (argp + 1 != argc && argp + 2 != argc) { - fprintf (stderr, "Usage: %s [options] FILE\n", prog_name); + fprintf (stderr, "Usage: %s [options] FILE [OUTFILE]\n", prog_name); exit(1); } @@ -202,6 +203,13 @@ int main(int argc, char *argv[]) if (!text) exit(1); + if (argp < argc) + outfile = fopen (argv[argp++], "wb"); + else + outfile = stdout; /* Problematic if freetype outputs warnings + * to stdout... + */ + context = pango_ft2_get_context (dpi_x, dpi_y); paragraphs = split_paragraphs (text); @@ -260,10 +268,11 @@ int main(int argc, char *argv[]) } /* Write it as pgm to output */ - printf("P5\n" - "%d %d\n" - "255\n", bitmap.width, bitmap.rows); - fwrite(bitmap.buffer, 1, bitmap.width * bitmap.rows, stdout); + fprintf(outfile, + "P5\n" + "%d %d\n" + "255\n", bitmap.width, bitmap.rows); + fwrite(bitmap.buffer, 1, bitmap.width * bitmap.rows, outfile); g_free (buf); } } diff --git a/examples/renderdemo.c b/examples/renderdemo.c index db5c0c3c..f00294f6 100644 --- a/examples/renderdemo.c +++ b/examples/renderdemo.c @@ -134,6 +134,7 @@ split_paragraphs (char *text) int main(int argc, char *argv[]) { + FILE *outfile; int dpi_x = 100, dpi_y = 100; char *init_family = "sans"; int init_scale = 24; @@ -190,9 +191,9 @@ int main(int argc, char *argv[]) exit(1); } - if (argp + 1 != argc) + if (argp + 1 != argc && argp + 2 != argc) { - fprintf (stderr, "Usage: %s [options] FILE\n", prog_name); + fprintf (stderr, "Usage: %s [options] FILE [OUTFILE]\n", prog_name); exit(1); } @@ -202,6 +203,13 @@ int main(int argc, char *argv[]) if (!text) exit(1); + if (argp < argc) + outfile = fopen (argv[argp++], "wb"); + else + outfile = stdout; /* Problematic if freetype outputs warnings + * to stdout... + */ + context = pango_ft2_get_context (dpi_x, dpi_y); paragraphs = split_paragraphs (text); @@ -260,10 +268,11 @@ int main(int argc, char *argv[]) } /* Write it as pgm to output */ - printf("P5\n" - "%d %d\n" - "255\n", bitmap.width, bitmap.rows); - fwrite(bitmap.buffer, 1, bitmap.width * bitmap.rows, stdout); + fprintf(outfile, + "P5\n" + "%d %d\n" + "255\n", bitmap.width, bitmap.rows); + fwrite(bitmap.buffer, 1, bitmap.width * bitmap.rows, outfile); g_free (buf); } } |