File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,13 @@ _.TEXT_FORMAT = {
8282 TXT_2WIDTH : '\x1b\x21\x20' , // Double width text
8383 TXT_4SQUARE : '\x1b\x21\x30' , // Double width & height text
8484
85- TXT_SIZE : '\x1d\x21' , // other sizes
85+ TXT_CUSTOM_SIZE : function ( width , height ) { // other sizes
86+ var widthDec = ( width - 1 ) * 16 ;
87+ var heightDec = height - 1 ;
88+ var sizeDec = widthDec + heightDec ;
89+ return '\x1d\x21' + String . fromCharCode ( sizeDec ) ;
90+ } ,
91+
8692 TXT_HEIGHT : {
8793 1 : '\x00' ,
8894 2 : '\x01' ,
Original file line number Diff line number Diff line change @@ -237,9 +237,7 @@ Printer.prototype.size = function(width, height) {
237237 this . buffer . write ( _ . TEXT_FORMAT . TXT_2WIDTH ) ;
238238 }
239239 } else {
240- this . buffer . write ( _ . TEXT_FORMAT . TXT_SIZE ) ;
241- this . buffer . write ( _ . TEXT_FORMAT . TXT_WIDTH [ ( 8 >= width ) ? width : 8 ] ) ;
242- this . buffer . write ( _ . TEXT_FORMAT . TXT_HEIGHT [ ( 8 >= height ) ? height : 8 ] ) ;
240+ this . buffer . write ( _ . TEXT_FORMAT . TXT_CUSTOM_SIZE ( width , height ) ) ;
243241 }
244242 return this ;
245243} ;
You can’t perform that action at this time.
0 commit comments