aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/Field.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/generic/Field.c b/generic/Field.c
index 4893633..c80191b 100644
--- a/generic/Field.c
+++ b/generic/Field.c
@@ -999,9 +999,9 @@ ConfigureField(ZnFieldSet fs,
if (wi->render) {
fptr->tfi = ZnGetTexFont(wi, fptr->font);
if (!fptr->tfi) {
- Tcl_AppendResult(wi->interp, "impossible to get the texture for font \"",
- Tk_NameOfFont(fptr->font), "\"", NULL);
- return TCL_ERROR;
+ Tcl_AppendResult(wi->interp, "impossible to get the texture for font \"",
+ Tk_NameOfFont(fptr->font), "\"", NULL);
+ return TCL_ERROR;
}
}
}
@@ -2068,32 +2068,30 @@ RenderField(ZnWInfo *wi,
* Draw the text.
*/
num_bytes = strlen(fptr->text);
- if (num_bytes) {
- if (fptr->tfi) {
- glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
- if (sel_start >= 0) {
- color = ZnGetGradientColor(ti->sel_color, 0.0, &alpha);
- alpha = ZnComposeAlpha(alpha, wi->alpha);
- glColor4us(color->red, color->green, color->blue, alpha);
- glBegin(GL_QUADS);
- glVertex2d(text_bbox->orig.x+sel_start, text_bbox->orig.y);
- glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->orig.y);
- glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->corner.y);
- glVertex2d(text_bbox->orig.x+sel_start, text_bbox->corner.y);
- glEnd();
- }
- glEnable(GL_TEXTURE_2D);
- glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
- color = ZnGetGradientColor(fptr->color, 0.0, &alpha);
+ if (num_bytes && fptr->tfi) {
+ glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
+ if (sel_start >= 0) {
+ color = ZnGetGradientColor(ti->sel_color, 0.0, &alpha);
alpha = ZnComposeAlpha(alpha, wi->alpha);
glColor4us(color->red, color->green, color->blue, alpha);
- glBindTexture(GL_TEXTURE_2D, ZnTexFontTex(fptr->tfi));
- glPushMatrix();
- glTranslated(text_pos->x, text_pos->y, 0.0);
- ZnRenderString(fptr->tfi, fptr->text, num_bytes);
- glPopMatrix();
- glDisable(GL_TEXTURE_2D);
+ glBegin(GL_QUADS);
+ glVertex2d(text_bbox->orig.x+sel_start, text_bbox->orig.y);
+ glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->orig.y);
+ glVertex2d(text_bbox->orig.x+sel_stop, text_bbox->corner.y);
+ glVertex2d(text_bbox->orig.x+sel_start, text_bbox->corner.y);
+ glEnd();
}
+ glEnable(GL_TEXTURE_2D);
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+ color = ZnGetGradientColor(fptr->color, 0.0, &alpha);
+ alpha = ZnComposeAlpha(alpha, wi->alpha);
+ glColor4us(color->red, color->green, color->blue, alpha);
+ glBindTexture(GL_TEXTURE_2D, ZnTexFontTex(fptr->tfi));
+ glPushMatrix();
+ glTranslated(text_pos->x, text_pos->y, 0.0);
+ ZnRenderString(fptr->tfi, fptr->text, num_bytes);
+ glPopMatrix();
+ glDisable(GL_TEXTURE_2D);
}
if (cursor >= 0) {
glLineWidth((GLfloat) ti->insert_width);