summaryrefslogtreecommitdiff
path: root/examples/renderdemo.c
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2006-01-23 16:27:21 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2006-01-23 16:27:21 +0000
commit8b728035f9cfe490ba109494eb8564d11552e374 (patch)
tree2cc04257fd0293666366d066fc5edac2fa382474 /examples/renderdemo.c
parentce22d934fce30c8fce9b660221419f8a0055d565 (diff)
downloadpango-8b728035f9cfe490ba109494eb8564d11552e374.tar.gz
Make tests/examples do use generated pango.modules. (bug #328291)
2006-01-23 Behdad Esfahbod <behdad@gnome.org> Make tests/examples do use generated pango.modules. (bug #328291) * examples/pangorc, tests/pangorc: Removed. Moved to modules/. * examples/pangox.aliases: Removed. Moved to pango/. * examples/Makefile.am, tests/Makefile.am: Remove pango.modules creation stuff, copy pangorc from $(srcdir)/../modules/pangorc insteadd. * examples/renderdemo.c: Add --pangorc option, default to ./pangorc. Setenv PANGO_RC_FILE to whatever pangorc file decided. * tests/*.c: Setenv PANGO_RC_FILE to ./pangorc. * pango/pangox.aliases: Added. * pango/Makefile.am: Install pangox.aliases. * modules/pangorc: Added. * modules/Makefile.am: Create pango.modules. Added pangorc. * modules/.cvsignore, examples/.cvsignore, tests/.cvsignore: Updated.
Diffstat (limited to 'examples/renderdemo.c')
-rw-r--r--examples/renderdemo.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/examples/renderdemo.c b/examples/renderdemo.c
index a956e3c6..e225fe7e 100644
--- a/examples/renderdemo.c
+++ b/examples/renderdemo.c
@@ -38,28 +38,29 @@
#define _MAKE_FONT_NAME(family, size) family " " #size
#define MAKE_FONT_NAME(family, size) _MAKE_FONT_NAME(family, size)
-char *prog_name;
+const char *prog_name;
gboolean opt_display = FALSE;
int opt_dpi = 96;
const char *opt_font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE);
gboolean opt_header = FALSE;
-char *opt_output = NULL;
+const char *opt_output = NULL;
int opt_margin = 10;
int opt_markup = FALSE;
gboolean opt_rtl = FALSE;
int opt_rotate = 0;
gboolean opt_auto_dir = TRUE;
-char *opt_text = NULL;
+const char *opt_text = NULL;
gboolean opt_waterfall = FALSE;
int opt_width = -1;
int opt_indent = 0;
int opt_runs = 1;
PangoEllipsizeMode opt_ellipsize = PANGO_ELLIPSIZE_NONE;
HintMode opt_hinting = HINT_DEFAULT;
+const char *opt_pangorc = NULL;
/* Text (or markup) to render */
-char *text;
+static char *text;
void
fail (const char *format, ...)
@@ -343,7 +344,7 @@ fc_substitute_func (FcPattern *pattern, gpointer data)
}
}
-void
+static void
parse_ellipsis (ArgContext *arg_context,
const char *name,
const char *arg,
@@ -362,7 +363,7 @@ parse_ellipsis (ArgContext *arg_context,
opt_ellipsize = value->value;
}
-void
+static void
parse_hinting (ArgContext *arg_context,
const char *name,
const char *arg,
@@ -423,6 +424,8 @@ parse_options (int argc, char *argv[])
ARG_INT, &opt_indent, NULL },
{ "runs", "Render text this many times",
ARG_INT, &opt_runs, NULL },
+ { "pangorc", "pangorc file to use (default is ./pangorc if available)",
+ ARG_STRING, &opt_pangorc, NULL },
{ NULL, NULL, 0, NULL, NULL }
};
@@ -488,6 +491,14 @@ parse_options (int argc, char *argv[])
if (opt_markup &&
!pango_parse_markup (text, -1, 0, NULL, NULL, NULL, &error))
fail ("Cannot parse input as markup: %s", error->message);
+
+ /* Setup PANGO_RC_FILE
+ */
+ if (!opt_pangorc)
+ if (g_file_test ("./pangorc", G_FILE_TEST_IS_REGULAR))
+ opt_pangorc = "./pangorc";
+ if (opt_pangorc)
+ g_setenv ("PANGO_RC_FILE", opt_pangorc, TRUE);
}
void