Subversion Repositories wimsdev

Rev

Rev 16705 | Rev 16714 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 16705 Rev 16712
Line 719... Line 719...
719
break;
719
break;
720
 
720
 
721
case DRAW_SUBSUP:
721
case DRAW_SUBSUP:
722
fprintf(js_include_file,"\n/* draw sub sup imitation in canvas */\
722
fprintf(js_include_file,"\n/* draw sub sup imitation in canvas */\
723
function draw_subsup(ctx,x,y,txt){\
723
function draw_subsup(ctx,x,y,txt){\
724
 var C;var c;var len = txt.length;var baseline = 'middle';var space = 0;\
724
 var C;var c;var len = txt.length;var baseline = 'middle';var space = 0;ctx.save();var subsup=0;\
725
 ctx.save();var subsup=0;\
-
 
726
 var org_font = ctx.font;var s = 0.8*(parseInt(ctx.font)) || 10;\
725
 var S = parseInt(ctx.font) || 10;var s = 0.8*(parseInt(ctx.font)) || 8;\
727
 ctx.textBaseline = baseline;\
726
 ctx.font = S+'px Helvetica';ctx.textBaseline = baseline;\
728
 for( c = 0 ; c < len ;c++){\
727
 for( c = 0 ; c < len ;c++){\
729
  C = txt.charAt(c);space = 0;\
728
  C = txt.charAt(c);space = 0;\
730
  if(C == '_'){ctx.font = s+'px Arial';subsup = 1;c++;space = 3;baseline='top';C = txt.charAt(c);};\
729
  if(C == '_'){ctx.font = s+'px Helvetica';subsup = 1;c++;space = 3;baseline='top';C = txt.charAt(c);};\
731
  if(C == '^'){ctx.font = s+'px Arial';subsup = 1;c++;space = 3;baseline='bottom';C = txt.charAt(c);};\
730
  if(C == '^'){ctx.font = s+'px Helvetica';subsup = 1;c++;space = 3;baseline='bottom';C = txt.charAt(c);};\
732
  if(C == ' '){ctx.font = org_font ;if(subsup == 1){space = 0.6*s - (ctx.measureText('M').width);subsup = 0;};baseline = 'middle';};\
731
  if(C == ' '){ctx.font = S+'px Helvetica';if(subsup == 1){space = 0.6*s - (ctx.measureText('M').width);subsup = 0;};baseline = 'middle';};\
733
  ctx.textBaseline = baseline;\
-
 
734
  ctx.fillText(C,x,y);\
-
 
735
  x = space + x + ctx.measureText(C).width;\
732
  ctx.textBaseline = baseline;ctx.fillText(C,x,y);x = space + x + ctx.measureText(C).width;\
736
 };\
733
 };\
737
 ctx.stroke();\
734
 ctx.stroke();\
738
 ctx.restore();\
735
 ctx.restore();\
739
 return;\
736
 return;\
740
};");
737
};");