From d1f6bb67590475138dbf5357be44d2b449356540 Mon Sep 17 00:00:00 2001 From: Jean-Yves Lamoureux Date: Wed, 15 Mar 2006 16:55:40 +0000 Subject: [PATCH] * Added preliminary (but working) SVG exporter --- cucul/Makefile.am | 1 + cucul/cucul.c | 3 +++ cucul/cucul.h | 1 + cucul/export_html.c | 2 +- cucul/export_ps.c | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/cucul/Makefile.am b/cucul/Makefile.am index aa8190d..f848744 100644 --- a/cucul/Makefile.am +++ b/cucul/Makefile.am @@ -20,6 +20,7 @@ libcucul_la_SOURCES = \ export_ansi.c \ export_html.c \ export_ps.c \ + export_svg.c \ $(NULL) libcucul_la_LDFLAGS = -no-undefined libcucul_la_LIBADD = @CUCUL_LIBS@ diff --git a/cucul/cucul.c b/cucul/cucul.c index 3eb6796..0b356af 100644 --- a/cucul/cucul.c +++ b/cucul/cucul.c @@ -298,6 +298,9 @@ struct cucul_buffer * cucul_export(cucul_t *qq, enum cucul_format format) case CUCUL_FORMAT_PS: _cucul_get_ps(qq, ex); break; + case CUCUL_FORMAT_SVG: + _cucul_get_svg(qq, ex); + break; default: free(ex); return NULL; diff --git a/cucul/cucul.h b/cucul/cucul.h index 07c324a..19bdfb9 100644 --- a/cucul/cucul.h +++ b/cucul/cucul.h @@ -61,6 +61,7 @@ enum cucul_format CUCUL_FORMAT_HTML3 = 2, /**< Export to old HTMLv3 format. */ CUCUL_FORMAT_IRC = 3, /**< Export to text with mIRC colours. */ CUCUL_FORMAT_PS = 4, /**< Export to PostScript. */ + CUCUL_FORMAT_SVG = 5, /**< Export to Scalable Vector Graphics format. */ }; /** \brief Internal features. diff --git a/cucul/export_html.c b/cucul/export_html.c index cee75f6..e2ff225 100644 --- a/cucul/export_html.c +++ b/cucul/export_html.c @@ -88,7 +88,7 @@ void _cucul_get_html(cucul_t *qq, struct cucul_buffer *ex) if(linechar[x + len] == (uint32_t)' ') cur += sprintf(cur, " "); else - cur += sprintf(cur, "%c", linechar[x + len] & 0x7f); + cur += sprintf(cur, "%c", linechar[x] & 0x7f); } cur += sprintf(cur, ""); } diff --git a/cucul/export_ps.c b/cucul/export_ps.c index f410eb2..c39d66b 100644 --- a/cucul/export_ps.c +++ b/cucul/export_ps.c @@ -139,5 +139,6 @@ void _cucul_get_ps(cucul_t *qq, struct cucul_buffer *ex) /* Crop to really used size */ ex->size = strlen(ex->buffer) + 1; ex->buffer = realloc(ex->buffer, ex->size); + }