Leon4gr45 commited on
Commit
b00326c
·
verified ·
1 Parent(s): ced556e

Upload folder using huggingface_hub (part 15)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +4 -0
  2. node_modules/@jimp/plugin-print/README.md +10 -0
  3. node_modules/@jimp/plugin-print/dist/commonjs/dirname-cjs.cjs.map +1 -0
  4. node_modules/@jimp/plugin-print/dist/commonjs/dirname-cjs.d.cts.map +1 -0
  5. node_modules/@jimp/plugin-print/dist/commonjs/dirname.d.ts +2 -0
  6. node_modules/@jimp/plugin-print/dist/commonjs/dirname.js +5 -0
  7. node_modules/@jimp/plugin-print/dist/commonjs/fonts.d.ts +14 -0
  8. node_modules/@jimp/plugin-print/dist/commonjs/fonts.d.ts.map +1 -0
  9. node_modules/@jimp/plugin-print/dist/commonjs/fonts.js +23 -0
  10. node_modules/@jimp/plugin-print/dist/commonjs/fonts.js.map +1 -0
  11. node_modules/@jimp/plugin-print/dist/commonjs/index.d.ts +93 -0
  12. node_modules/@jimp/plugin-print/dist/commonjs/index.d.ts.map +1 -0
  13. node_modules/@jimp/plugin-print/dist/commonjs/index.js +165 -0
  14. node_modules/@jimp/plugin-print/dist/commonjs/index.js.map +1 -0
  15. node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.d.ts +134 -0
  16. node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.d.ts.map +1 -0
  17. node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.js +126 -0
  18. node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.js.map +1 -0
  19. node_modules/@jimp/plugin-print/dist/commonjs/load-font.d.ts +131 -0
  20. node_modules/@jimp/plugin-print/dist/commonjs/load-font.d.ts.map +1 -0
  21. node_modules/@jimp/plugin-print/dist/commonjs/load-font.js +31 -0
  22. node_modules/@jimp/plugin-print/dist/commonjs/load-font.js.map +1 -0
  23. node_modules/@jimp/plugin-print/dist/commonjs/measure-text.d.ts +8 -0
  24. node_modules/@jimp/plugin-print/dist/commonjs/measure-text.d.ts.map +1 -0
  25. node_modules/@jimp/plugin-print/dist/commonjs/measure-text.js +75 -0
  26. node_modules/@jimp/plugin-print/dist/commonjs/measure-text.js.map +1 -0
  27. node_modules/@jimp/plugin-print/dist/commonjs/package.json +3 -0
  28. node_modules/@jimp/plugin-print/dist/commonjs/types.d.ts +29 -0
  29. node_modules/@jimp/plugin-print/dist/commonjs/types.d.ts.map +1 -0
  30. node_modules/@jimp/plugin-print/dist/commonjs/types.js +3 -0
  31. node_modules/@jimp/plugin-print/dist/commonjs/types.js.map +1 -0
  32. node_modules/@jimp/plugin-print/dist/esm/dirname.d.ts +2 -0
  33. node_modules/@jimp/plugin-print/dist/esm/dirname.d.ts.map +1 -0
  34. node_modules/@jimp/plugin-print/dist/esm/dirname.js +6 -0
  35. node_modules/@jimp/plugin-print/dist/esm/dirname.js.map +1 -0
  36. node_modules/@jimp/plugin-print/dist/esm/fonts.d.ts +14 -0
  37. node_modules/@jimp/plugin-print/dist/esm/fonts.d.ts.map +1 -0
  38. node_modules/@jimp/plugin-print/dist/esm/fonts.js +17 -0
  39. node_modules/@jimp/plugin-print/dist/esm/fonts.js.map +1 -0
  40. node_modules/@jimp/plugin-print/dist/esm/index.d.ts +93 -0
  41. node_modules/@jimp/plugin-print/dist/esm/index.d.ts.map +1 -0
  42. node_modules/@jimp/plugin-print/dist/esm/index.js +146 -0
  43. node_modules/@jimp/plugin-print/dist/esm/index.js.map +1 -0
  44. node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.d.ts +134 -0
  45. node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.d.ts.map +1 -0
  46. node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.js +118 -0
  47. node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.js.map +1 -0
  48. node_modules/@jimp/plugin-print/dist/esm/load-font.d.ts +131 -0
  49. node_modules/@jimp/plugin-print/dist/esm/load-font.d.ts.map +1 -0
  50. node_modules/@jimp/plugin-print/dist/esm/load-font.js +28 -0
.gitattributes CHANGED
@@ -49,3 +49,7 @@ node_modules/@jimp/plugin-blit/src/images/blit-alpha.png filter=lfs diff=lfs mer
49
  node_modules/@jimp/plugin-blur/src/__image_snapshots__/index-node-test-ts-has-alpha-image-with-alpha-1-snap.png filter=lfs diff=lfs merge=lfs -text
50
  node_modules/@jimp/plugin-color/src/__image_snapshots__/convolution-node-test-ts-convolution-new-pixel-value-is-greater-than-255-1-snap.png filter=lfs diff=lfs merge=lfs -text
51
  node_modules/@jimp/plugin-color/src/images/qr.jpg filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
49
  node_modules/@jimp/plugin-blur/src/__image_snapshots__/index-node-test-ts-has-alpha-image-with-alpha-1-snap.png filter=lfs diff=lfs merge=lfs -text
50
  node_modules/@jimp/plugin-color/src/__image_snapshots__/convolution-node-test-ts-convolution-new-pixel-value-is-greater-than-255-1-snap.png filter=lfs diff=lfs merge=lfs -text
51
  node_modules/@jimp/plugin-color/src/images/qr.jpg filter=lfs diff=lfs merge=lfs -text
