From ba2b25fb9ca6a4182e5503df8da832a3db0493d8 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Mon, 22 May 2006 23:55:04 +0000 Subject: [PATCH] 2006-05-22 Jim Evins * src/print.c: (draw_text_object): Check shadow state when printing text. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@590 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 5 +++ glabels2/src/print.c | 101 ++++++++++++++++++++++--------------------- 2 files changed, 57 insertions(+), 49 deletions(-) diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index c058dc97..be402391 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,8 @@ +2006-05-22 Jim Evins + + * src/print.c: (draw_text_object): + Check shadow state when printing text. + 2006-05-20 Jim Evins * src/ui-commands.c: (gl_ui_cmd_view_grid_toggle), diff --git a/glabels2/src/print.c b/glabels2/src/print.c index 5ef1e804..bdbe574b 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -839,55 +839,58 @@ draw_text_object (PrintInfo *pi, font_size); gnome_print_setfont (pi->pc, font); - gnome_print_setrgbcolor (pi->pc, - GL_COLOR_F_RED (shadow_color), - GL_COLOR_F_GREEN (shadow_color), - GL_COLOR_F_BLUE (shadow_color)); - gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (shadow_color)); - - for (i = 0; line[i] != NULL; i++) { - - glyphlist = gnome_glyphlist_from_text_dumb (font, color, - 0.0, 0.0, - (guchar *)line[i]); - - gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); - w = bbox.x1; - gnome_glyphlist_unref (glyphlist); - - switch (just) { - case GTK_JUSTIFY_LEFT: - x_offset = GL_LABEL_TEXT_MARGIN; - break; - case GTK_JUSTIFY_CENTER: - x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0; - break; - case GTK_JUSTIFY_RIGHT: - x_offset = object_w - GL_LABEL_TEXT_MARGIN - w; - break; - default: - x_offset = 0.0; - break; /* shouldn't happen */ - } - x_offset += shadow_x; - - /* Work out the y position to the BOTTOM of the first line */ - y_offset = GL_LABEL_TEXT_MARGIN + - + gnome_font_get_descender (font) - + (i + 1) * font_size * text_line_spacing - + shadow_y; - - /* Remove any text line spacing from the first row. */ - y_offset -= font_size * (text_line_spacing - 1); - - - gnome_print_moveto (pi->pc, x_offset, y_offset); - - gnome_print_gsave (pi->pc); - gnome_print_scale (pi->pc, 1.0, -1.0); - gnome_print_show (pi->pc, (guchar *)line[i]); - gnome_print_grestore (pi->pc); - } + if (shadow_state) + { + gnome_print_setrgbcolor (pi->pc, + GL_COLOR_F_RED (shadow_color), + GL_COLOR_F_GREEN (shadow_color), + GL_COLOR_F_BLUE (shadow_color)); + gnome_print_setopacity (pi->pc, GL_COLOR_F_ALPHA (shadow_color)); + + for (i = 0; line[i] != NULL; i++) { + + glyphlist = gnome_glyphlist_from_text_dumb (font, color, + 0.0, 0.0, + (guchar *)line[i]); + + gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox); + w = bbox.x1; + gnome_glyphlist_unref (glyphlist); + + switch (just) { + case GTK_JUSTIFY_LEFT: + x_offset = GL_LABEL_TEXT_MARGIN; + break; + case GTK_JUSTIFY_CENTER: + x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0; + break; + case GTK_JUSTIFY_RIGHT: + x_offset = object_w - GL_LABEL_TEXT_MARGIN - w; + break; + default: + x_offset = 0.0; + break; /* shouldn't happen */ + } + x_offset += shadow_x; + + /* Work out the y position to the BOTTOM of the first line */ + y_offset = GL_LABEL_TEXT_MARGIN + + + gnome_font_get_descender (font) + + (i + 1) * font_size * text_line_spacing + + shadow_y; + + /* Remove any text line spacing from the first row. */ + y_offset -= font_size * (text_line_spacing - 1); + + + gnome_print_moveto (pi->pc, x_offset, y_offset); + + gnome_print_gsave (pi->pc); + gnome_print_scale (pi->pc, 1.0, -1.0); + gnome_print_show (pi->pc, (guchar *)line[i]); + gnome_print_grestore (pi->pc); + } + } gnome_print_setrgbcolor (pi->pc, GL_COLOR_F_RED (color), -- 2.39.5