(* parent_class->get_size) (object, &w_parent, &h_parent);
+ if ( (w_parent != 0.0) || (h_parent != 0.0) ) {
+ *w = w_parent;
+ *h = h_parent;
+ return;
+ }
+
font = gnome_font_find_closest_from_weight_slant (
ltext->private->font_family,
ltext->private->font_weight,
if ( *h == 0.0 ) *h = ltext->private->font_size;
- if ( *w < w_parent ) *w = w_parent;
- if ( *h < h_parent ) *h = h_parent;
+ *w += 2*GL_LABEL_TEXT_MARGIN;
+ *h += 2*GL_LABEL_TEXT_MARGIN;
+
g_strfreev (line);
G_BEGIN_DECLS
+#define GL_LABEL_TEXT_MARGIN 3.0
+
#define GL_TYPE_LABEL_TEXT (gl_label_text_get_type ())
#define GL_LABEL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GL_TYPE_LABEL_TEXT, glLabelText))
switch (just) {
case GTK_JUSTIFY_LEFT:
- x_offset = 0.0;
+ x_offset = GL_LABEL_TEXT_MARGIN;
break;
case GTK_JUSTIFY_CENTER:
- x_offset = (object_w - w) / 2.0;
+ x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
break;
case GTK_JUSTIFY_RIGHT:
- x_offset = object_w - w;
+ x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
break;
default:
x_offset = 0.0;
break; /* shouldn't happen */
}
- y_offset = (i + 1) * font_size
- + gnome_font_get_descender (font);
+ y_offset = GL_LABEL_TEXT_MARGIN + (i + 1) * font_size
+ + gnome_font_get_descender (font);
gnome_print_moveto (pi->pc, x_offset, y_offset);
switch (just) {
case GTK_JUSTIFY_LEFT:
- x_offset = 0.0;
+ x_offset = GL_LABEL_TEXT_MARGIN;
break;
case GTK_JUSTIFY_CENTER:
- x_offset = (object_w - w) / 2.0;
+ x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
break;
case GTK_JUSTIFY_RIGHT:
- x_offset = object_w - w;
+ x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
break;
default:
x_offset = 0.0;
break; /* shouldn't happen */
}
- y_offset =
+ y_offset = GL_LABEL_TEXT_MARGIN +
(i + 1) * font_size + gnome_font_get_descender (font);
item = gl_view_object_item_new (GL_VIEW_OBJECT(view_text),
switch (just) {
case GTK_JUSTIFY_LEFT:
- x_offset = 0.0;
+ x_offset = GL_LABEL_TEXT_MARGIN;
break;
case GTK_JUSTIFY_CENTER:
- x_offset = (object_w - w) / 2.0;
+ x_offset = (object_w - GL_LABEL_TEXT_MARGIN - w) / 2.0;
break;
case GTK_JUSTIFY_RIGHT:
- x_offset = object_w - w;
+ x_offset = object_w - GL_LABEL_TEXT_MARGIN - w;
break;
default:
x_offset = 0.0;
points = gnome_canvas_points_new (2);
points->coords[0] = x_offset;
- points->coords[1] = i*font_size;
+ points->coords[1] = GL_LABEL_TEXT_MARGIN + i*font_size;
points->coords[2] = x_offset;
- points->coords[3] = (i+1)*font_size;
+ points->coords[3] = GL_LABEL_TEXT_MARGIN + (i+1)*font_size;
if (view_text->private->cursor) {
gtk_object_destroy (GTK_OBJECT (view_text->private->cursor));