52
+ node_modules/@jimp/plugin-print/dist/fonts/open-sans/open-sans-128-black/open-sans-128-black.png filter=lfs diff=lfs merge=lfs -text
53
+ node_modules/@jimp/plugin-print/dist/fonts/open-sans/open-sans-128-white/open-sans-128-white.png filter=lfs diff=lfs merge=lfs -text
54
+ node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-black/open-sans-128-black.png filter=lfs diff=lfs merge=lfs -text
55
+ node_modules/@jimp/plugin-print/fonts/open-sans/open-sans-128-white/open-sans-128-white.png filter=lfs diff=lfs merge=lfs -text
node_modules/@jimp/plugin-print/README.md ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <div align="center">
2
+ <img width="200" height="200"
3
+ src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
4
+ <h1>@jimp/core</h1>
5
+ </div>
6
+
7
+ The main Jimp class. This class can be extended with types and bitmap manipulation functions. Out of the box it does not support any image type.
8
+
9
+ - [print](http://jimp-dev.github.io/jimp/api/jimp/classes/jimp#print)
10
+ - [loadFont](http://jimp-dev.github.io/jimp/api/jimp/functions/loadfont/)
node_modules/@jimp/plugin-print/dist/commonjs/dirname-cjs.cjs.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"dirname-cjs.cjs","sourceRoot":"","sources":["../../src/dirname-cjs.cts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,SAAS,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/dirname-cjs.d.cts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"dirname-cjs.d.cts","sourceRoot":"","sources":["../../src/dirname-cjs.cts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,QAAY,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/dirname.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export declare const dirname: string;
2
+ //# sourceMappingURL=dirname-cjs.d.cts.map
node_modules/@jimp/plugin-print/dist/commonjs/dirname.js ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dirname = void 0;
4
+ exports.dirname = __dirname;
5
+ //# sourceMappingURL=dirname-cjs.cjs.map
node_modules/@jimp/plugin-print/dist/commonjs/fonts.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare const SANS_8_BLACK: string;
2
+ export declare const SANS_10_BLACK: string;
3
+ export declare const SANS_12_BLACK: string;
4
+ export declare const SANS_14_BLACK: string;
5
+ export declare const SANS_16_BLACK: string;
6
+ export declare const SANS_32_BLACK: string;
7
+ export declare const SANS_64_BLACK: string;
8
+ export declare const SANS_128_BLACK: string;
9
+ export declare const SANS_8_WHITE: string;
10
+ export declare const SANS_16_WHITE: string;
11
+ export declare const SANS_32_WHITE: string;
12
+ export declare const SANS_64_WHITE: string;
13
+ export declare const SANS_128_WHITE: string;
14
+ //# sourceMappingURL=fonts.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/fonts.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/fonts.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,QAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,cAAc,QAG1B,CAAC;AAEF,eAAO,MAAM,YAAY,QAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,cAAc,QAG1B,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/fonts.js ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SANS_128_WHITE = exports.SANS_64_WHITE = exports.SANS_32_WHITE = exports.SANS_16_WHITE = exports.SANS_8_WHITE = exports.SANS_128_BLACK = exports.SANS_64_BLACK = exports.SANS_32_BLACK = exports.SANS_16_BLACK = exports.SANS_14_BLACK = exports.SANS_12_BLACK = exports.SANS_10_BLACK = exports.SANS_8_BLACK = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const dirname_js_1 = require("./dirname.js");
9
+ const dir = path_1.default.join(dirname_js_1.dirname, "../");
10
+ exports.SANS_8_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt");
11
+ exports.SANS_10_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt");
12
+ exports.SANS_12_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt");
13
+ exports.SANS_14_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt");
14
+ exports.SANS_16_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt");
15
+ exports.SANS_32_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt");
16
+ exports.SANS_64_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt");
17
+ exports.SANS_128_BLACK = path_1.default.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt");
18
+ exports.SANS_8_WHITE = path_1.default.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt");
19
+ exports.SANS_16_WHITE = path_1.default.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt");
20
+ exports.SANS_32_WHITE = path_1.default.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt");
21
+ exports.SANS_64_WHITE = path_1.default.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt");
22
+ exports.SANS_128_WHITE = path_1.default.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt");
23
+ //# sourceMappingURL=fonts.js.map
node_modules/@jimp/plugin-print/dist/commonjs/fonts.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"fonts.js","sourceRoot":"","sources":["../../src/fonts.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,6CAAuC;AAEvC,MAAM,GAAG,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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { HorizontalAlign, VerticalAlign } from "@jimp/core";
2
+ import { JimpClass } from "@jimp/types";
3
+ import { z } from "zod";
4
+ import { BmFont } from "./types.js";
5
+ export { measureText, measureTextHeight } from "./measure-text.js";
6
+ export * from "./types.js";
7
+ declare const PrintOptionsSchema: z.ZodObject<{
8
+ /** the x position to draw the image */
9
+ x: z.ZodNumber;
10
+ /** the y position to draw the image */
11
+ y: z.ZodNumber;
12
+ /** the text to print */
13
+ text: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodObject<{
14
+ text: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
15
+ alignmentX: z.ZodOptional<z.ZodNativeEnum<typeof HorizontalAlign>>;
16
+ alignmentY: z.ZodOptional<z.ZodNativeEnum<typeof VerticalAlign>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ text: string | number;
19
+ alignmentX?: HorizontalAlign | undefined;
20
+ alignmentY?: VerticalAlign | undefined;
21
+ }, {
22
+ text: string | number;
23
+ alignmentX?: HorizontalAlign | undefined;
24
+ alignmentY?: VerticalAlign | undefined;
25
+ }>]>;
26
+ /** the boundary width to draw in */
27
+ maxWidth: z.ZodOptional<z.ZodNumber>;
28
+ /** the boundary height to draw in */
29
+ maxHeight: z.ZodOptional<z.ZodNumber>;
30
+ /** a callback for when complete that ahs the end co-ordinates of the text */
31
+ cb: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
32
+ x: z.ZodNumber;
33
+ y: z.ZodNumber;
34
+ }, "strip", z.ZodTypeAny, {
35
+ x: number;
36
+ y: number;
37
+ }, {
38
+ x: number;
39
+ y: number;
40
+ }>], null>, z.ZodUnknown>>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ x: number;
43
+ y: number;
44
+ text: string | number | {
45
+ text: string | number;
46
+ alignmentX?: HorizontalAlign | undefined;
47
+ alignmentY?: VerticalAlign | undefined;
48
+ };
49
+ maxWidth?: number | undefined;
50
+ maxHeight?: number | undefined;
51
+ cb?: ((args_0: {
52
+ x: number;
53
+ y: number;
54
+ }) => unknown) | undefined;
55
+ }, {
56
+ x: number;
57
+ y: number;
58
+ text: string | number | {
59
+ text: string | number;
60
+ alignmentX?: HorizontalAlign | undefined;
61
+ alignmentY?: VerticalAlign | undefined;
62
+ };
63
+ maxWidth?: number | undefined;
64
+ maxHeight?: number | undefined;
65
+ cb?: ((args_0: {
66
+ x: number;
67
+ y: number;
68
+ }) => unknown) | undefined;
69
+ }>;
70
+ export type PrintOptions = z.infer<typeof PrintOptionsSchema>;
71
+ export declare const methods: {
72
+ /**
73
+ * Draws a text on a image on a given boundary
74
+ * @param font a bitmap font loaded from `Jimp.loadFont` command
75
+ * @param x the x position to start drawing the text
76
+ * @param y the y position to start drawing the text
77
+ * @param text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
78
+ * @example
79
+ * ```ts
80
+ * import { Jimp } from "jimp";
81
+ *
82
+ * const image = await Jimp.read("test/image.png");
83
+ * const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
84
+ *
85
+ * image.print({ font, x: 10, y: 10, text: "Hello world!" });
86
+ * ```
87
+ */
88
+ print<I extends JimpClass>(image: I, { font, ...options }: PrintOptions & {
89
+ /** the BMFont instance */
90
+ font: BmFont<I>;
91
+ }): I;
92
+ };
93
+ //# sourceMappingURL=index.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAe,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,cAAc,YAAY,CAAC;AAE3B,QAAA,MAAM,kBAAkB;IACtB,uCAAuC;;IAEvC,uCAAuC;;IAEvC,wBAAwB;;;;;;;;;;;;;;IASxB,oCAAoC;;IAEpC,qCAAqC;;IAErC,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI7E,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAmF9D,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;;OAeG;UACG,CAAC,SAAS,SAAS,SAChB,CAAC,wBAIL,YAAY,GAAG;QAChB,0BAA0B;QAC1B,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;KACjB;CA4EJ,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/index.js ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.methods = exports.measureTextHeight = exports.measureText = void 0;
18
+ const core_1 = require("@jimp/core");
19
+ const plugin_blit_1 = require("@jimp/plugin-blit");
20
+ const zod_1 = require("zod");
21
+ const measure_text_js_1 = require("./measure-text.js");
22
+ var measure_text_js_2 = require("./measure-text.js");
23
+ Object.defineProperty(exports, "measureText", { enumerable: true, get: function () { return measure_text_js_2.measureText; } });
24
+ Object.defineProperty(exports, "measureTextHeight", { enumerable: true, get: function () { return measure_text_js_2.measureTextHeight; } });
25
+ __exportStar(require("./types.js"), exports);
26
+ const PrintOptionsSchema = zod_1.z.object({
27
+ /** the x position to draw the image */
28
+ x: zod_1.z.number(),
29
+ /** the y position to draw the image */
30
+ y: zod_1.z.number(),
31
+ /** the text to print */
32
+ text: zod_1.z.union([
33
+ zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
34
+ zod_1.z.object({
35
+ text: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]),
36
+ alignmentX: zod_1.z.nativeEnum(core_1.HorizontalAlign).optional(),
37
+ alignmentY: zod_1.z.nativeEnum(core_1.VerticalAlign).optional(),
38
+ }),
39
+ ]),
40
+ /** the boundary width to draw in */
41
+ maxWidth: zod_1.z.number().optional(),
42
+ /** the boundary height to draw in */
43
+ maxHeight: zod_1.z.number().optional(),
44
+ /** a callback for when complete that ahs the end co-ordinates of the text */
45
+ cb: zod_1.z
46
+ .function(zod_1.z.tuple([zod_1.z.object({ x: zod_1.z.number(), y: zod_1.z.number() })]))
47
+ .optional(),
48
+ });
49
+ function xOffsetBasedOnAlignment(font, line, maxWidth, alignment) {
50
+ if (alignment === core_1.HorizontalAlign.LEFT) {
51
+ return 0;
52
+ }
53
+ if (alignment === core_1.HorizontalAlign.CENTER) {
54
+ return (maxWidth - (0, measure_text_js_1.measureText)(font, line)) / 2;
55
+ }
56
+ return maxWidth - (0, measure_text_js_1.measureText)(font, line);
57
+ }
58
+ function drawCharacter(image, font, x, y, char) {
59
+ if (char.width > 0 && char.height > 0) {
60
+ const characterPage = font.pages[char.page];
61
+ if (characterPage) {
62
+ image = plugin_blit_1.methods.blit(image, {
63
+ src: characterPage,
64
+ x: x + char.xoffset,
65
+ y: y + char.yoffset,
66
+ srcX: char.x,
67
+ srcY: char.y,
68
+ srcW: char.width,
69
+ srcH: char.height,
70
+ });
71
+ }
72
+ }
73
+ return image;
74
+ }
75
+ function printText(image, font, x, y, text, defaultCharWidth) {
76
+ for (let i = 0; i < text.length; i++) {
77
+ const stringChar = text[i];
78
+ let char;
79
+ if (font.chars[stringChar]) {
80
+ char = stringChar;
81
+ }
82
+ else if (/\s/.test(stringChar)) {
83
+ char = "";
84
+ }
85
+ else {
86
+ char = "?";
87
+ }
88
+ const fontChar = font.chars[char] || { xadvance: undefined };
89
+ const fontKerning = font.kernings[char];
90
+ if (fontChar) {
91
+ drawCharacter(image, font, x, y, fontChar);
92
+ }
93
+ const nextChar = text[i + 1];
94
+ const kerning = fontKerning && nextChar && fontKerning[nextChar]
95
+ ? fontKerning[nextChar] || 0
96
+ : 0;
97
+ x += kerning + (fontChar.xadvance || defaultCharWidth);
98
+ }
99
+ }
100
+ exports.methods = {
101
+ /**
102
+ * Draws a text on a image on a given boundary
103
+ * @param font a bitmap font loaded from `Jimp.loadFont` command
104
+ * @param x the x position to start drawing the text
105
+ * @param y the y position to start drawing the text
106
+ * @param text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
107
+ * @example
108
+ * ```ts
109
+ * import { Jimp } from "jimp";
110
+ *
111
+ * const image = await Jimp.read("test/image.png");
112
+ * const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
113
+ *
114
+ * image.print({ font, x: 10, y: 10, text: "Hello world!" });
115
+ * ```
116
+ */
117
+ print(image, { font, ...options }) {
118
+ let {
119
+ // eslint-disable-next-line prefer-const
120
+ x, y, text,
121
+ // eslint-disable-next-line prefer-const
122
+ maxWidth = Infinity,
123
+ // eslint-disable-next-line prefer-const
124
+ maxHeight = Infinity,
125
+ // eslint-disable-next-line prefer-const
126
+ cb = () => { }, } = PrintOptionsSchema.parse(options);
127
+ let alignmentX;
128
+ let alignmentY;
129
+ if (typeof text === "object" &&
130
+ text.text !== null &&
131
+ text.text !== undefined) {
132
+ alignmentX = text.alignmentX || core_1.HorizontalAlign.LEFT;
133
+ alignmentY = text.alignmentY || core_1.VerticalAlign.TOP;
134
+ ({ text } = text);
135
+ }
136
+ else {
137
+ alignmentX = core_1.HorizontalAlign.LEFT;
138
+ alignmentY = core_1.VerticalAlign.TOP;
139
+ text = text.toString();
140
+ }
141
+ if (typeof text === "number") {
142
+ text = text.toString();
143
+ }
144
+ if (maxHeight !== Infinity && alignmentY === core_1.VerticalAlign.BOTTOM) {
145
+ y += maxHeight - (0, measure_text_js_1.measureTextHeight)(font, text, maxWidth);
146
+ }
147
+ else if (maxHeight !== Infinity && alignmentY === core_1.VerticalAlign.MIDDLE) {
148
+ y += maxHeight / 2 - (0, measure_text_js_1.measureTextHeight)(font, text, maxWidth) / 2;
149
+ }
150
+ const defaultCharWidth = Object.entries(font.chars).find((c) => c[1].xadvance)?.[1].xadvance;
151
+ if (typeof defaultCharWidth !== "number") {
152
+ throw new Error("Could not find default character width");
153
+ }
154
+ const { lines, longestLine } = (0, measure_text_js_1.splitLines)(font, text, maxWidth);
155
+ lines.forEach((line) => {
156
+ const lineString = line.join(" ");
157
+ const alignmentWidth = xOffsetBasedOnAlignment(font, lineString, maxWidth, alignmentX);
158
+ printText(image, font, x + alignmentWidth, y, lineString, defaultCharWidth);
159
+ y += font.common.lineHeight;
160
+ });
161
+ cb.bind(image)({ x: x + longestLine, y });
162
+ return image;
163
+ },
164
+ };
165
+ //# sourceMappingURL=index.js.map
node_modules/@jimp/plugin-print/dist/commonjs/index.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,qCAA4D;AAE5D,mDAA2D;AAC3D,6BAAwB;AAExB,uDAA+E;AAG/E,qDAAmE;AAA1D,8GAAA,WAAW,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AACvC,6CAA2B;AAE3B,MAAM,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IAClC,uCAAuC;IACvC,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE;IACb,uCAAuC;IACvC,CAAC,EAAE,OAAC,CAAC,MAAM,EAAE;IACb,wBAAwB;IACxB,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC;QACZ,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC;QACjC,OAAC,CAAC,MAAM,CAAC;YACP,IAAI,EAAE,OAAC,CAAC,KAAK,CAAC,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC;YACvC,UAAU,EAAE,OAAC,CAAC,UAAU,CAAC,sBAAe,CAAC,CAAC,QAAQ,EAAE;YACpD,UAAU,EAAE,OAAC,CAAC,UAAU,CAAC,oBAAa,CAAC,CAAC,QAAQ,EAAE;SACnD,CAAC;KACH,CAAC;IACF,oCAAoC;IACpC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,qCAAqC;IACrC,SAAS,EAAE,OAAC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AC;IACf,CAAC;CACF,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.d.ts ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BmCharacter, BmKerning, BmFont, BmCommonProps } from "./types.js";
2
+ export declare const isWebWorker: boolean;
3
+ export interface LoadedFont {
4
+ chars: BmCharacter[];
5
+ kernings: BmKerning[];
6
+ common: BmCommonProps;
7
+ info: Record<string, any>;
8
+ pages: string[];
9
+ }
10
+ /**
11
+ *
12
+ * @param bufferOrUrl A URL to a file or a buffer
13
+ * @returns
14
+ */
15
+ export declare function loadBitmapFontData(bufferOrUrl: string | Buffer): Promise<LoadedFont>;
16
+ type RawFont = Awaited<ReturnType<typeof loadBitmapFontData>>;
17
+ export type ResolveBmFont = Omit<BmFont, "pages"> & Pick<RawFont, "pages">;
18
+ export declare function processBitmapFont(file: string, font: LoadedFont): Promise<{
19
+ chars: Record<string, BmCharacter>;
20
+ kernings: Record<string, BmKerning>;
21
+ pages: ({
22
+ bitmap: import("@jimp/types").Bitmap;
23
+ background: number;
24
+ formats: import("@jimp/types").Format<any>[];
25
+ mime?: string;
26
+ inspect(): string;
27
+ toString(): string;
28
+ readonly width: number;
29
+ readonly height: number;
30
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
31
+ filterType?: import("@jimp/js-png").PNGFilterType;
32
+ colorType?: import("@jimp/js-png").PNGColorType;
33
+ inputColorType?: import("@jimp/js-png").PNGColorType;
34
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
35
+ filterType?: import("@jimp/js-png").PNGFilterType;
36
+ colorType?: import("@jimp/js-png").PNGColorType;
37
+ inputColorType?: import("@jimp/js-png").PNGColorType;
38
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
39
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
40
+ filterType?: import("@jimp/js-png").PNGFilterType;
41
+ colorType?: import("@jimp/js-png").PNGColorType;
42
+ inputColorType?: import("@jimp/js-png").PNGColorType;
43
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
44
+ filterType?: import("@jimp/js-png").PNGFilterType;
45
+ colorType?: import("@jimp/js-png").PNGColorType;
46
+ inputColorType?: import("@jimp/js-png").PNGColorType;
47
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
48
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
49
+ filterType?: import("@jimp/js-png").PNGFilterType;
50
+ colorType?: import("@jimp/js-png").PNGColorType;
51
+ inputColorType?: import("@jimp/js-png").PNGColorType;
52
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
53
+ filterType?: import("@jimp/js-png").PNGFilterType;
54
+ colorType?: import("@jimp/js-png").PNGColorType;
55
+ inputColorType?: import("@jimp/js-png").PNGColorType;
56
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
57
+ clone<S extends unknown>(this: S): S;
58
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
59
+ getPixelColor(x: number, y: number): number;
60
+ setPixelColor(hex: number, x: number, y: number): any;
61
+ hasAlpha(): boolean;
62
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
63
+ mode?: import("@jimp/core").BlendMode;
64
+ opacitySource?: number;
65
+ opacityDest?: number;
66
+ }): any;
67
+ scan(f: (x: number, y: number, idx: number) => any): any;
68
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
69
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
70
+ x: number;
71
+ y: number;
72
+ idx: number;
73
+ image: any;
74
+ }, void, unknown>;
75
+ } & import("@jimp/core").JimpInstanceMethods<{
76
+ bitmap: import("@jimp/types").Bitmap;
77
+ background: number;
78
+ formats: import("@jimp/types").Format<any>[];
79
+ mime?: string;
80
+ inspect(): string;
81
+ toString(): string;
82
+ readonly width: number;
83
+ readonly height: number;
84
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
85
+ filterType?: import("@jimp/js-png").PNGFilterType;
86
+ colorType?: import("@jimp/js-png").PNGColorType;
87
+ inputColorType?: import("@jimp/js-png").PNGColorType;
88
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
89
+ filterType?: import("@jimp/js-png").PNGFilterType;
90
+ colorType?: import("@jimp/js-png").PNGColorType;
91
+ inputColorType?: import("@jimp/js-png").PNGColorType;
92
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
93
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
94
+ filterType?: import("@jimp/js-png").PNGFilterType;
95
+ colorType?: import("@jimp/js-png").PNGColorType;
96
+ inputColorType?: import("@jimp/js-png").PNGColorType;
97
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
98
+ filterType?: import("@jimp/js-png").PNGFilterType;
99
+ colorType?: import("@jimp/js-png").PNGColorType;
100
+ inputColorType?: import("@jimp/js-png").PNGColorType;
101
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
102
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
103
+ filterType?: import("@jimp/js-png").PNGFilterType;
104
+ colorType?: import("@jimp/js-png").PNGColorType;
105
+ inputColorType?: import("@jimp/js-png").PNGColorType;
106
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
107
+ filterType?: import("@jimp/js-png").PNGFilterType;
108
+ colorType?: import("@jimp/js-png").PNGColorType;
109
+ inputColorType?: import("@jimp/js-png").PNGColorType;
110
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
111
+ clone<S extends unknown>(this: S): S;
112
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
113
+ getPixelColor(x: number, y: number): number;
114
+ setPixelColor(hex: number, x: number, y: number): any;
115
+ hasAlpha(): boolean;
116
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
117
+ mode?: import("@jimp/core").BlendMode;
118
+ opacitySource?: number;
119
+ opacityDest?: number;
120
+ }): any;
121
+ scan(f: (x: number, y: number, idx: number) => any): any;
122
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
123
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
124
+ x: number;
125
+ y: number;
126
+ idx: number;
127
+ image: any;
128
+ }, void, unknown>;
129
+ }, import("@jimp/core").JimpPlugin>)[];
130
+ common: BmCommonProps;
131
+ info: Record<string, any>;
132
+ }>;
133
+ export {};
134
+ //# sourceMappingURL=load-bitmap-font.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-bitmap-font.d.ts","sourceRoot":"","sources":["../../src/load-bitmap-font.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAQ3E,eAAO,MAAM,WAAW,SACoC,CAAC;AAoB7D,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IAEtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AA0CD;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,OAAO,CAAC,UAAU,CAAC,CA4CrB;AAED,KAAK,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAE3E,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA4Bqie,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAo3R,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;YAlIzmwB,aAAa;UAEf,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;GA+H1B"}
node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.js ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isWebWorker = void 0;
7
+ exports.loadBitmapFontData = loadBitmapFontData;
8
+ exports.processBitmapFont = processBitmapFont;
9
+ const parse_bmfont_ascii_1 = __importDefault(require("parse-bmfont-ascii"));
10
+ const parse_bmfont_xml_1 = __importDefault(require("parse-bmfont-xml"));
11
+ const parse_bmfont_binary_1 = __importDefault(require("parse-bmfont-binary"));
12
+ const js_png_1 = __importDefault(require("@jimp/js-png"));
13
+ const core_1 = require("@jimp/core");
14
+ const path_1 = __importDefault(require("path"));
15
+ const simple_xml_to_json_1 = __importDefault(require("simple-xml-to-json"));
16
+ const { convertXML } = simple_xml_to_json_1.default;
17
+ exports.isWebWorker = typeof self !== "undefined" && self.document === undefined;
18
+ const CharacterJimp = (0, core_1.createJimp)({ formats: [js_png_1.default] });
19
+ const HEADER = Buffer.from([66, 77, 70, 3]);
20
+ function isBinary(buf) {
21
+ if (typeof buf === "string") {
22
+ return buf.substring(0, 3) === "BMF";
23
+ }
24
+ const startOfHeader = buf.slice(0, 4);
25
+ return (buf.length > 4 &&
26
+ startOfHeader[0] === HEADER[0] &&
27
+ startOfHeader[1] === HEADER[1] &&
28
+ startOfHeader[2] === HEADER[2]);
29
+ }
30
+ function parseFont(file, data) {
31
+ if (isBinary(data)) {
32
+ if (typeof data === "string") {
33
+ data = Buffer.from(data, "binary");
34
+ }
35
+ return (0, parse_bmfont_binary_1.default)(data);
36
+ }
37
+ data = data.toString().trim();
38
+ if (/.json$/.test(file) || data.charAt(0) === "{") {
39
+ return JSON.parse(data);
40
+ }
41
+ if (/.xml$/.test(file) || data.charAt(0) === "<") {
42
+ return (0, parse_bmfont_xml_1.default)(data);
43
+ }
44
+ return (0, parse_bmfont_ascii_1.default)(data);
45
+ }
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
+ function parseNumbersInObject(obj) {
48
+ for (const key in obj) {
49
+ try {
50
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
51
+ obj[key] = parseInt(obj[key], 10);
52
+ }
53
+ catch {
54
+ // do nothing
55
+ }
56
+ if (typeof obj[key] === "object") {
57
+ parseNumbersInObject(obj[key]);
58
+ }
59
+ }
60
+ return obj;
61
+ }
62
+ /**
63
+ *
64
+ * @param bufferOrUrl A URL to a file or a buffer
65
+ * @returns
66
+ */
67
+ async function loadBitmapFontData(bufferOrUrl) {
68
+ if (exports.isWebWorker && typeof bufferOrUrl === "string") {
69
+ const res = await fetch(bufferOrUrl);
70
+ const text = await res.text();
71
+ const json = convertXML(text);
72
+ const font = json.font.children.reduce(
73
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ (acc, i) => ({ ...acc, ...i }), {});
75
+ const pages = [];
76
+ const chars = [];
77
+ const kernings = [];
78
+ for (let i = 0; i < font.pages.children.length; i++) {
79
+ const p = font.pages.children[i].page;
80
+ const id = parseInt(p.id, 10);
81
+ pages[id] = parseNumbersInObject(p.file);
82
+ }
83
+ for (let i = 0; i < font.chars.children.length; i++) {
84
+ chars.push(parseNumbersInObject(font.chars.children[i].char));
85
+ }
86
+ for (let i = 0; i < font.kernings.children.length; i++) {
87
+ kernings.push(parseNumbersInObject(font.kernings.children[i].kerning));
88
+ }
89
+ return {
90
+ info: font.info,
91
+ common: font.common,
92
+ pages,
93
+ chars,
94
+ kernings,
95
+ };
96
+ }
97
+ else if (typeof bufferOrUrl === "string") {
98
+ const res = await fetch(bufferOrUrl);
99
+ const text = await res.text();
100
+ return parseFont(bufferOrUrl, text);
101
+ }
102
+ else {
103
+ return parseFont("", bufferOrUrl);
104
+ }
105
+ }
106
+ async function processBitmapFont(file, font) {
107
+ const chars = {};
108
+ const kernings = {};
109
+ for (let i = 0; i < font.chars.length; i++) {
110
+ const char = font.chars[i];
111
+ chars[String.fromCharCode(char.id)] = char;
112
+ }
113
+ for (let i = 0; i < font.kernings.length; i++) {
114
+ const firstString = String.fromCharCode(font.kernings[i].first);
115
+ kernings[firstString] = kernings[firstString] || {};
116
+ kernings[firstString][String.fromCharCode(font.kernings[i].second)] =
117
+ font.kernings[i].amount;
118
+ }
119
+ return {
120
+ ...font,
121
+ chars,
122
+ kernings,
123
+ pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(path_1.default.join(path_1.default.dirname(file), page)))),
124
+ };
125
+ }
126
+ //# sourceMappingURL=load-bitmap-font.js.map
node_modules/@jimp/plugin-print/dist/commonjs/load-bitmap-font.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-bitmap-font.js","sourceRoot":"","sources":["../../src/load-bitmap-font.ts"],"names":[],"mappings":";;;;;;AAsFA,gDA8CC;AAKD,8CA2BC;AApK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D,QAAQ,CAAC,WAAW,CAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC,CAAC;YACnE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,MAAM,CAAC;IAC7B,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,KAAK;QACL,QAAQ;QACR,KAAK,EAAE,MAAM,OAAO,CAAC,GAAG,CACtB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAC5B,aAAa,CAAC,IAAI,CAAC,cAAI,CAAC,IAAI,CAAC,cAAI,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAC,CACxD,CACF;KACF,CAAC;AACJ,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/load-font.d.ts ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Loads a Bitmap Font from a file.
3
+ * @param file A path or URL to a font file
4
+ * @returns A collection of Jimp images that can be used to print text
5
+ * @example
6
+ * ```ts
7
+ * import { Jimp, loadFont } from "jimp";
8
+ * import { SANS_10_BLACK } from "jimp/fonts";
9
+ *
10
+ * const font = await loadFont(SANS_10_BLACK);
11
+ * const image = new Jimp({ width: 200, height: 100, color: 0xffffffff });
12
+ *
13
+ * image.print(font, 10, 10, "Hello world!");
14
+ * ```
15
+ */
16
+ export declare function loadFont(file: string): Promise<{
17
+ chars: Record<string, import("./types.js").BmCharacter>;
18
+ kernings: Record<string, import("./types.js").BmKerning>;
19
+ pages: ({
20
+ bitmap: import("@jimp/types").Bitmap;
21
+ background: number;
22
+ formats: import("@jimp/types").Format<any>[];
23
+ mime?: string;
24
+ inspect(): string;
25
+ toString(): string;
26
+ readonly width: number;
27
+ readonly height: number;
28
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
29
+ filterType?: import("@jimp/js-png").PNGFilterType;
30
+ colorType?: import("@jimp/js-png").PNGColorType;
31
+ inputColorType?: import("@jimp/js-png").PNGColorType;
32
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
33
+ filterType?: import("@jimp/js-png").PNGFilterType;
34
+ colorType?: import("@jimp/js-png").PNGColorType;
35
+ inputColorType?: import("@jimp/js-png").PNGColorType;
36
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
37
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
38
+ filterType?: import("@jimp/js-png").PNGFilterType;
39
+ colorType?: import("@jimp/js-png").PNGColorType;
40
+ inputColorType?: import("@jimp/js-png").PNGColorType;
41
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
42
+ filterType?: import("@jimp/js-png").PNGFilterType;
43
+ colorType?: import("@jimp/js-png").PNGColorType;
44
+ inputColorType?: import("@jimp/js-png").PNGColorType;
45
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
46
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
47
+ filterType?: import("@jimp/js-png").PNGFilterType;
48
+ colorType?: import("@jimp/js-png").PNGColorType;
49
+ inputColorType?: import("@jimp/js-png").PNGColorType;
50
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
51
+ filterType?: import("@jimp/js-png").PNGFilterType;
52
+ colorType?: import("@jimp/js-png").PNGColorType;
53
+ inputColorType?: import("@jimp/js-png").PNGColorType;
54
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
55
+ clone<S extends unknown>(this: S): S;
56
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
57
+ getPixelColor(x: number, y: number): number;
58
+ setPixelColor(hex: number, x: number, y: number): any;
59
+ hasAlpha(): boolean;
60
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
61
+ mode?: import("@jimp/core").BlendMode;
62
+ opacitySource?: number;
63
+ opacityDest?: number;
64
+ }): any;
65
+ scan(f: (x: number, y: number, idx: number) => any): any;
66
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
67
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
68
+ x: number;
69
+ y: number;
70
+ idx: number;
71
+ image: any;
72
+ }, void, unknown>;
73
+ } & import("@jimp/core").JimpInstanceMethods<{
74
+ bitmap: import("@jimp/types").Bitmap;
75
+ background: number;
76
+ formats: import("@jimp/types").Format<any>[];
77
+ mime?: string;
78
+ inspect(): string;
79
+ toString(): string;
80
+ readonly width: number;
81
+ readonly height: number;
82
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
83
+ filterType?: import("@jimp/js-png").PNGFilterType;
84
+ colorType?: import("@jimp/js-png").PNGColorType;
85
+ inputColorType?: import("@jimp/js-png").PNGColorType;
86
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
87
+ filterType?: import("@jimp/js-png").PNGFilterType;
88
+ colorType?: import("@jimp/js-png").PNGColorType;
89
+ inputColorType?: import("@jimp/js-png").PNGColorType;
90
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
91
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
92
+ filterType?: import("@jimp/js-png").PNGFilterType;
93
+ colorType?: import("@jimp/js-png").PNGColorType;
94
+ inputColorType?: import("@jimp/js-png").PNGColorType;
95
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
96
+ filterType?: import("@jimp/js-png").PNGFilterType;
97
+ colorType?: import("@jimp/js-png").PNGColorType;
98
+ inputColorType?: import("@jimp/js-png").PNGColorType;
99
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
100
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
101
+ filterType?: import("@jimp/js-png").PNGFilterType;
102
+ colorType?: import("@jimp/js-png").PNGColorType;
103
+ inputColorType?: import("@jimp/js-png").PNGColorType;
104
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
105
+ filterType?: import("@jimp/js-png").PNGFilterType;
106
+ colorType?: import("@jimp/js-png").PNGColorType;
107
+ inputColorType?: import("@jimp/js-png").PNGColorType;
108
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
109
+ clone<S extends unknown>(this: S): S;
110
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
111
+ getPixelColor(x: number, y: number): number;
112
+ setPixelColor(hex: number, x: number, y: number): any;
113
+ hasAlpha(): boolean;
114
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
115
+ mode?: import("@jimp/core").BlendMode;
116
+ opacitySource?: number;
117
+ opacityDest?: number;
118
+ }): any;
119
+ scan(f: (x: number, y: number, idx: number) => any): any;
120
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
121
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
122
+ x: number;
123
+ y: number;
124
+ idx: number;
125
+ image: any;
126
+ }, void, unknown>;
127
+ }, import("@jimp/core").JimpPlugin>)[];
128
+ common: import("./types.js").BmCommonProps;
129
+ info: Record<string, any>;
130
+ }>;
131
+ //# sourceMappingURL=load-font.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/load-font.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-font.d.ts","sourceRoot":"","sources":["../../src/load-font.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAcq/kB,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAo3R,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;;;GADvi3B"}
node_modules/@jimp/plugin-print/dist/commonjs/load-font.js ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadFont = loadFont;
4
+ const load_bitmap_font_js_1 = require("./load-bitmap-font.js");
5
+ /**
6
+ * Loads a Bitmap Font from a file.
7
+ * @param file A path or URL to a font file
8
+ * @returns A collection of Jimp images that can be used to print text
9
+ * @example
10
+ * ```ts
11
+ * import { Jimp, loadFont } from "jimp";
12
+ * import { SANS_10_BLACK } from "jimp/fonts";
13
+ *
14
+ * const font = await loadFont(SANS_10_BLACK);
15
+ * const image = new Jimp({ width: 200, height: 100, color: 0xffffffff });
16
+ *
17
+ * image.print(font, 10, 10, "Hello world!");
18
+ * ```
19
+ */
20
+ async function loadFont(file) {
21
+ let fileOrBuffer = file;
22
+ if (typeof window === "undefined" && !load_bitmap_font_js_1.isWebWorker) {
23
+ const { existsSync, promises: fs } = await import("fs");
24
+ if (existsSync(file)) {
25
+ fileOrBuffer = await fs.readFile(file);
26
+ }
27
+ }
28
+ const data = await (0, load_bitmap_font_js_1.loadBitmapFontData)(fileOrBuffer);
29
+ return (0, load_bitmap_font_js_1.processBitmapFont)(file, data);
30
+ }
31
+ //# sourceMappingURL=load-font.js.map
node_modules/@jimp/plugin-print/dist/commonjs/load-font.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-font.js","sourceRoot":"","sources":["../../src/load-font.ts"],"names":[],"mappings":";;AAqBA,4BAaC;AAlCD,+DAI+B;AAE/B;;;;;;;;;;;;;;GAcG;AACI,KAAK,UAAU,QAAQ,CAAC,IAAY;IACzC,IAAI,YAAY,GAAoB,IAAI,CAAC;IAEzC,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,CAAC,iCAAW,EAAE,CAAC;QAClD,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QAExD,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;YACrB,YAAY,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACzC,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,IAAA,wCAAkB,EAAC,YAAY,CAAC,CAAC;IACpD,OAAO,IAAA,uCAAiB,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC"}
node_modules/@jimp/plugin-print/dist/commonjs/measure-text.d.ts ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ import { BmFont } from "./types.js";
2
+ export declare function measureText(font: BmFont, text: string): number;
3
+ export declare function splitLines(font: BmFont, text: string, maxWidth: number): {
4
+ lines: string[][];
5
+ longestLine: number;
6
+ };
7
+ export declare function measureTextHeight(font: BmFont, text: string, maxWidth: number): number;
8
+ //# sourceMappingURL=measure-text.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/measure-text.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"measure-text.d.ts","sourceRoot":"","sources":["../../src/measure-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,UAoBrD;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;;;EAyDtE;AAED,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,UAKjB"}
node_modules/@jimp/plugin-print/dist/commonjs/measure-text.js ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.measureText = measureText;
4
+ exports.splitLines = splitLines;
5
+ exports.measureTextHeight = measureTextHeight;
6
+ function measureText(font, text) {
7
+ let x = 0;
8
+ for (let i = 0; i < text.length; i++) {
9
+ const char = text[i];
10
+ const fontChar = font.chars[char];
11
+ if (fontChar) {
12
+ const fontKerning = font.kernings[char];
13
+ const nextChar = text[i + 1];
14
+ const kerning = fontKerning && nextChar && fontKerning[nextChar]
15
+ ? fontKerning[nextChar] || 0
16
+ : 0;
17
+ x += (fontChar.xadvance || 0) + kerning;
18
+ }
19
+ }
20
+ return x;
21
+ }
22
+ function splitLines(font, text, maxWidth) {
23
+ const words = text.replace(/[\r\n]+/g, " \n").split(" ");
24
+ const lines = [];
25
+ let currentLine = [];
26
+ let longestLine = 0;
27
+ words.forEach((word) => {
28
+ const wordWidth = measureText(font, word + (words.length > 1 ? " " : ""));
29
+ // If a word is longer than the allowable width we need to split it across lines.
30
+ if (wordWidth > maxWidth) {
31
+ const characterIterator = word[Symbol.iterator]();
32
+ let current = "";
33
+ for (const char of characterIterator) {
34
+ const nextLine = [...currentLine, current + char].join(" ");
35
+ const length = measureText(font, nextLine);
36
+ if (length < maxWidth) {
37
+ current += char;
38
+ }
39
+ else if (length > maxWidth) {
40
+ lines.push([...currentLine, current]);
41
+ currentLine = [];
42
+ current = char;
43
+ }
44
+ else {
45
+ lines.push([...currentLine, current + char]);
46
+ currentLine = [];
47
+ current = "";
48
+ }
49
+ }
50
+ return;
51
+ }
52
+ const line = [...currentLine, word].join(" ");
53
+ const length = measureText(font, line);
54
+ if (length <= maxWidth && !word.includes("\n")) {
55
+ if (length > longestLine) {
56
+ longestLine = length;
57
+ }
58
+ currentLine.push(word);
59
+ }
60
+ else {
61
+ lines.push(currentLine);
62
+ currentLine = [word.replace("\n", "")];
63
+ }
64
+ });
65
+ lines.push(currentLine);
66
+ return {
67
+ lines,
68
+ longestLine,
69
+ };
70
+ }
71
+ function measureTextHeight(font, text, maxWidth) {
72
+ const { lines } = splitLines(font, text, maxWidth);
73
+ return lines.length * font.common.lineHeight;
74
+ }
75
+ //# sourceMappingURL=measure-text.js.map
node_modules/@jimp/plugin-print/dist/commonjs/measure-text.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"measure-text.js","sourceRoot":"","sources":["../../src/measure-text.ts"],"names":[],"mappings":";;AAEA,kCAoBC;AAED,gCAyDC;AAED,8CAQC;AAzFD,SAAgB,WAAW,CAAC,IAAY,EAAE,IAAY;IACpD,IAAI,CAAC,GAAG,CAAC,CAAC;IAEV,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAElC,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC7B,MAAM,OAAO,GACX,WAAW,IAAI,QAAQ,IAAI,WAAW,CAAC,QAAQ,CAAC;gBAC9C,CAAC,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC5B,CAAC,CAAC,CAAC,CAAC;YAER,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC;QAC1C,CAAC;IACH,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,UAAU,CAAC,IAAY,EAAE,IAAY,EAAE,QAA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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { JimpClass } from "@jimp/types";
2
+ export interface BmCharacter {
3
+ id: number;
4
+ xadvance: number;
5
+ width: number;
6
+ height: number;
7
+ xoffset: number;
8
+ yoffset: number;
9
+ page: number;
10
+ x: number;
11
+ y: number;
12
+ }
13
+ export interface BmKerning {
14
+ [secondString: string]: number;
15
+ first: number;
16
+ second: number;
17
+ amount: number;
18
+ }
19
+ export interface BmCommonProps {
20
+ lineHeight: number;
21
+ }
22
+ export interface BmFont<T extends JimpClass = JimpClass> {
23
+ chars: Record<string, BmCharacter>;
24
+ kernings: Record<string, BmKerning>;
25
+ common: BmCommonProps;
26
+ info: Record<string, any>;
27
+ pages: T[];
28
+ }
29
+ //# sourceMappingURL=types.d.ts.map
node_modules/@jimp/plugin-print/dist/commonjs/types.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IACrD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;IAEtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,EAAE,CAAC;CACZ"}
node_modules/@jimp/plugin-print/dist/commonjs/types.js ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
node_modules/@jimp/plugin-print/dist/commonjs/types.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
node_modules/@jimp/plugin-print/dist/esm/dirname.d.ts ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ export declare const dirname: string;
2
+ //# sourceMappingURL=dirname.d.ts.map
node_modules/@jimp/plugin-print/dist/esm/dirname.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"dirname.d.ts","sourceRoot":"","sources":["../../src/dirname.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO,QAA+C,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/dirname.js ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ import { fileURLToPath } from "url";
2
+ import path from "path";
3
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
4
+ // @ts-ignore Dual package
5
+ export const dirname = path.dirname(fileURLToPath(import.meta.url));
6
+ //# sourceMappingURL=dirname.js.map
node_modules/@jimp/plugin-print/dist/esm/dirname.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"dirname.js","sourceRoot":"","sources":["../../src/dirname.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,6DAA6D;AAC7D,0BAA0B;AAC1B,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/fonts.d.ts ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export declare const SANS_8_BLACK: string;
2
+ export declare const SANS_10_BLACK: string;
3
+ export declare const SANS_12_BLACK: string;
4
+ export declare const SANS_14_BLACK: string;
5
+ export declare const SANS_16_BLACK: string;
6
+ export declare const SANS_32_BLACK: string;
7
+ export declare const SANS_64_BLACK: string;
8
+ export declare const SANS_128_BLACK: string;
9
+ export declare const SANS_8_WHITE: string;
10
+ export declare const SANS_16_WHITE: string;
11
+ export declare const SANS_32_WHITE: string;
12
+ export declare const SANS_64_WHITE: string;
13
+ export declare const SANS_128_WHITE: string;
14
+ //# sourceMappingURL=fonts.d.ts.map
node_modules/@jimp/plugin-print/dist/esm/fonts.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"fonts.d.ts","sourceRoot":"","sources":["../../src/fonts.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,QAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,cAAc,QAG1B,CAAC;AAEF,eAAO,MAAM,YAAY,QAGxB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,aAAa,QAGzB,CAAC;AAEF,eAAO,MAAM,cAAc,QAG1B,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/fonts.js ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import path from "path";
2
+ import { dirname } from "./dirname.js";
3
+ const dir = path.join(dirname, "../");
4
+ export const SANS_8_BLACK = path.join(dir, "fonts/open-sans/open-sans-8-black/open-sans-8-black.fnt");
5
+ export const SANS_10_BLACK = path.join(dir, "fonts/open-sans/open-sans-10-black/open-sans-10-black.fnt");
6
+ export const SANS_12_BLACK = path.join(dir, "fonts/open-sans/open-sans-12-black/open-sans-12-black.fnt");
7
+ export const SANS_14_BLACK = path.join(dir, "fonts/open-sans/open-sans-14-black/open-sans-14-black.fnt");
8
+ export const SANS_16_BLACK = path.join(dir, "fonts/open-sans/open-sans-16-black/open-sans-16-black.fnt");
9
+ export const SANS_32_BLACK = path.join(dir, "fonts/open-sans/open-sans-32-black/open-sans-32-black.fnt");
10
+ export const SANS_64_BLACK = path.join(dir, "fonts/open-sans/open-sans-64-black/open-sans-64-black.fnt");
11
+ export const SANS_128_BLACK = path.join(dir, "fonts/open-sans/open-sans-128-black/open-sans-128-black.fnt");
12
+ export const SANS_8_WHITE = path.join(dir, "fonts/open-sans/open-sans-8-white/open-sans-8-white.fnt");
13
+ export const SANS_16_WHITE = path.join(dir, "fonts/open-sans/open-sans-16-white/open-sans-16-white.fnt");
14
+ export const SANS_32_WHITE = path.join(dir, "fonts/open-sans/open-sans-32-white/open-sans-32-white.fnt");
15
+ export const SANS_64_WHITE = path.join(dir, "fonts/open-sans/open-sans-64-white/open-sans-64-white.fnt");
16
+ export const SANS_128_WHITE = path.join(dir, "fonts/open-sans/open-sans-128-white/open-sans-128-white.fnt");
17
+ //# sourceMappingURL=fonts.js.map
node_modules/@jimp/plugin-print/dist/esm/fonts.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":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5D,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CACpC,GAAG,EACH,2DAA2D,CAC5D,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CACrC,GAAG,EACH,6DAA6D,CAC9D,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/index.d.ts ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { HorizontalAlign, VerticalAlign } from "@jimp/core";
2
+ import { JimpClass } from "@jimp/types";
3
+ import { z } from "zod";
4
+ import { BmFont } from "./types.js";
5
+ export { measureText, measureTextHeight } from "./measure-text.js";
6
+ export * from "./types.js";
7
+ declare const PrintOptionsSchema: z.ZodObject<{
8
+ /** the x position to draw the image */
9
+ x: z.ZodNumber;
10
+ /** the y position to draw the image */
11
+ y: z.ZodNumber;
12
+ /** the text to print */
13
+ text: z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodNumber]>, z.ZodObject<{
14
+ text: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
15
+ alignmentX: z.ZodOptional<z.ZodNativeEnum<typeof HorizontalAlign>>;
16
+ alignmentY: z.ZodOptional<z.ZodNativeEnum<typeof VerticalAlign>>;
17
+ }, "strip", z.ZodTypeAny, {
18
+ text: string | number;
19
+ alignmentX?: HorizontalAlign | undefined;
20
+ alignmentY?: VerticalAlign | undefined;
21
+ }, {
22
+ text: string | number;
23
+ alignmentX?: HorizontalAlign | undefined;
24
+ alignmentY?: VerticalAlign | undefined;
25
+ }>]>;
26
+ /** the boundary width to draw in */
27
+ maxWidth: z.ZodOptional<z.ZodNumber>;
28
+ /** the boundary height to draw in */
29
+ maxHeight: z.ZodOptional<z.ZodNumber>;
30
+ /** a callback for when complete that ahs the end co-ordinates of the text */
31
+ cb: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
32
+ x: z.ZodNumber;
33
+ y: z.ZodNumber;
34
+ }, "strip", z.ZodTypeAny, {
35
+ x: number;
36
+ y: number;
37
+ }, {
38
+ x: number;
39
+ y: number;
40
+ }>], null>, z.ZodUnknown>>;
41
+ }, "strip", z.ZodTypeAny, {
42
+ x: number;
43
+ y: number;
44
+ text: string | number | {
45
+ text: string | number;
46
+ alignmentX?: HorizontalAlign | undefined;
47
+ alignmentY?: VerticalAlign | undefined;
48
+ };
49
+ maxWidth?: number | undefined;
50
+ maxHeight?: number | undefined;
51
+ cb?: ((args_0: {
52
+ x: number;
53
+ y: number;
54
+ }) => unknown) | undefined;
55
+ }, {
56
+ x: number;
57
+ y: number;
58
+ text: string | number | {
59
+ text: string | number;
60
+ alignmentX?: HorizontalAlign | undefined;
61
+ alignmentY?: VerticalAlign | undefined;
62
+ };
63
+ maxWidth?: number | undefined;
64
+ maxHeight?: number | undefined;
65
+ cb?: ((args_0: {
66
+ x: number;
67
+ y: number;
68
+ }) => unknown) | undefined;
69
+ }>;
70
+ export type PrintOptions = z.infer<typeof PrintOptionsSchema>;
71
+ export declare const methods: {
72
+ /**
73
+ * Draws a text on a image on a given boundary
74
+ * @param font a bitmap font loaded from `Jimp.loadFont` command
75
+ * @param x the x position to start drawing the text
76
+ * @param y the y position to start drawing the text
77
+ * @param text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
78
+ * @example
79
+ * ```ts
80
+ * import { Jimp } from "jimp";
81
+ *
82
+ * const image = await Jimp.read("test/image.png");
83
+ * const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
84
+ *
85
+ * image.print({ font, x: 10, y: 10, text: "Hello world!" });
86
+ * ```
87
+ */
88
+ print<I extends JimpClass>(image: I, { font, ...options }: PrintOptions & {
89
+ /** the BMFont instance */
90
+ font: BmFont<I>;
91
+ }): I;
92
+ };
93
+ //# sourceMappingURL=index.d.ts.map
node_modules/@jimp/plugin-print/dist/esm/index.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAe,MAAM,EAAE,MAAM,YAAY,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,cAAc,YAAY,CAAC;AAE3B,QAAA,MAAM,kBAAkB;IACtB,uCAAuC;;IAEvC,uCAAuC;;IAEvC,wBAAwB;;;;;;;;;;;;;;IASxB,oCAAoC;;IAEpC,qCAAqC;;IAErC,6EAA6E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI7E,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAmF9D,eAAO,MAAM,OAAO;IAClB;;;;;;;;;;;;;;;OAeG;UACG,CAAC,SAAS,SAAS,SAChB,CAAC,wBAIL,YAAY,GAAG;QAChB,0BAA0B;QAC1B,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;KACjB;CA4EJ,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/index.js ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { HorizontalAlign, VerticalAlign } from "@jimp/core";
2
+ import { methods as blitMethods } from "@jimp/plugin-blit";
3
+ import { z } from "zod";
4
+ import { measureText, measureTextHeight, splitLines } from "./measure-text.js";
5
+ export { measureText, measureTextHeight } from "./measure-text.js";
6
+ export * from "./types.js";
7
+ const PrintOptionsSchema = z.object({
8
+ /** the x position to draw the image */
9
+ x: z.number(),
10
+ /** the y position to draw the image */
11
+ y: z.number(),
12
+ /** the text to print */
13
+ text: z.union([
14
+ z.union([z.string(), z.number()]),
15
+ z.object({
16
+ text: z.union([z.string(), z.number()]),
17
+ alignmentX: z.nativeEnum(HorizontalAlign).optional(),
18
+ alignmentY: z.nativeEnum(VerticalAlign).optional(),
19
+ }),
20
+ ]),
21
+ /** the boundary width to draw in */
22
+ maxWidth: z.number().optional(),
23
+ /** the boundary height to draw in */
24
+ maxHeight: z.number().optional(),
25
+ /** a callback for when complete that ahs the end co-ordinates of the text */
26
+ cb: z
27
+ .function(z.tuple([z.object({ x: z.number(), y: z.number() })]))
28
+ .optional(),
29
+ });
30
+ function xOffsetBasedOnAlignment(font, line, maxWidth, alignment) {
31
+ if (alignment === HorizontalAlign.LEFT) {
32
+ return 0;
33
+ }
34
+ if (alignment === HorizontalAlign.CENTER) {
35
+ return (maxWidth - measureText(font, line)) / 2;
36
+ }
37
+ return maxWidth - measureText(font, line);
38
+ }
39
+ function drawCharacter(image, font, x, y, char) {
40
+ if (char.width > 0 && char.height > 0) {
41
+ const characterPage = font.pages[char.page];
42
+ if (characterPage) {
43
+ image = blitMethods.blit(image, {
44
+ src: characterPage,
45
+ x: x + char.xoffset,
46
+ y: y + char.yoffset,
47
+ srcX: char.x,
48
+ srcY: char.y,
49
+ srcW: char.width,
50
+ srcH: char.height,
51
+ });
52
+ }
53
+ }
54
+ return image;
55
+ }
56
+ function printText(image, font, x, y, text, defaultCharWidth) {
57
+ for (let i = 0; i < text.length; i++) {
58
+ const stringChar = text[i];
59
+ let char;
60
+ if (font.chars[stringChar]) {
61
+ char = stringChar;
62
+ }
63
+ else if (/\s/.test(stringChar)) {
64
+ char = "";
65
+ }
66
+ else {
67
+ char = "?";
68
+ }
69
+ const fontChar = font.chars[char] || { xadvance: undefined };
70
+ const fontKerning = font.kernings[char];
71
+ if (fontChar) {
72
+ drawCharacter(image, font, x, y, fontChar);
73
+ }
74
+ const nextChar = text[i + 1];
75
+ const kerning = fontKerning && nextChar && fontKerning[nextChar]
76
+ ? fontKerning[nextChar] || 0
77
+ : 0;
78
+ x += kerning + (fontChar.xadvance || defaultCharWidth);
79
+ }
80
+ }
81
+ export const methods = {
82
+ /**
83
+ * Draws a text on a image on a given boundary
84
+ * @param font a bitmap font loaded from `Jimp.loadFont` command
85
+ * @param x the x position to start drawing the text
86
+ * @param y the y position to start drawing the text
87
+ * @param text the text to draw (string or object with `text`, `alignmentX`, and/or `alignmentY`)
88
+ * @example
89
+ * ```ts
90
+ * import { Jimp } from "jimp";
91
+ *
92
+ * const image = await Jimp.read("test/image.png");
93
+ * const font = await Jimp.loadFont(Jimp.FONT_SANS_32_BLACK);
94
+ *
95
+ * image.print({ font, x: 10, y: 10, text: "Hello world!" });
96
+ * ```
97
+ */
98
+ print(image, { font, ...options }) {
99
+ let {
100
+ // eslint-disable-next-line prefer-const
101
+ x, y, text,
102
+ // eslint-disable-next-line prefer-const
103
+ maxWidth = Infinity,
104
+ // eslint-disable-next-line prefer-const
105
+ maxHeight = Infinity,
106
+ // eslint-disable-next-line prefer-const
107
+ cb = () => { }, } = PrintOptionsSchema.parse(options);
108
+ let alignmentX;
109
+ let alignmentY;
110
+ if (typeof text === "object" &&
111
+ text.text !== null &&
112
+ text.text !== undefined) {
113
+ alignmentX = text.alignmentX || HorizontalAlign.LEFT;
114
+ alignmentY = text.alignmentY || VerticalAlign.TOP;
115
+ ({ text } = text);
116
+ }
117
+ else {
118
+ alignmentX = HorizontalAlign.LEFT;
119
+ alignmentY = VerticalAlign.TOP;
120
+ text = text.toString();
121
+ }
122
+ if (typeof text === "number") {
123
+ text = text.toString();
124
+ }
125
+ if (maxHeight !== Infinity && alignmentY === VerticalAlign.BOTTOM) {
126
+ y += maxHeight - measureTextHeight(font, text, maxWidth);
127
+ }
128
+ else if (maxHeight !== Infinity && alignmentY === VerticalAlign.MIDDLE) {
129
+ y += maxHeight / 2 - measureTextHeight(font, text, maxWidth) / 2;
130
+ }
131
+ const defaultCharWidth = Object.entries(font.chars).find((c) => c[1].xadvance)?.[1].xadvance;
132
+ if (typeof defaultCharWidth !== "number") {
133
+ throw new Error("Could not find default character width");
134
+ }
135
+ const { lines, longestLine } = splitLines(font, text, maxWidth);
136
+ lines.forEach((line) => {
137
+ const lineString = line.join(" ");
138
+ const alignmentWidth = xOffsetBasedOnAlignment(font, lineString, maxWidth, alignmentX);
139
+ printText(image, font, x + alignmentWidth, y, lineString, defaultCharWidth);
140
+ y += font.common.lineHeight;
141
+ });
142
+ cb.bind(image)({ x: x + longestLine, y });
143
+ return image;
144
+ },
145
+ };
146
+ //# sourceMappingURL=index.js.map
node_modules/@jimp/plugin-print/dist/esm/index.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE5D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/E,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAA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hB,IAAI,OAAO,gBAAgB,KAAK,QAAQ,EAAE,CAAC;YACzC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;QAC5D,CAAC;QAED,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QAEhE,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClC,MAAM,cAAc,GAAG,uBAAuB,CAC5C,IAAI,EACJ,UAAU,EACV,QAAQ,EACR,UAAU,CACX,CAAC;YAEF,SAAS,CACP,KAAK,EACL,IAAI,EACJ,CAAC,GAAG,cAAc,EAClB,CAAC,EACD,UAAU,EACV,gBAAgB,CACjB,CAAC;YACF,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QAC9B,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,WAAW,EAAE,CAAC,EAAE,CAAC,CAAC;QAE1C,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC"}
node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.d.ts ADDED
@@ -0,0 +1,134 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { BmCharacter, BmKerning, BmFont, BmCommonProps } from "./types.js";
2
+ export declare const isWebWorker: boolean;
3
+ export interface LoadedFont {
4
+ chars: BmCharacter[];
5
+ kernings: BmKerning[];
6
+ common: BmCommonProps;
7
+ info: Record<string, any>;
8
+ pages: string[];
9
+ }
10
+ /**
11
+ *
12
+ * @param bufferOrUrl A URL to a file or a buffer
13
+ * @returns
14
+ */
15
+ export declare function loadBitmapFontData(bufferOrUrl: string | Buffer): Promise<LoadedFont>;
16
+ type RawFont = Awaited<ReturnType<typeof loadBitmapFontData>>;
17
+ export type ResolveBmFont = Omit<BmFont, "pages"> & Pick<RawFont, "pages">;
18
+ export declare function processBitmapFont(file: string, font: LoadedFont): Promise<{
19
+ chars: Record<string, BmCharacter>;
20
+ kernings: Record<string, BmKerning>;
21
+ pages: ({
22
+ bitmap: import("@jimp/types").Bitmap;
23
+ background: number;
24
+ formats: import("@jimp/types").Format<any>[];
25
+ mime?: string;
26
+ inspect(): string;
27
+ toString(): string;
28
+ readonly width: number;
29
+ readonly height: number;
30
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
31
+ filterType?: import("@jimp/js-png").PNGFilterType;
32
+ colorType?: import("@jimp/js-png").PNGColorType;
33
+ inputColorType?: import("@jimp/js-png").PNGColorType;
34
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
35
+ filterType?: import("@jimp/js-png").PNGFilterType;
36
+ colorType?: import("@jimp/js-png").PNGColorType;
37
+ inputColorType?: import("@jimp/js-png").PNGColorType;
38
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
39
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
40
+ filterType?: import("@jimp/js-png").PNGFilterType;
41
+ colorType?: import("@jimp/js-png").PNGColorType;
42
+ inputColorType?: import("@jimp/js-png").PNGColorType;
43
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
44
+ filterType?: import("@jimp/js-png").PNGFilterType;
45
+ colorType?: import("@jimp/js-png").PNGColorType;
46
+ inputColorType?: import("@jimp/js-png").PNGColorType;
47
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
48
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
49
+ filterType?: import("@jimp/js-png").PNGFilterType;
50
+ colorType?: import("@jimp/js-png").PNGColorType;
51
+ inputColorType?: import("@jimp/js-png").PNGColorType;
52
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
53
+ filterType?: import("@jimp/js-png").PNGFilterType;
54
+ colorType?: import("@jimp/js-png").PNGColorType;
55
+ inputColorType?: import("@jimp/js-png").PNGColorType;
56
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
57
+ clone<S extends unknown>(this: S): S;
58
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
59
+ getPixelColor(x: number, y: number): number;
60
+ setPixelColor(hex: number, x: number, y: number): any;
61
+ hasAlpha(): boolean;
62
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
63
+ mode?: import("@jimp/core").BlendMode;
64
+ opacitySource?: number;
65
+ opacityDest?: number;
66
+ }): any;
67
+ scan(f: (x: number, y: number, idx: number) => any): any;
68
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
69
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
70
+ x: number;
71
+ y: number;
72
+ idx: number;
73
+ image: any;
74
+ }, void, unknown>;
75
+ } & import("@jimp/core").JimpInstanceMethods<{
76
+ bitmap: import("@jimp/types").Bitmap;
77
+ background: number;
78
+ formats: import("@jimp/types").Format<any>[];
79
+ mime?: string;
80
+ inspect(): string;
81
+ toString(): string;
82
+ readonly width: number;
83
+ readonly height: number;
84
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
85
+ filterType?: import("@jimp/js-png").PNGFilterType;
86
+ colorType?: import("@jimp/js-png").PNGColorType;
87
+ inputColorType?: import("@jimp/js-png").PNGColorType;
88
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
89
+ filterType?: import("@jimp/js-png").PNGFilterType;
90
+ colorType?: import("@jimp/js-png").PNGColorType;
91
+ inputColorType?: import("@jimp/js-png").PNGColorType;
92
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
93
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
94
+ filterType?: import("@jimp/js-png").PNGFilterType;
95
+ colorType?: import("@jimp/js-png").PNGColorType;
96
+ inputColorType?: import("@jimp/js-png").PNGColorType;
97
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
98
+ filterType?: import("@jimp/js-png").PNGFilterType;
99
+ colorType?: import("@jimp/js-png").PNGColorType;
100
+ inputColorType?: import("@jimp/js-png").PNGColorType;
101
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
102
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
103
+ filterType?: import("@jimp/js-png").PNGFilterType;
104
+ colorType?: import("@jimp/js-png").PNGColorType;
105
+ inputColorType?: import("@jimp/js-png").PNGColorType;
106
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
107
+ filterType?: import("@jimp/js-png").PNGFilterType;
108
+ colorType?: import("@jimp/js-png").PNGColorType;
109
+ inputColorType?: import("@jimp/js-png").PNGColorType;
110
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
111
+ clone<S extends unknown>(this: S): S;
112
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
113
+ getPixelColor(x: number, y: number): number;
114
+ setPixelColor(hex: number, x: number, y: number): any;
115
+ hasAlpha(): boolean;
116
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
117
+ mode?: import("@jimp/core").BlendMode;
118
+ opacitySource?: number;
119
+ opacityDest?: number;
120
+ }): any;
121
+ scan(f: (x: number, y: number, idx: number) => any): any;
122
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
123
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
124
+ x: number;
125
+ y: number;
126
+ idx: number;
127
+ image: any;
128
+ }, void, unknown>;
129
+ }, import("@jimp/core").JimpPlugin>)[];
130
+ common: BmCommonProps;
131
+ info: Record<string, any>;
132
+ }>;
133
+ export {};
134
+ //# sourceMappingURL=load-bitmap-font.d.ts.map
node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import parseASCII from "parse-bmfont-ascii";
2
+ import parseXML from "parse-bmfont-xml";
3
+ import readBinary from "parse-bmfont-binary";
4
+ import png from "@jimp/js-png";
5
+ import { createJimp } from "@jimp/core";
6
+ import path from "path";
7
+ import xmlPackage from "simple-xml-to-json";
8
+ const { convertXML } = xmlPackage;
9
+ export const isWebWorker = typeof self !== "undefined" && self.document === undefined;
10
+ const CharacterJimp = createJimp({ formats: [png] });
11
+ const HEADER = Buffer.from([66, 77, 70, 3]);
12
+ function isBinary(buf) {
13
+ if (typeof buf === "string") {
14
+ return buf.substring(0, 3) === "BMF";
15
+ }
16
+ const startOfHeader = buf.slice(0, 4);
17
+ return (buf.length > 4 &&
18
+ startOfHeader[0] === HEADER[0] &&
19
+ startOfHeader[1] === HEADER[1] &&
20
+ startOfHeader[2] === HEADER[2]);
21
+ }
22
+ function parseFont(file, data) {
23
+ if (isBinary(data)) {
24
+ if (typeof data === "string") {
25
+ data = Buffer.from(data, "binary");
26
+ }
27
+ return readBinary(data);
28
+ }
29
+ data = data.toString().trim();
30
+ if (/.json$/.test(file) || data.charAt(0) === "{") {
31
+ return JSON.parse(data);
32
+ }
33
+ if (/.xml$/.test(file) || data.charAt(0) === "<") {
34
+ return parseXML(data);
35
+ }
36
+ return parseASCII(data);
37
+ }
38
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
+ function parseNumbersInObject(obj) {
40
+ for (const key in obj) {
41
+ try {
42
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
+ obj[key] = parseInt(obj[key], 10);
44
+ }
45
+ catch {
46
+ // do nothing
47
+ }
48
+ if (typeof obj[key] === "object") {
49
+ parseNumbersInObject(obj[key]);
50
+ }
51
+ }
52
+ return obj;
53
+ }
54
+ /**
55
+ *
56
+ * @param bufferOrUrl A URL to a file or a buffer
57
+ * @returns
58
+ */
59
+ export async function loadBitmapFontData(bufferOrUrl) {
60
+ if (isWebWorker && typeof bufferOrUrl === "string") {
61
+ const res = await fetch(bufferOrUrl);
62
+ const text = await res.text();
63
+ const json = convertXML(text);
64
+ const font = json.font.children.reduce(
65
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
66
+ (acc, i) => ({ ...acc, ...i }), {});
67
+ const pages = [];
68
+ const chars = [];
69
+ const kernings = [];
70
+ for (let i = 0; i < font.pages.children.length; i++) {
71
+ const p = font.pages.children[i].page;
72
+ const id = parseInt(p.id, 10);
73
+ pages[id] = parseNumbersInObject(p.file);
74
+ }
75
+ for (let i = 0; i < font.chars.children.length; i++) {
76
+ chars.push(parseNumbersInObject(font.chars.children[i].char));
77
+ }
78
+ for (let i = 0; i < font.kernings.children.length; i++) {
79
+ kernings.push(parseNumbersInObject(font.kernings.children[i].kerning));
80
+ }
81
+ return {
82
+ info: font.info,
83
+ common: font.common,
84
+ pages,
85
+ chars,
86
+ kernings,
87
+ };
88
+ }
89
+ else if (typeof bufferOrUrl === "string") {
90
+ const res = await fetch(bufferOrUrl);
91
+ const text = await res.text();
92
+ return parseFont(bufferOrUrl, text);
93
+ }
94
+ else {
95
+ return parseFont("", bufferOrUrl);
96
+ }
97
+ }
98
+ export async function processBitmapFont(file, font) {
99
+ const chars = {};
100
+ const kernings = {};
101
+ for (let i = 0; i < font.chars.length; i++) {
102
+ const char = font.chars[i];
103
+ chars[String.fromCharCode(char.id)] = char;
104
+ }
105
+ for (let i = 0; i < font.kernings.length; i++) {
106
+ const firstString = String.fromCharCode(font.kernings[i].first);
107
+ kernings[firstString] = kernings[firstString] || {};
108
+ kernings[firstString][String.fromCharCode(font.kernings[i].second)] =
109
+ font.kernings[i].amount;
110
+ }
111
+ return {
112
+ ...font,
113
+ chars,
114
+ kernings,
115
+ pages: await Promise.all(font.pages.map(async (page) => CharacterJimp.read(path.join(path.dirname(file), page)))),
116
+ };
117
+ }
118
+ //# sourceMappingURL=load-bitmap-font.js.map
node_modules/@jimp/plugin-print/dist/esm/load-bitmap-font.js.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-bitmap-font.js","sourceRoot":"","sources":["../../src/load-bitmap-font.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,QAAQ,MAAM,kBAAkB,CAAC;AACxC,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAE7C,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAE5C,MAAM,EAAE,UAAU,EAAE,GAAG,UAAU,CAAC;AAElC,MAAM,CAAC,MAAM,WAAW,GACtB,OAAO,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,QAAQ,KAAK,SAAS,CAAC;AAE7D,MAAM,aAAa,GAAG,UAAU,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACrD,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;AAE5C,SAAS,QAAQ,CAAC,GAAoB;IACpC,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,KAAK,CAAC;IACvC,CAAC;IAED,MAAM,aAAa,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEtC,OAAO,CACL,GAAG,CAAC,MAAM,GAAG,CAAC;QACd,aAAa,CAAC,CA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 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Loads a Bitmap Font from a file.
3
+ * @param file A path or URL to a font file
4
+ * @returns A collection of Jimp images that can be used to print text
5
+ * @example
6
+ * ```ts
7
+ * import { Jimp, loadFont } from "jimp";
8
+ * import { SANS_10_BLACK } from "jimp/fonts";
9
+ *
10
+ * const font = await loadFont(SANS_10_BLACK);
11
+ * const image = new Jimp({ width: 200, height: 100, color: 0xffffffff });
12
+ *
13
+ * image.print(font, 10, 10, "Hello world!");
14
+ * ```
15
+ */
16
+ export declare function loadFont(file: string): Promise<{
17
+ chars: Record<string, import("./types.js").BmCharacter>;
18
+ kernings: Record<string, import("./types.js").BmKerning>;
19
+ pages: ({
20
+ bitmap: import("@jimp/types").Bitmap;
21
+ background: number;
22
+ formats: import("@jimp/types").Format<any>[];
23
+ mime?: string;
24
+ inspect(): string;
25
+ toString(): string;
26
+ readonly width: number;
27
+ readonly height: number;
28
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
29
+ filterType?: import("@jimp/js-png").PNGFilterType;
30
+ colorType?: import("@jimp/js-png").PNGColorType;
31
+ inputColorType?: import("@jimp/js-png").PNGColorType;
32
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
33
+ filterType?: import("@jimp/js-png").PNGFilterType;
34
+ colorType?: import("@jimp/js-png").PNGColorType;
35
+ inputColorType?: import("@jimp/js-png").PNGColorType;
36
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
37
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
38
+ filterType?: import("@jimp/js-png").PNGFilterType;
39
+ colorType?: import("@jimp/js-png").PNGColorType;
40
+ inputColorType?: import("@jimp/js-png").PNGColorType;
41
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
42
+ filterType?: import("@jimp/js-png").PNGFilterType;
43
+ colorType?: import("@jimp/js-png").PNGColorType;
44
+ inputColorType?: import("@jimp/js-png").PNGColorType;
45
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
46
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
47
+ filterType?: import("@jimp/js-png").PNGFilterType;
48
+ colorType?: import("@jimp/js-png").PNGColorType;
49
+ inputColorType?: import("@jimp/js-png").PNGColorType;
50
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
51
+ filterType?: import("@jimp/js-png").PNGFilterType;
52
+ colorType?: import("@jimp/js-png").PNGColorType;
53
+ inputColorType?: import("@jimp/js-png").PNGColorType;
54
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
55
+ clone<S extends unknown>(this: S): S;
56
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
57
+ getPixelColor(x: number, y: number): number;
58
+ setPixelColor(hex: number, x: number, y: number): any;
59
+ hasAlpha(): boolean;
60
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
61
+ mode?: import("@jimp/core").BlendMode;
62
+ opacitySource?: number;
63
+ opacityDest?: number;
64
+ }): any;
65
+ scan(f: (x: number, y: number, idx: number) => any): any;
66
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
67
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
68
+ x: number;
69
+ y: number;
70
+ idx: number;
71
+ image: any;
72
+ }, void, unknown>;
73
+ } & import("@jimp/core").JimpInstanceMethods<{
74
+ bitmap: import("@jimp/types").Bitmap;
75
+ background: number;
76
+ formats: import("@jimp/types").Format<any>[];
77
+ mime?: string;
78
+ inspect(): string;
79
+ toString(): string;
80
+ readonly width: number;
81
+ readonly height: number;
82
+ getBuffer<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
83
+ filterType?: import("@jimp/js-png").PNGFilterType;
84
+ colorType?: import("@jimp/js-png").PNGColorType;
85
+ inputColorType?: import("@jimp/js-png").PNGColorType;
86
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
87
+ filterType?: import("@jimp/js-png").PNGFilterType;
88
+ colorType?: import("@jimp/js-png").PNGColorType;
89
+ inputColorType?: import("@jimp/js-png").PNGColorType;
90
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<Buffer>;
91
+ getBase64<ProvidedMimeType extends "image/png", Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
92
+ filterType?: import("@jimp/js-png").PNGFilterType;
93
+ colorType?: import("@jimp/js-png").PNGColorType;
94
+ inputColorType?: import("@jimp/js-png").PNGColorType;
95
+ }> extends infer T ? T extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
96
+ filterType?: import("@jimp/js-png").PNGFilterType;
97
+ colorType?: import("@jimp/js-png").PNGColorType;
98
+ inputColorType?: import("@jimp/js-png").PNGColorType;
99
+ }> ? T extends Record<ProvidedMimeType, infer O> ? O : never : never : never>(mime: ProvidedMimeType, options?: Options | undefined): Promise<string>;
100
+ write<Extension extends string, Mime extends Record<"png", "image/png"> extends infer T ? T extends Record<"png", "image/png"> ? T extends Record<Extension, infer M> ? M : never : never : never, Options extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
101
+ filterType?: import("@jimp/js-png").PNGFilterType;
102
+ colorType?: import("@jimp/js-png").PNGColorType;
103
+ inputColorType?: import("@jimp/js-png").PNGColorType;
104
+ }> extends infer T_1 ? T_1 extends Record<"image/png", Omit<import("@jimp/js-png").PNGJSOptions, "filterType" | "colorType" | "inputColorType"> & {
105
+ filterType?: import("@jimp/js-png").PNGFilterType;
106
+ colorType?: import("@jimp/js-png").PNGColorType;
107
+ inputColorType?: import("@jimp/js-png").PNGColorType;
108
+ }> ? T_1 extends Record<Mime, infer O> ? O : never : never : never>(path: `${string}.${Extension}`, options?: Options | undefined): Promise<void>;
109
+ clone<S extends unknown>(this: S): S;
110
+ getPixelIndex(x: number, y: number, edgeHandling?: import("@jimp/types").Edge): number;
111
+ getPixelColor(x: number, y: number): number;
112
+ setPixelColor(hex: number, x: number, y: number): any;
113
+ hasAlpha(): boolean;
114
+ composite<I extends unknown>(src: I, x?: number, y?: number, options?: {
115
+ mode?: import("@jimp/core").BlendMode;
116
+ opacitySource?: number;
117
+ opacityDest?: number;
118
+ }): any;
119
+ scan(f: (x: number, y: number, idx: number) => any): any;
120
+ scan(x: number, y: number, w: number, h: number, cb: (x: number, y: number, idx: number) => any): any;
121
+ scanIterator(x?: number, y?: number, w?: number, h?: number): Generator<{
122
+ x: number;
123
+ y: number;
124
+ idx: number;
125
+ image: any;
126
+ }, void, unknown>;
127
+ }, import("@jimp/core").JimpPlugin>)[];
128
+ common: import("./types.js").BmCommonProps;
129
+ info: Record<string, any>;
130
+ }>;
131
+ //# sourceMappingURL=load-font.d.ts.map
node_modules/@jimp/plugin-print/dist/esm/load-font.d.ts.map ADDED
@@ -0,0 +1 @@
 
 
1
+ {"version":3,"file":"load-font.d.ts","sourceRoot":"","sources":["../../src/load-font.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,QAAQ,CAAC,IAAI,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAcq/kB,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAAo3R,CAAC;yBAAsC,CAAC;uBAAiC,CAAC;;;;;;;;;;;;;GADvi3B"}
node_modules/@jimp/plugin-print/dist/esm/load-font.js ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { isWebWorker, loadBitmapFontData, processBitmapFont, } from "./load-bitmap-font.js";
2
+ /**
3
+ * Loads a Bitmap Font from a file.
4
+ * @param file A path or URL to a font file
5
+ * @returns A collection of Jimp images that can be used to print text
6
+ * @example
7
+ * ```ts
8
+ * import { Jimp, loadFont } from "jimp";
9
+ * import { SANS_10_BLACK } from "jimp/fonts";
10
+ *
11
+ * const font = await loadFont(SANS_10_BLACK);
12
+ * const image = new Jimp({ width: 200, height: 100, color: 0xffffffff });
13
+ *
14
+ * image.print(font, 10, 10, "Hello world!");
15
+ * ```
16
+ */
17
+ export async function loadFont(file) {
18
+ let fileOrBuffer = file;
19
+ if (typeof window === "undefined" && !isWebWorker) {
20
+ const { existsSync, promises: fs } = await import("fs");
21
+ if (existsSync(file)) {
22
+ fileOrBuffer = await fs.readFile(file);
23
+ }
24
+ }
25
+ const data = await loadBitmapFontData(fileOrBuffer);
26
+ return processBitmapFont(file, data);
27
+ }
28
+ //# sourceMappingURL=load-font.js.map