@@ -39,7 +39,7 @@ function xOffsetBasedOnAlignment<I extends JimpClass>(
39
39
font : BmFont < I > ,
40
40
line : string ,
41
41
maxWidth : number ,
42
- alignment : HorizontalAlign ,
42
+ alignment : HorizontalAlign
43
43
) {
44
44
if ( alignment === HorizontalAlign . LEFT ) {
45
45
return 0 ;
@@ -57,7 +57,7 @@ function drawCharacter<I extends JimpClass>(
57
57
font : BmFont < I > ,
58
58
x : number ,
59
59
y : number ,
60
- char : BmCharacter ,
60
+ char : BmCharacter
61
61
) {
62
62
if ( char . width > 0 && char . height > 0 ) {
63
63
const characterPage = font . pages [ char . page ] ;
@@ -84,7 +84,7 @@ function printText<I extends JimpClass>(
84
84
x : number ,
85
85
y : number ,
86
86
text : string ,
87
- defaultCharWidth : number ,
87
+ defaultCharWidth : number
88
88
) {
89
89
for ( let i = 0 ; i < text . length ; i ++ ) {
90
90
const stringChar = text [ i ] ! ;
@@ -130,7 +130,7 @@ export const methods = {
130
130
* const image = await Jimp.read("test/image.png");
131
131
* const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
132
132
*
133
- * image.print(font, 10, 10, "Hello world!");
133
+ * image.print({ font, x: 10, y: 10, text: "Hello world!" } );
134
134
* ```
135
135
*/
136
136
print < I extends JimpClass > (
@@ -141,7 +141,7 @@ export const methods = {
141
141
} : PrintOptions & {
142
142
/** the BMFont instance */
143
143
font : BmFont < I > ;
144
- } ,
144
+ }
145
145
) {
146
146
let {
147
147
// eslint-disable-next-line prefer-const
@@ -184,7 +184,7 @@ export const methods = {
184
184
}
185
185
186
186
const defaultCharWidth = Object . entries ( font . chars ) . find (
187
- ( c ) => c [ 1 ] . xadvance ,
187
+ ( c ) => c [ 1 ] . xadvance
188
188
) ?. [ 1 ] . xadvance ;
189
189
190
190
if ( typeof defaultCharWidth !== "number" ) {
@@ -199,7 +199,7 @@ export const methods = {
199
199
font ,
200
200
lineString ,
201
201
maxWidth ,
202
- alignmentX ,
202
+ alignmentX
203
203
) ;
204
204
205
205
printText (
@@ -208,7 +208,7 @@ export const methods = {
208
208
x + alignmentWidth ,
209
209
y ,
210
210
lineString ,
211
- defaultCharWidth ,
211
+ defaultCharWidth
212
212
) ;
213
213
y += font . common . lineHeight ;
214
214
} ) ;
0 commit comments