Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@jimp/plugin-print/index.d.ts
1126 views
1
import { GenericCallback, ImageCallback } from '@jimp/core';
2
3
export interface FontChar {
4
id: number;
5
x: number;
6
y: number;
7
width: number;
8
height: number;
9
xoffset: number;
10
yoffset: number;
11
xadvance: number;
12
page: number;
13
chnl: number;
14
}
15
16
export interface FontInfo {
17
face: string;
18
size: number;
19
bold: number;
20
italic: number;
21
charset: string;
22
unicode: number;
23
stretchH: number;
24
smooth: number;
25
aa: number;
26
padding: [number, number, number, number];
27
spacing: [number, number];
28
}
29
30
export interface FontCommon {
31
lineHeight: number;
32
base: number;
33
scaleW: number;
34
scaleH: number;
35
pages: number;
36
packed: number;
37
alphaChnl: number;
38
redChnl: number;
39
greenChnl: number;
40
blueChnl: number;
41
}
42
43
export interface Font {
44
chars: {
45
[char: string]: FontChar;
46
};
47
kernings: {
48
[firstString: string]: {
49
[secondString: string]: number;
50
};
51
};
52
pages: string[];
53
common: FontCommon;
54
info: FontInfo;
55
}
56
57
type PrintableText =
58
| any
59
| {
60
text: string;
61
alignmentX: number;
62
alignmentY: number;
63
};
64
65
interface PrintClass {
66
// Text methods
67
print(
68
font: Font,
69
x: number,
70
y: number,
71
text: PrintableText,
72
cb?: ImageCallback<this>
73
): this;
74
print(
75
font: Font,
76
x: number,
77
y: number,
78
text: PrintableText,
79
maxWidth?: number,
80
cb?: ImageCallback<this>
81
): this;
82
print(
83
font: Font,
84
x: number,
85
y: number,
86
text: PrintableText,
87
maxWidth?: number,
88
maxHeight?: number,
89
cb?: ImageCallback<this>
90
): this;
91
}
92
93
interface Print {
94
constants: {
95
measureText(font: Font, text: PrintableText): number;
96
measureTextHeight(font: Font, text: PrintableText, maxWidth: number): number;
97
98
// Font locations
99
FONT_SANS_8_BLACK: string;
100
FONT_SANS_10_BLACK: string;
101
FONT_SANS_12_BLACK: string;
102
FONT_SANS_14_BLACK: string;
103
FONT_SANS_16_BLACK: string;
104
FONT_SANS_32_BLACK: string;
105
FONT_SANS_64_BLACK: string;
106
FONT_SANS_128_BLACK: string;
107
108
FONT_SANS_8_WHITE: string;
109
FONT_SANS_16_WHITE: string;
110
FONT_SANS_32_WHITE: string;
111
FONT_SANS_64_WHITE: string;
112
FONT_SANS_128_WHITE: string;
113
114
loadFont(file: string): Promise<Font>;
115
loadFont(file: string, cb: GenericCallback<Font, any, any>): Promise<never>;
116
}
117
118
class: PrintClass
119
}
120
121
export default function(): Print;
122
123