function h=jf(h,varargin)
% h=jf(h,varargin)
% h is handle to a text object
% default is 10pt, black, bold
% varargin is 
%  's'       fontsize
%  'c'       color               [ r g b c m ...]
%  'ha',     horizontalalignment  [ {left} | center | right ]
%  'va',     verticalalignment  [ top | cap | {middle} | baseline | bottom ]
%  'r'       rotation           [0]                 
%  'w'        'b'                     [ light | {normal} | demi | bold ]



if (nargin <1)
  help('jf')
  error('must give text handle')
end


cfg.s  = 10;
cfg.c  = 'k';
cfg.ha = 'left';
cfg.va = 'middle';
cfg.r  = 0;
cfg.w  = 'bold';


cfg = fillstruct(cfg, varargin, 0);


%this is WAY too hardwired
set(h,'fontsize',cfg.s);
set(h,'color',cfg.c);
set(h,'horizontalalignment',cfg.ha);
set(h,'verticalalignment',cfg.va);
set(h,'rotation',cfg.r)
set(h,'fontweight',cfg.w);



%%%%old:

%default_argprs = struct('s', 10,...
%	'c', 'k',...
%	'ha', 'left',...
%	'va', 'middle',...
%	'r', 0,...
%	'w', 'bold');
%
% arg_names = fieldnames(default_argprs);
% num_args = length(fieldnames(default_argprs));
% if ~sum(ismember(nargin,1+2*[0:num_args-1]))   %all varargin are optional
%   help plot_hash
%   whos
%   fprintf('nargin is %d\n',nargin)
%   error('incorrect number of arguments')
% end
%
% if (rem(length(varargin),2)~=0)
%   help(jf)
%   error('must select argument pairs again')
% end
%
% for argpi = 1:length(arg_names)
%   eval(sprintf('%s = init_vdefs(varargin, default_argprs,argpi);',...
%           arg_names{argpi} ))
% end

