File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,6 +199,7 @@ var jsPDF = (function(global) {
199199 } ,
200200 API = { } ,
201201 events = new PubSub ( API ) ,
202+ lastTextWasStroke = false ,
202203
203204 /////////////////////
204205 // Private functions
@@ -1062,12 +1063,20 @@ var jsPDF = (function(global) {
10621063 if ( ! ( 'autoencode' in flags ) )
10631064 flags . autoencode = true ;
10641065
1066+ //TODO this might not work after object block changes
1067+ // It would be better to pass in a page context
10651068 var strokeOption = '' ;
10661069 if ( true === flags . stroke ) {
1067- strokeOption = '1 Tr\n' ;
1070+ if ( this . lastTextWasStroke !== true ) {
1071+ strokeOption = '1 Tr\n' ;
1072+ this . lastTextWasStroke = true ;
1073+ }
10681074 }
10691075 else {
1070- strokeOption = '0 Tr\n' ;
1076+ if ( this . lastTextWasStroke ) {
1077+ strokeOption = '0 Tr\n' ;
1078+ }
1079+ this . lastTextWasStroke = false ;
10711080 }
10721081
10731082 if ( typeof text === 'string' ) {
Original file line number Diff line number Diff line change 6060 ctx . strokeText ( "Hello PDF" , 20 , y + 50 ) ;
6161 y += 50 + pad ;
6262
63+ ctx . setFont ( "20pt courier bold" ) ;
64+ ctx . strokeText ( "Hello PDF" , 20 , y + 20 ) ;
65+ y += 20 + pad ;
66+
67+ ctx . setFont ( "20pt courier bold" ) ;
68+ ctx . fillText ( "Hello PDF" , 20 , y + 20 ) ;
69+ y += 20 + pad ;
70+
6371 ctx . restore ( ) ;
6472
6573 //
You can’t perform that action at this time.
0 commit comments