diff -r 562e40e3d5db src/graphics.cc --- a/src/graphics.cc Mon Apr 04 20:15:32 2011 -0700 +++ b/src/graphics.cc Mon Apr 25 21:40:35 2011 -0700 @@ -5849,13 +5849,21 @@ Matrix text::properties::get_extent_matrix (void) const { + // FIXME: Should this function also add the (x,y) base position? return extent.get ().matrix_value (); } octave_value text::properties::get_extent (void) const { + // FIXME: This doesn't work right for 3D plots. + // (It doesn't in Matlab either, at least not in version 6.5.) Matrix m = extent.get ().matrix_value (); + Matrix pos = get_position ().matrix_value (); + Matrix p = convert_text_position (pos, *this, get_units (), "pixels"); + + m(0) += p(0); + m(1) += p(1); return convert_text_position (m, *this, "pixels", get_units ()); } @@ -5892,7 +5900,12 @@ // FIXME: string should be parsed only when modified, for efficiency renderer.text_to_pixels (get_string (), pixels, bbox, halign, valign, get_rotation ()); - + /* The bbox is relative to the text's position. + We'll leave it that way, because get_position() does not return + valid results when the text is first constructed. + Conversion to proper coordinates is performed in get_extent. + */ + set_extent (bbox); #endif