From ef5cd6e10e93ef973536d2df2ad57ac42a2118ea Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 9 Apr 2014 00:10:22 -0400 Subject: handle newlines vaguely better --- display.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'display.c') diff --git a/display.c b/display.c index 8b732a1..5d503bd 100644 --- a/display.c +++ b/display.c @@ -1,3 +1,5 @@ +#include + #include "runes.h" void runes_display_init(RunesTerm *t) @@ -11,7 +13,16 @@ void runes_display_init(RunesTerm *t) void runes_display_glyph(RunesTerm *t, char *buf, size_t len) { if (len) { + char *nl; buf[len] = '\0'; + while ((nl = strchr(buf, '\n'))) { + double x, y; + *nl = '\0'; + cairo_show_text(t->cr, buf); + buf = nl + 1; + cairo_get_current_point(t->cr, &x, &y); + cairo_move_to(t->cr, 0.0, y + 14.0); + } cairo_show_text(t->cr, buf); } } -- cgit v1.2.3-54-g00ecf