MCPcopy
hub / github.com/jimp-dev/jimp / parseFont

Function parseFont

plugins/plugin-print/src/load-bitmap-font.ts:42–62  ·  view source on GitHub ↗
(file: string, data: Buffer | string)

Source from the content-addressed store, hash-verified

40}
41
42function parseFont(file: string, data: Buffer | string): LoadedFont {
43 if (isBinary(data)) {
44 if (typeof data === "string") {
45 data = Buffer.from(data, "binary");
46 }
47
48 return readBinary(data);
49 }
50
51 data = data.toString().trim();
52
53 if (/.json$/.test(file) || data.charAt(0) === "{") {
54 return JSON.parse(data);
55 }
56
57 if (/.xml$/.test(file) || data.charAt(0) === "<") {
58 return parseXML(data);
59 }
60
61 return parseASCII(data);
62}
63
64// eslint-disable-next-line @typescript-eslint/no-explicit-any
65function parseNumbersInObject<T extends Record<string, any>>(obj: T) {

Callers 1

loadBitmapFontDataFunction · 0.85

Calls 2

isBinaryFunction · 0.85
toStringMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…