From 96d28dc64ae59b5312fd32404561c2307bad8b50 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Wed, 13 Feb 2008 10:07:25 -0800 Subject: [PATCH] Rip out the libcgic stuff We've got bigger bugs to fix before we turn this into a CGI program. --- Makefile | 2 +- spritext.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 55cd6c8..9c7effc 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ CFLAGS += `freetype-config --cflags` LDFLAGS += `pkg-config cairo --libs` LDFLAGS += `freetype-config --libs` -spritext: spritext.o -lcgic +spritext: spritext.o clean: rm -f *.o spritext diff --git a/spritext.c b/spritext.c index 0250fa9..ef7c9a2 100644 --- a/spritext.c +++ b/spritext.c @@ -6,7 +6,6 @@ #include #include #include -#include #ifndef CAIRO_HAS_PNG_FUNCTIONS #error This program requires cairo with PNG support @@ -20,8 +19,10 @@ #define TRUE (1==1) #define FALSE (!TRUE) +#if USE_CGIC static cairo_status_t stdio_write (void *closure, const unsigned char *data, unsigned int length); +#endif double get_max_width (cairo_t *cr, char *characters); @@ -30,7 +31,7 @@ double get_max_height (cairo_t *cr, char *characters); int -cgiMain () +main (void) { char outputJson = FALSE; @@ -52,14 +53,17 @@ cgiMain () int i; /* QueryString */ - char fontname[20]; int fontsize; char format[5]; char fillcolor[20]; + +#if USE_CGIG + char fontname[20]; cgiFormStringNoNewlines("fontname", fontname, 20); cgiFormInteger("fontsize", &fontsize, 50); cgiFormStringNoNewlines("format", format, 5); cgiFormStringNoNewlines("fillcolor", fillcolor, 20); +#endif int fillcolor_red; int fillcolor_green; @@ -69,12 +73,14 @@ cgiMain () if ( format[0] == 'j' && format[1] == 's' && format[2] == 'o' && format[3] == 'n' ) outputJson = TRUE; +#if USE_CGIC if (outputJson) { cgiHeaderContentType("application/json"); } else { cgiHeaderContentType("image/png"); } +#endif int error; FT_Library library; @@ -275,12 +281,15 @@ cairo_mask (cr, gradient); cairo_pattern_destroy (gradient); */ + +#if USE_CGIC if (outputJson) { printf("}"); } else { cairo_surface_write_to_png_stream (surface, stdio_write, cgiOut); } +#endif cairo_destroy (cr); @@ -289,6 +298,7 @@ cairo_pattern_destroy (gradient); return 0; } +#if USE_CGIC static cairo_status_t stdio_write (void *closure, const unsigned char *data, unsigned int length) { @@ -298,6 +308,7 @@ stdio_write (void *closure, const unsigned char *data, unsigned int length) else return CAIRO_STATUS_WRITE_ERROR; } +#endif double get_max_width(cairo_t *cr, char *characters) -- 2.43.0