aboutsummaryrefslogtreecommitdiff
path: root/generic/Text.c
diff options
context:
space:
mode:
authorlecoanet2002-03-29 13:15:13 +0000
committerlecoanet2002-03-29 13:15:13 +0000
commit68cd1d43c36cc71c6204fa66d1a80218a2f94795 (patch)
treebf4ecc56f53cd969ee15a41a0a4774269c562f15 /generic/Text.c
parent9790119d5a35c3f703d53b00879c1d6bf69ba6c5 (diff)
downloadtkzinc-68cd1d43c36cc71c6204fa66d1a80218a2f94795.zip
tkzinc-68cd1d43c36cc71c6204fa66d1a80218a2f94795.tar.gz
tkzinc-68cd1d43c36cc71c6204fa66d1a80218a2f94795.tar.bz2
tkzinc-68cd1d43c36cc71c6204fa66d1a80218a2f94795.tar.xz
* Les flags sont dans un unsigned short (16 flags).
* Correction du calcul de la longueur de ligne pour tenir correctment compte du \n de fin. Il s'affichait sous forme d'un petit carr�.
Diffstat (limited to 'generic/Text.c')
-rw-r--r--generic/Text.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/generic/Text.c b/generic/Text.c
index e9bae13..3f8cba3 100644
--- a/generic/Text.c
+++ b/generic/Text.c
@@ -89,7 +89,7 @@ typedef struct _TextItemStruct {
ZnJustify alignment;
ZnDim width;
ZnDim spacing;
- unsigned char flags;
+ unsigned short flags;
/* Private data */
ZnPoint pos_dev;
@@ -409,16 +409,18 @@ ComputeCoordinates(Item item,
}
info.num_chars = Tk_MeasureChars(text->font, scan, num, wrap,
TK_WHOLE_WORDS|TK_AT_LEAST_ONE, &info.width);
+
+ info.start = scan;
+ text->max_width = MAX(info.width, text->max_width);
+
+ scan += info.num_chars;
/*
* Adjust for the newline at the end of line.
*/
if (ptr) {
- info.num_chars++;
+ scan++;
}
- info.start = scan;
- text->max_width = MAX(info.width, text->max_width);
-
- scan += info.num_chars;
+
/* Build a line info even for an empty line
* at the end of text or for an empty text.
* It is needed to enable selection and cursor
@@ -790,7 +792,7 @@ Render(Item item)
WidgetInfo *wi = item->wi;
TextItem text = (TextItem) item;
TextLineInfo lines, lines_ptr;
- int i, num_lines, num_chars;
+ int i, num_lines;
XColor *color;
int alpha;
@@ -815,15 +817,11 @@ Render(Item item)
num_lines = ZnListSize(text->text_info);
for (i = 0, lines_ptr = lines; i < num_lines; i++, lines_ptr++) {
- num_chars = lines_ptr->num_chars;
- while (lines_ptr->start[num_chars-1] == '\n') {
- num_chars--;
- }
glPushMatrix();
glTranslatef(text->pos_dev.x + lines_ptr->text_origin.x,
text->pos_dev.y + lines_ptr->text_origin.y,
0.0);
- txfRenderString(text->txf, lines_ptr->start, num_chars);
+ txfRenderString(text->txf, lines_ptr->start, lines_ptr->num_chars);
glPopMatrix();
}
glDisable(GL_TEXTURE_2D);