function h = textbg(han,c);
% place a background color patch behind a text object
%
% hout = textbg(han,c);
%   
%        han = handle to text object
%        c = background colorspec (default is white)

hold_state = get(gca,'nextplot');
set(gca,'nextplot','add');
if nargin < 2
  c = 'w';
end
tmp = get(han,'extent');
xx = [tmp([1 1]) sum(tmp([1 3])) sum(tmp([1 3])) tmp(1)];
yy = [tmp(2) sum(tmp([2 4])) sum(tmp([2 4])) tmp([2 2])];
hout = fill(xx,yy,c);
set(hout,'edgecolor','none')
if nargout > 0
  h = hout;
end
set(gca,'nextplot',hold_state)