]> git.sur5r.net Git - glabels/commitdiff
Reconciled text object alignment algorithm with view-text.c
authorJim Evins <evins@snaught.com>
Wed, 28 Aug 2002 03:22:08 +0000 (03:22 +0000)
committerJim Evins <evins@snaught.com>
Wed, 28 Aug 2002 03:22:08 +0000 (03:22 +0000)
git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@73 f5e0f49d-192f-0410-a22d-a8d8700d0965

glabels2/src/print.c

index b94765a186e128b5c47ce7574616771e295f5108..66a58dd2179ac702cc038183e6aba780b55ecd66 100644 (file)
@@ -507,8 +507,7 @@ draw_text_object (PrintInfo * pi,
        GnomeFont *font;
        gchar **line;
        gint i;
-       gdouble w;
-       gdouble x_offset, y_offset;
+       gdouble x_offset, y_offset, w, object_w, object_h;
        gdouble x, y;
        gdouble x0, y0;
        gchar *text;
@@ -527,6 +526,7 @@ draw_text_object (PrintInfo * pi,
        gl_debug (DEBUG_PRINT, "START");
 
        gl_label_object_get_position (GL_LABEL_OBJECT(object), &x0, &y0);
+       gl_label_object_get_size (object, &object_w, &object_h);
        lines = gl_label_text_get_lines (object);
        gl_label_text_get_props (object,
                                 &font_family, &font_size, &font_weight,
@@ -566,10 +566,10 @@ draw_text_object (PrintInfo * pi,
                        x_offset = 0.0;
                        break;
                case GTK_JUSTIFY_CENTER:
-                       x_offset = -w / 2.0;
+                       x_offset = (object_w - w) / 2.0;
                        break;
                case GTK_JUSTIFY_RIGHT:
-                       x_offset = -w;
+                       x_offset = object_w - w;
                        break;
                default:
                        x_offset = 0.0;