No BSD License  

Highlights from
htmltool

htmltool

by

 

The HTML Toolbox (HT) stores various crosslink information about Matlab programs using HTML.

fntwrt(fid,message,location,fontsize,font,color)
function [] = fntwrt(fid,message,location,fontsize,font,color)
%[] = fntwrt(fid,message,location,fontsize,[font],[color])
% Writes a message with a certain fontsize at a certain
% location 
% 
% INPUT PARAMETERS
% 
% fid             = current file pointer
% message         = string you want to write in HTML document
% location        = (={LEFT,CENTER,RIGHT})
% fontsize        = size of font
% font            = font type (0-> bold, 1-> italic), optional
% color           = a vector [r g b] of real numbers from 0 to 1
%                   0 is no color, 1 is full color, e.g. [1 1 1] is
%                   white and [0 0 0] is black, [0 1 0] is green.
%
% Copyright (c) 1996 B.K. Alsberg
%


n=length(location);
location = [location blanks(6-n)];
%% Setting the default color %%%
default_color = [0 0 0]; %black
%here we transform from [0,1] space into [0,255] space
color2 = round(lintrans(color,0,1,0,255));

if nargin == 5,
 if font == 0
   front = '<B>';
   back  = '</B>';
 elseif font ==1,
   front = '<I>';
   back  = '</I>';
 end
else
   front = '';
   back  = '';
end

if fontsize >0
 fnt = ['+',int2str(fontsize)];
else
 fnt = ['-',int2str(fontsize)];
end;

fz = '<FONT SIZE=';
p1 = '<P>';
p2 = '</P>';
fnt2 = '</FONT>';
c1 = '<CENTER>';
c2 = '</CENTER>';
r1 = '<DIV ALIGN=right>';
r2 = '</DIV>';
h0 = '>';

%%%%%% Here we convert the color vector into proper HTML code %%%
if length(color2) >= 1,
  red = dec2hex(color2(1));
  if length(red) == 1, red = ['0',red]; end;
  green = dec2hex(color2(2));
  if length(green) == 1, green = ['0',green]; end;
  blue = dec2hex(color2(3));
  if length(blue) == 1, blue = ['0',blue]; end;
  htcd = ['#',red,green,blue];

  fntcol = ['<FONT COLOR="',htcd,'">'];
else
  % default is BLACK
  red = dec2hex(default_color(1));
  green = dec2hex(default_color(2));
  blue = dec2hex(default_color(3));
  htcd = ['#',red,green,blue];
  fntcol = ['<FONT COLOR="',htcd,'">'];
end;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

                                                                                                                    
if location =='LEFT  '
 str1 = [p1,front,fntcol,fz,fnt,h0,message,fnt2,fnt2,back,p2];
 fprintf(fid,'%s \n',str1);

elseif location == 'CENTER'
 str2 = [c1,p1,front,fntcol,fz,fnt,h0,message,fnt2,fnt2,back,p2,c2];
 fprintf(fid,'%s \n',str2);

elseif location == 'RIGHT '
 str3 = [r1,p1,front,fntcol,fz,fnt,h0,message,fnt2,fnt2,back,p2,r2];
 fprintf(fid,'%s \n',str3);

end;


Contact us