Rev 16700 | Rev 16712 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 16700 | Rev 16705 | ||
---|---|---|---|
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 |
724 | var C;var c;var len = txt.length;var baseline = 'middle';var space = 0;\ |
725 | 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;\ |
|
726 | ctx.textBaseline = |
727 | ctx.textBaseline = baseline;\ |
727 | for( c = 0 ; c<len ;c++){\ |
728 | for( c = 0 ; c < len ;c++){\ |
728 | C = txt.charAt(c);space = 0;\ |
729 | C = txt.charAt(c);space = 0;\ |
729 | if(C == '_'){subsup = 1;c++;space = 3;baseline='top';C = txt.charAt(c);};\ |
730 | if(C == '_'){ctx.font = s+'px Arial';subsup = 1;c++;space = 3;baseline='top';C = txt.charAt(c);};\ |
730 | if(C == '^'){subsup = 1;c++;space = 3;baseline='bottom';C = txt.charAt(c);};\ |
731 | if(C == '^'){ctx.font = s+'px Arial';subsup = 1;c++;space = 3;baseline='bottom';C = txt.charAt(c);};\ |
731 | if(C == ' '){if(subsup == 1){space = |
732 | if(C == ' '){ctx.font = org_font ;if(subsup == 1){space = 0.6*s - (ctx.measureText('M').width);subsup = 0;};baseline = 'middle';};\ |
732 | ctx.textBaseline = baseline;\ |
733 | ctx.textBaseline = baseline;\ |
733 | ctx.fillText( |
734 | ctx.fillText(C,x,y);\ |
734 | ctx.stroke();\ |
- | |
735 | |
735 | x = space + x + ctx.measureText(C).width;\ |
736 | };\ |
736 | };\ |
- | 737 | ctx.stroke();\ |
|
737 | ctx.restore();\ |
738 | ctx.restore();\ |
738 | return;\ |
739 | return;\ |
739 | };"); |
740 | };"); |
740 | break; |
741 | break; |
741 | 742 |