From 2a638c7135b065fdb8b7d4e28be145e2ab4e3504 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 16 May 2003 14:08:44 +0000 Subject: * (ComputeCoordinates): Modified the processing of the white space/tab causing a line break when a -width limiting atribute is in effect. The extra space used to be located at the beginning of the new line. Now it is suppressed. Other white spaces are still displayed at the begining of the line. The new behavior seems more natural. --- generic/Text.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'generic/Text.c') diff --git a/generic/Text.c b/generic/Text.c index c2b8278..bd72341 100644 --- a/generic/Text.c +++ b/generic/Text.c @@ -470,6 +470,15 @@ ComputeCoordinates(ZnItem item, if (ptr) { scan++; } + else { + /* + * Skip white spaces occuring after an + * automatic line break. + */ + if ((*scan == ' ') || (*scan == '\t')) { + scan++; + } + } /* Build a line info even for an empty line * at the end of text or for an empty text. @@ -989,7 +998,26 @@ Render(ZnItem item) glPushMatrix(); glTranslated(xs, ys, 0.0); - ZnRenderString(text->tfi, lines_ptr->start, lines_ptr->num_bytes); + /* + * Temporary ack to fix utf8 display. + * the malloc should be done once for + * each rendering of the item and not + * for each line. The max line size should + * be stored by CC. + */ + { + char *buf; + int written; + + buf = ZnMalloc(lines_ptr->num_bytes+1); + Tcl_UtfToExternal(wi->interp, NULL, + lines_ptr->start, lines_ptr->num_bytes, + TCL_ENCODING_START|TCL_ENCODING_END, + NULL, buf, lines_ptr->num_bytes+1, NULL, + &written, NULL); + ZnRenderString(text->tfi, buf, written); + ZnFree(buf); + } glPopMatrix(); if (ISSET(text->flags, UNDERLINED) || ISSET(text->flags, OVERSTRIKED)) { -- cgit v1.1