@pixldocs/canvas-renderer 0.5.157 → 0.5.158

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,47 +1,8 @@
1
1
  "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") {
10
- for (let key of __getOwnPropNames(from))
11
- if (!__hasOwnProp.call(to, key) && key !== except)
12
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
- }
14
- return to;
15
- };
16
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
- // If the importer is in node compatibility mode or this is not an ESM
18
- // file that has been converted to a CommonJS file using a Babel-
19
- // compatible transform (i.e. "__esModule" has not been set), then set
20
- // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
22
- mod
23
- ));
24
- const opentype = require("opentype.js");
25
- function _interopNamespaceDefault(e) {
26
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
27
- if (e) {
28
- for (const k in e) {
29
- if (k !== "default") {
30
- const d = Object.getOwnPropertyDescriptor(e, k);
31
- Object.defineProperty(n, k, d.get ? d : {
32
- enumerable: true,
33
- get: () => e[k]
34
- });
35
- }
36
- }
37
- }
38
- n.default = e;
39
- return Object.freeze(n);
40
- }
41
- const opentype__namespace = /* @__PURE__ */ _interopNamespaceDefault(opentype);
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
42
3
  const __vite_import_meta_env__ = { "BASE_URL": "/", "DEV": false, "MODE": "production", "PROD": true, "SSR": false };
43
- const fontCache$1 = /* @__PURE__ */ new Map();
44
- const fontBytesCache$1 = /* @__PURE__ */ new Map();
4
+ const fontCache = /* @__PURE__ */ new Map();
5
+ const fontBytesCache = /* @__PURE__ */ new Map();
45
6
  const googleFontUrlCache = /* @__PURE__ */ new Map();
46
7
  const googleFontNotFound = /* @__PURE__ */ new Set();
47
8
  const proxyNotFound = /* @__PURE__ */ new Set();
@@ -840,7 +801,7 @@ const embedFont = async (pdf, fontName, weight = 400, isItalic = false) => {
840
801
  const cacheKey = `${fontName}-${resolvedWeight}${isItalic ? "-italic" : ""}`;
841
802
  const jsPdfFontName = getEmbeddedJsPDFFontName(fontName, weight, isItalic);
842
803
  try {
843
- let base64Font = fontCache$1.get(cacheKey);
804
+ let base64Font = fontCache.get(cacheKey);
844
805
  if (!base64Font) {
845
806
  const response = await fetch(fontPath);
846
807
  if (!response.ok) throw new Error(`Failed to fetch font: ${response.statusText}`);
@@ -851,7 +812,7 @@ const embedFont = async (pdf, fontName, weight = 400, isItalic = false) => {
851
812
  let binary = "";
852
813
  for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
853
814
  base64Font = btoa(binary);
854
- fontCache$1.set(cacheKey, base64Font);
815
+ fontCache.set(cacheKey, base64Font);
855
816
  } else if (!registeredVariantCoverage.has(variantKey(fontName, resolvedWeight, isItalic))) {
856
817
  registeredVariantCoverage.set(variantKey(fontName, resolvedWeight, isItalic), extractSupportedCodePointsFromTtf(base64ToBytes(base64Font)));
857
818
  }
@@ -877,16 +838,16 @@ const isFontAvailable = (fontName) => {
877
838
  };
878
839
  async function fetchGoogleFontTTF(fontFamily, weight = 400, isItalic = false) {
879
840
  const cacheKey = `gf:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
880
- if (fontCache$1.has(cacheKey)) return fontCache$1.get(cacheKey);
841
+ if (fontCache.has(cacheKey)) return fontCache.get(cacheKey);
881
842
  const notFoundKey = remoteVariantKey(fontFamily, weight, isItalic);
882
843
  if (googleFontNotFound.has(notFoundKey)) return null;
883
844
  const proxyBytes = await fetchTtfViaProxy(fontFamily, weight, isItalic, "google");
884
845
  if (proxyBytes && isJsPdfEmbeddableTrueType(proxyBytes)) {
885
- fontBytesCache$1.set(cacheKey, proxyBytes);
846
+ fontBytesCache.set(cacheKey, proxyBytes);
886
847
  let binary = "";
887
848
  for (let i = 0; i < proxyBytes.length; i++) binary += String.fromCharCode(proxyBytes[i]);
888
849
  const b64 = btoa(binary);
889
- fontCache$1.set(cacheKey, b64);
850
+ fontCache.set(cacheKey, b64);
890
851
  return b64;
891
852
  }
892
853
  if (resolveFontProxyUrl()) return null;
@@ -917,11 +878,11 @@ async function fetchGoogleFontTTF(fontFamily, weight = 400, isItalic = false) {
917
878
  console.warn(`[pdfFonts] Google Fonts returned a non-TTF font for ${fontFamily} (${weight}); skipping jsPDF embed`);
918
879
  return null;
919
880
  }
920
- fontBytesCache$1.set(cacheKey, bytes);
881
+ fontBytesCache.set(cacheKey, bytes);
921
882
  let binary = "";
922
883
  for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
923
884
  const b64 = btoa(binary);
924
- fontCache$1.set(cacheKey, b64);
885
+ fontCache.set(cacheKey, b64);
925
886
  return b64;
926
887
  } catch (err) {
927
888
  console.warn(`[pdfFonts] fetchGoogleFontTTF failed for ${fontFamily} (${weight}):`, err);
@@ -930,9 +891,9 @@ async function fetchGoogleFontTTF(fontFamily, weight = 400, isItalic = false) {
930
891
  }
931
892
  async function getGoogleFontBytes(fontFamily, weight = 400, isItalic = false) {
932
893
  const cacheKey = `gf:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
933
- if (fontBytesCache$1.has(cacheKey)) return fontBytesCache$1.get(cacheKey);
894
+ if (fontBytesCache.has(cacheKey)) return fontBytesCache.get(cacheKey);
934
895
  await fetchGoogleFontTTF(fontFamily, weight, isItalic);
935
- return fontBytesCache$1.get(cacheKey) || null;
896
+ return fontBytesCache.get(cacheKey) || null;
936
897
  }
937
898
  const fontshareNotFound = /* @__PURE__ */ new Set();
938
899
  function toFontshareSlug(family) {
@@ -940,16 +901,16 @@ function toFontshareSlug(family) {
940
901
  }
941
902
  async function fetchFontshareTTF(fontFamily, weight = 400, isItalic = false, slug) {
942
903
  const cacheKey = `gf:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
943
- if (fontCache$1.has(cacheKey)) return fontCache$1.get(cacheKey);
904
+ if (fontCache.has(cacheKey)) return fontCache.get(cacheKey);
944
905
  const notFoundKey = remoteVariantKey(fontFamily, weight, isItalic);
945
906
  if (fontshareNotFound.has(notFoundKey)) return null;
946
907
  const proxyBytes = await fetchTtfViaProxy(fontFamily, weight, isItalic, "fontshare");
947
908
  if (proxyBytes && isJsPdfEmbeddableTrueType(proxyBytes)) {
948
- fontBytesCache$1.set(cacheKey, proxyBytes);
909
+ fontBytesCache.set(cacheKey, proxyBytes);
949
910
  let binary = "";
950
911
  for (let i = 0; i < proxyBytes.length; i++) binary += String.fromCharCode(proxyBytes[i]);
951
912
  const b64 = btoa(binary);
952
- fontCache$1.set(cacheKey, b64);
913
+ fontCache.set(cacheKey, b64);
953
914
  return b64;
954
915
  }
955
916
  if (resolveFontProxyUrl()) return null;
@@ -978,11 +939,11 @@ async function fetchFontshareTTF(fontFamily, weight = 400, isItalic = false, slu
978
939
  console.warn(`[pdfFonts] Fontshare returned a non-TTF font for ${fontFamily} (${weight}); skipping jsPDF embed`);
979
940
  return null;
980
941
  }
981
- fontBytesCache$1.set(cacheKey, bytes);
942
+ fontBytesCache.set(cacheKey, bytes);
982
943
  let binary = "";
983
944
  for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
984
945
  const b64 = btoa(binary);
985
- fontCache$1.set(cacheKey, b64);
946
+ fontCache.set(cacheKey, b64);
986
947
  return b64;
987
948
  } catch (err) {
988
949
  console.warn(`[pdfFonts] fetchFontshareTTF failed for ${fontFamily} (${weight}):`, err);
@@ -991,9 +952,9 @@ async function fetchFontshareTTF(fontFamily, weight = 400, isItalic = false, slu
991
952
  }
992
953
  async function getFontshareFontBytes(fontFamily, weight = 400, isItalic = false, slug) {
993
954
  const cacheKey = `gf:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
994
- if (fontBytesCache$1.has(cacheKey)) return fontBytesCache$1.get(cacheKey);
955
+ if (fontBytesCache.has(cacheKey)) return fontBytesCache.get(cacheKey);
995
956
  await fetchFontshareTTF(fontFamily, weight, isItalic);
996
- return fontBytesCache$1.get(cacheKey) || null;
957
+ return fontBytesCache.get(cacheKey) || null;
997
958
  }
998
959
  const embedFontWithGoogleFallback = async (pdf, fontName, weight = 400, isItalic = false) => {
999
960
  if (FONT_FILES[fontName]) {
@@ -1144,753 +1105,27 @@ function resolveDevanagariSibling(latinFont) {
1144
1105
  if (!latinFont) return FONT_FALLBACK_DEVANAGARI;
1145
1106
  return LATIN_TO_DEVANAGARI[latinFont] || FONT_FALLBACK_DEVANAGARI;
1146
1107
  }
1147
- const pdfFonts = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1148
- __proto__: null,
1149
- FONT_FALLBACK_DEVANAGARI,
1150
- FONT_FALLBACK_MATH,
1151
- FONT_FALLBACK_SYMBOLS,
1152
- FONT_FILES,
1153
- FONT_WEIGHT_LABELS,
1154
- LATIN_TO_DEVANAGARI,
1155
- doesVariantSupportChar,
1156
- embedFont,
1157
- embedFontWithGoogleFallback,
1158
- fetchFontshareTTF,
1159
- fetchGoogleFontTTF,
1160
- getEmbeddedJsPDFFontName,
1161
- getEmbeddedVariantsList,
1162
- getFontshareFontBytes,
1163
- getGoogleFontBytes,
1164
- getJsPDFFontName,
1165
- isFamilyEmbedded,
1166
- isFontAvailable,
1167
- isVariantEmbedded,
1168
- resetPdfFontRegistry,
1169
- resolveBestRegisteredVariant,
1170
- resolveDevanagariSibling,
1171
- resolveFontWeight
1172
- }, Symbol.toStringTag, { value: "Module" }));
1173
- const HB_WASM_URL = "/wasm/hb.wasm";
1174
- let hbInstancePromise = null;
1175
- async function getHB() {
1176
- if (hbInstancePromise) return hbInstancePromise;
1177
- hbInstancePromise = (async () => {
1178
- const [{ default: createHarfBuzz }, { default: hbjs }] = await Promise.all([
1179
- import("harfbuzzjs/hb.js"),
1180
- import("harfbuzzjs/hbjs.js")
1181
- ]);
1182
- const moduleInstance = await createHarfBuzz({
1183
- locateFile: (path) => {
1184
- if (path.endsWith(".wasm")) return HB_WASM_URL;
1185
- return path;
1186
- }
1187
- });
1188
- return hbjs(moduleInstance);
1189
- })();
1190
- return hbInstancePromise;
1191
- }
1192
- const hbFontCache = /* @__PURE__ */ new Map();
1193
- async function getHBFont(cacheKey, fontDataLoader) {
1194
- const cached = hbFontCache.get(cacheKey);
1195
- if (cached) return { font: cached.font, upem: cached.upem };
1196
- const hb = await getHB();
1197
- const fontData = await fontDataLoader();
1198
- const blob = hb.createBlob(fontData);
1199
- const face = hb.createFace(blob, 0);
1200
- const font = hb.createFont(face);
1201
- const upem = (face.getUpem ? face.getUpem() : face.upem ?? 1e3) || 1e3;
1202
- font.setScale(upem, upem);
1203
- blob.destroy();
1204
- hbFontCache.set(cacheKey, { face, font, upem });
1205
- return { font, upem };
1206
- }
1207
- async function shapeRunToSvgPath(fontData, cacheKey, text, x, y, fontSize, opts) {
1208
- const hb = await getHB();
1209
- const loader = typeof fontData === "function" ? fontData : async () => fontData;
1210
- const { font, upem } = await getHBFont(cacheKey, loader);
1211
- const buffer = hb.createBuffer();
1212
- buffer.addText(text);
1213
- if (opts == null ? void 0 : opts.direction) buffer.setDirection(opts.direction);
1214
- if (opts == null ? void 0 : opts.script) buffer.setScript(opts.script);
1215
- if (opts == null ? void 0 : opts.language) buffer.setLanguage(opts.language);
1216
- buffer.guessSegmentProperties();
1217
- hb.shape(font, buffer);
1218
- const glyphs = buffer.json();
1219
- const scale = fontSize / upem;
1220
- let penX = 0;
1221
- let penY = 0;
1222
- const pieces = [];
1223
- for (const g of glyphs) {
1224
- const rawPath = font.glyphToPath(g.g);
1225
- if (rawPath) {
1226
- const ox = (penX + g.dx) * scale + x;
1227
- const oy = (penY + g.dy) * -scale + y;
1228
- pieces.push(transformPathData(rawPath, scale, -scale, ox, oy));
1229
- }
1230
- penX += g.ax;
1231
- penY += g.ay;
1232
- }
1233
- buffer.destroy();
1234
- return {
1235
- pathData: pieces.join(""),
1236
- width: penX * scale
1237
- };
1238
- }
1239
- function transformPathData(d, sx, sy, tx, ty) {
1240
- let out = "";
1241
- let i = 0;
1242
- const n = d.length;
1243
- while (i < n) {
1244
- const c = d[i];
1245
- if (c === "M" || c === "L" || c === "C" || c === "Q") {
1246
- out += c;
1247
- i++;
1248
- let pairsBuf = "";
1249
- while (i < n && d[i] !== "M" && d[i] !== "L" && d[i] !== "C" && d[i] !== "Q" && d[i] !== "Z") {
1250
- pairsBuf += d[i];
1251
- i++;
1252
- }
1253
- const nums = pairsBuf.trim().split(/[ ,]+/).filter(Boolean).map(Number);
1254
- for (let k = 0; k < nums.length; k += 2) {
1255
- const px = nums[k] * sx + tx;
1256
- const py = nums[k + 1] * sy + ty;
1257
- if (k > 0) out += " ";
1258
- out += `${round(px)},${round(py)}`;
1259
- }
1260
- } else if (c === "Z") {
1261
- out += "Z";
1262
- i++;
1263
- } else {
1264
- i++;
1265
- }
1266
- }
1267
- return out;
1268
- }
1269
- function round(n) {
1270
- return (Math.round(n * 100) / 100).toString();
1271
- }
1272
- const fontCache = /* @__PURE__ */ new Map();
1273
- const fontBytesCache = /* @__PURE__ */ new Map();
1274
- function isDevanagari(char) {
1275
- const c = char.codePointAt(0) ?? 0;
1276
- return c >= 2304 && c <= 2431 || c >= 43232 && c <= 43263 || c >= 7376 && c <= 7423;
1277
- }
1278
- function containsDevanagari(text) {
1279
- if (!text) return false;
1280
- for (const char of text) {
1281
- if (isDevanagari(char)) return true;
1282
- }
1283
- return false;
1284
- }
1285
- function isBasicLatinOrLatinExtended(char) {
1286
- const c = char.codePointAt(0) ?? 0;
1287
- return c <= 591;
1288
- }
1289
- function isMathOperatorChar(char) {
1290
- const c = char.codePointAt(0) ?? 0;
1291
- if (c >= 8592 && c <= 8703) return true;
1292
- if (c >= 8704 && c <= 8959) return true;
1293
- if (c >= 8960 && c <= 9215) return true;
1294
- if (c >= 10176 && c <= 10223) return true;
1295
- if (c >= 10624 && c <= 10751) return true;
1296
- if (c >= 10752 && c <= 11007) return true;
1297
- if (c >= 11008 && c <= 11097) return true;
1298
- return false;
1299
- }
1300
- function classifyCharForFontRun(char) {
1301
- if (isBasicLatinOrLatinExtended(char)) return "main";
1302
- if (isDevanagari(char)) return "devanagari";
1303
- if (isMathOperatorChar(char)) return "math";
1304
- return "symbol";
1305
- }
1306
- function isIgnorableForCoverage(char) {
1307
- return /\s/.test(char) || /[\u0964\u0965\u200c\u200d]/u.test(char);
1308
- }
1309
- function fontSupportsRun(font, text, runType) {
1310
- if (!font) return false;
1311
- for (const char of text) {
1312
- if (isIgnorableForCoverage(char)) continue;
1313
- if (runType === "devanagari" && !isDevanagari(char)) continue;
1314
- if (runType === "symbol" && classifyCharForFontRun(char) !== "symbol") continue;
1315
- if (runType === "math" && classifyCharForFontRun(char) !== "math") continue;
1316
- const glyph = font.charToGlyph(char);
1317
- if (!glyph || glyph.index === 0) return false;
1318
- }
1319
- return true;
1320
- }
1321
- const browserMeasureCanvas = typeof document !== "undefined" ? document.createElement("canvas") : null;
1322
- function measureBrowserWidth(fontFamily, weight, fontSize, text) {
1323
- const ctx = browserMeasureCanvas == null ? void 0 : browserMeasureCanvas.getContext("2d");
1324
- if (!ctx) return null;
1325
- ctx.font = `normal normal ${weight} ${fontSize}px "${fontFamily}"`;
1326
- return ctx.measureText(text).width;
1327
- }
1328
- function uniqueFamilies(families) {
1329
- const seen = /* @__PURE__ */ new Set();
1330
- const out = [];
1331
- for (const family of families) {
1332
- const clean = family == null ? void 0 : family.trim();
1333
- if (!clean || seen.has(clean)) continue;
1334
- seen.add(clean);
1335
- out.push(clean);
1336
- }
1337
- return out;
1338
- }
1339
- function fontLooksItalic(font) {
1340
- var _a, _b, _c, _d;
1341
- if (!font) return false;
1342
- const names = font.names;
1343
- const candidates = [
1344
- (_a = names.fontSubfamily) == null ? void 0 : _a.en,
1345
- (_b = names.typographicSubfamily) == null ? void 0 : _b.en,
1346
- (_c = names.fullName) == null ? void 0 : _c.en,
1347
- (_d = names.postScriptName) == null ? void 0 : _d.en
1348
- ].filter(Boolean).join(" ");
1349
- return /italic|oblique/i.test(candidates);
1350
- }
1351
- function syntheticItalicTransform(anchorX, baselineY) {
1352
- return `translate(${anchorX} ${baselineY}) skewX(-12) translate(${-anchorX} ${-baselineY})`;
1353
- }
1354
- function getFontPath(fontFiles, weight, isItalic = false) {
1355
- const resolved = resolveFontWeight(weight);
1356
- const uprightMap = {
1357
- 300: ["light", "regular"],
1358
- 400: ["regular"],
1359
- 500: ["medium", "regular"],
1360
- 600: ["semibold", "bold"],
1361
- 700: ["bold", "semibold", "regular"]
1362
- };
1363
- const italicMap = {
1364
- 300: ["lightItalic", "italic", "light", "regular"],
1365
- 400: ["italic", "regular"],
1366
- 500: ["mediumItalic", "italic", "medium", "regular"],
1367
- 600: ["semiboldItalic", "boldItalic", "italic", "semibold", "bold", "regular"],
1368
- 700: ["boldItalic", "semiboldItalic", "italic", "bold", "semibold", "regular"]
1369
- };
1370
- const map = isItalic ? italicMap : uprightMap;
1371
- for (const key of map[resolved] || ["regular"]) {
1372
- if (fontFiles[key]) return fontFiles[key];
1373
- }
1374
- return fontFiles.regular || null;
1375
- }
1376
- function resolveFontUrl(fileName, fontBaseUrl) {
1377
- if (/^https?:\/\//i.test(fileName) || fileName.startsWith("data:")) return fileName;
1378
- if (fileName.startsWith("/")) {
1379
- return typeof window !== "undefined" ? new URL(fileName, window.location.origin).toString() : fileName;
1380
- }
1381
- const baseUrl = fontBaseUrl.endsWith("/") ? fontBaseUrl : fontBaseUrl + "/";
1382
- return new URL(fileName, baseUrl).toString();
1383
- }
1384
- async function loadFont(fontFamily, weight, fontBaseUrl, isItalic = false) {
1385
- const cacheKey = `${fontFamily}__${weight}__${isItalic ? "i" : "n"}`;
1386
- if (fontCache.has(cacheKey)) return fontCache.get(cacheKey);
1387
- const fontFiles = FONT_FILES[fontFamily];
1388
- if (fontFiles) {
1389
- const fileName = getFontPath(fontFiles, weight, isItalic);
1390
- if (!fileName) return null;
1391
- const url = resolveFontUrl(fileName, fontBaseUrl);
1392
- try {
1393
- const response = await fetch(url);
1394
- if (!response.ok) {
1395
- console.warn(`[text-to-path] Failed to fetch font ${url}: ${response.status}`);
1396
- return null;
1397
- }
1398
- const buffer = await response.arrayBuffer();
1399
- const bytes = new Uint8Array(buffer);
1400
- fontBytesCache.set(cacheKey, bytes);
1401
- const font = opentype__namespace.parse(buffer);
1402
- fontCache.set(cacheKey, font);
1403
- return font;
1404
- } catch (err) {
1405
- console.warn(`[text-to-path] Failed to load local font ${fontFamily}:`, err);
1406
- return null;
1407
- }
1408
- }
1409
- try {
1410
- const resolvedWeight = resolveFontWeight(weight);
1411
- let bytes = await getGoogleFontBytes(fontFamily, resolvedWeight, isItalic);
1412
- if (!bytes) {
1413
- bytes = await getFontshareFontBytes(fontFamily, resolvedWeight, isItalic);
1414
- }
1415
- if (!bytes && isItalic) {
1416
- bytes = await getGoogleFontBytes(fontFamily, resolvedWeight, false);
1417
- if (!bytes) bytes = await getFontshareFontBytes(fontFamily, resolvedWeight, false);
1418
- }
1419
- if (!bytes) {
1420
- console.warn(`[text-to-path] No TTF available for ${fontFamily} (${weight}) on Google Fonts or Fontshare`);
1421
- return null;
1422
- }
1423
- fontBytesCache.set(cacheKey, bytes);
1424
- const ab = bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength);
1425
- const font = opentype__namespace.parse(ab);
1426
- fontCache.set(cacheKey, font);
1427
- return font;
1428
- } catch (err) {
1429
- console.warn(`[text-to-path] Failed to load Google font ${fontFamily}:`, err);
1430
- return null;
1431
- }
1432
- }
1433
- async function getFontBytes(fontFamily, weight, fontBaseUrl, isItalic = false) {
1434
- const cacheKey = `${fontFamily}__${weight}__${isItalic ? "i" : "n"}`;
1435
- if (!fontBytesCache.has(cacheKey)) {
1436
- await loadFont(fontFamily, weight, fontBaseUrl, isItalic);
1437
- }
1438
- const bytes = fontBytesCache.get(cacheKey);
1439
- return bytes ? { bytes, cacheKey } : null;
1440
- }
1441
- function measureRunWidth(font, text, fontSize) {
1442
- try {
1443
- return font.getAdvanceWidth(text, fontSize, { kerning: true });
1444
- } catch {
1445
- try {
1446
- return font.getAdvanceWidth(text, fontSize);
1447
- } catch {
1448
- return text.length * fontSize * 0.5;
1449
- }
1450
- }
1451
- }
1452
- function splitByFontRun(text) {
1453
- if (!text) return [];
1454
- const runs = [];
1455
- let buf = "";
1456
- let bufType = classifyCharForFontRun(text[0]);
1457
- for (const ch of text) {
1458
- const chType = classifyCharForFontRun(ch);
1459
- const isNeutral = /\s/.test(ch);
1460
- if (chType === bufType || isNeutral) {
1461
- buf += ch;
1462
- } else {
1463
- if (buf) runs.push({ text: buf, runType: bufType });
1464
- buf = ch;
1465
- bufType = chType;
1466
- }
1467
- }
1468
- if (buf) runs.push({ text: buf, runType: bufType });
1469
- return runs;
1470
- }
1471
- async function shapeRunToPath(run, isDeva, primaryFont, primaryBytes, devaFont, devaBytes, x, y, fontSize) {
1472
- if (isDeva && devaBytes && devaFont) {
1473
- try {
1474
- const shaped = await shapeRunToSvgPath(
1475
- devaBytes.bytes,
1476
- devaBytes.cacheKey,
1477
- run,
1478
- x,
1479
- y,
1480
- fontSize,
1481
- { script: "deva", language: "hin", direction: "ltr" }
1482
- );
1483
- if (shaped.pathData) {
1484
- const advance = measureRunWidth(devaFont, run, fontSize);
1485
- return { pathData: shaped.pathData, advance };
1486
- }
1487
- } catch (err) {
1488
- console.warn(`[text-to-path] HarfBuzz failed for "${run}":`, err);
1489
- }
1490
- try {
1491
- const path = devaFont.getPath(run, x, y, fontSize);
1492
- const d = path.toPathData(2);
1493
- if (d && d !== "M0 0") return { pathData: d, advance: measureRunWidth(devaFont, run, fontSize) };
1494
- } catch {
1495
- }
1496
- return null;
1497
- }
1498
- try {
1499
- const path = primaryFont.getPath(run, x, y, fontSize, { kerning: true });
1500
- const d = path.toPathData(2);
1501
- if (d && d !== "M0 0") return { pathData: d, advance: measureRunWidth(primaryFont, run, fontSize) };
1502
- return { pathData: "", advance: measureRunWidth(primaryFont, run, fontSize) };
1503
- } catch (err) {
1504
- console.warn(`[text-to-path] opentype getPath failed for "${run}":`, err);
1505
- return null;
1506
- }
1507
- }
1508
- function parseTranslate(transform) {
1509
- if (!transform) return { tx: 0, ty: 0 };
1510
- const m = transform.match(/translate\(\s*([-\d.]+)[ \s,]+([-\d.]+)\s*\)/);
1511
- if (m) return { tx: parseFloat(m[1]), ty: parseFloat(m[2]) };
1512
- const mm = transform.match(/matrix\(\s*([-\d.]+)[ \s,]+([-\d.]+)[ \s,]+([-\d.]+)[ \s,]+([-\d.]+)[ \s,]+([-\d.]+)[ \s,]+([-\d.]+)\s*\)/);
1513
- if (mm) return { tx: parseFloat(mm[5]), ty: parseFloat(mm[6]) };
1514
- return { tx: 0, ty: 0 };
1515
- }
1516
- function needsComplexShaping(text) {
1517
- if (!text) return false;
1518
- for (const ch of text) {
1519
- const c = ch.codePointAt(0) ?? 0;
1520
- if (c >= 2304 && c <= 2431 || c >= 43232 && c <= 43263 || c >= 7376 && c <= 7423) return true;
1521
- if (c >= 2432 && c <= 3583) return true;
1522
- if (c >= 3584 && c <= 4095) return true;
1523
- if (c >= 4096 && c <= 4255) return true;
1524
- if (c >= 6016 && c <= 6143) return true;
1525
- if (c >= 1424 && c <= 1791) return true;
1526
- if (c >= 1792 && c <= 1871) return true;
1527
- if (c >= 12288 && c <= 40959) return true;
1528
- if (c >= 44032 && c <= 55215) return true;
1529
- if (c >= 126976) return true;
1530
- if (c >= 8592 && c <= 8703) return true;
1531
- if (c >= 8704 && c <= 8959) return true;
1532
- if (c >= 8960 && c <= 9215) return true;
1533
- if (c >= 10176 && c <= 10223) return true;
1534
- if (c >= 10624 && c <= 10751) return true;
1535
- if (c >= 10752 && c <= 11007) return true;
1536
- if (c >= 11008 && c <= 11097) return true;
1537
- }
1538
- return false;
1539
- }
1540
- const DECORATIVE_OUTLINE_FAMILIES = /* @__PURE__ */ new Set([
1541
- "greatvibes",
1542
- "great vibes",
1543
- "cinzel",
1544
- "cinzeldecorative",
1545
- "cinzel decorative",
1546
- "pacifico",
1547
- "allura",
1548
- "alexbrush",
1549
- "alex brush",
1550
- "abrilfatface",
1551
- "abril fatface",
1552
- "cormorant",
1553
- "cormorantgaramond",
1554
- "cormorant garamond",
1555
- "dancingscript",
1556
- "dancing script",
1557
- "sacramento",
1558
- "lobster",
1559
- "satisfy",
1560
- "kaushanscript",
1561
- "kaushan script",
1562
- "parisienne",
1563
- "tangerine",
1564
- "yellowtail",
1565
- "shadowsintolight",
1566
- "shadows into light",
1567
- "amaticsc",
1568
- "amatic sc",
1569
- "caveat",
1570
- "playball",
1571
- "marckscript",
1572
- "marck script",
1573
- "courgette"
1574
- ]);
1575
- function isDecorativeFamily(family) {
1576
- if (!family) return false;
1577
- const k = family.replace(/['"]/g, "").replace(/\s+/g, " ").trim().toLowerCase();
1578
- if (DECORATIVE_OUTLINE_FAMILIES.has(k)) return true;
1579
- return DECORATIVE_OUTLINE_FAMILIES.has(k.replace(/\s+/g, ""));
1580
- }
1581
- function readResolvedFontFamily(textEl) {
1582
- var _a, _b, _c;
1583
- const readStyleToken = (style, prop) => {
1584
- var _a2;
1585
- const m = style.match(new RegExp(`${prop}\\s*:\\s*([^;]+)`, "i"));
1586
- return ((_a2 = m == null ? void 0 : m[1]) == null ? void 0 : _a2.trim()) || null;
1587
- };
1588
- let current = textEl;
1589
- while (current) {
1590
- const a = (_a = current.getAttribute("font-family")) == null ? void 0 : _a.trim();
1591
- if (a) return ((_b = a.split(",")[0]) == null ? void 0 : _b.replace(/['"]/g, "").trim()) || null;
1592
- const s = readStyleToken(current.getAttribute("style") || "", "font-family");
1593
- if (s) return ((_c = s.split(",")[0]) == null ? void 0 : _c.replace(/['"]/g, "").trim()) || null;
1594
- current = current.parentElement;
1595
- }
1596
- return null;
1597
- }
1598
- async function convertDevanagariTextToPath(svgStr, fontBaseUrl, options = {}) {
1599
- var _a, _b, _c, _d;
1600
- const baseUrl = fontBaseUrl ?? (typeof window !== "undefined" ? window.location.origin + "/fonts/" : "/fonts/");
1601
- const mode = options.mode ?? "all";
1602
- const parser = new DOMParser();
1603
- const doc = parser.parseFromString(svgStr, "image/svg+xml");
1604
- const textEls = doc.querySelectorAll("text");
1605
- let convertedCount = 0;
1606
- let skippedCount = 0;
1607
- for (const textEl of textEls) {
1608
- if ((_a = textEl.closest) == null ? void 0 : _a.call(textEl, '[data-pd-selectable-layer="1"]')) {
1609
- skippedCount++;
1610
- continue;
1611
- }
1612
- const fullText = textEl.textContent || "";
1613
- if (!fullText.trim()) continue;
1614
- if (mode === "shadow-bound") {
1615
- const inShadowMarker = !!textEl.closest && !!textEl.closest("g.__pdShadowRaster");
1616
- let inTaggedTextbox = false;
1617
- let cur = textEl.parentElement;
1618
- while (cur) {
1619
- if (cur.tagName.toLowerCase() === "g" && (cur.hasAttribute("data-pd-shadow-blur") || cur.hasAttribute("data-pd-text-bg"))) {
1620
- inTaggedTextbox = true;
1621
- break;
1622
- }
1623
- cur = cur.parentElement;
1624
- }
1625
- if (!inShadowMarker && !inTaggedTextbox) {
1626
- skippedCount++;
1627
- continue;
1628
- }
1629
- }
1630
- const hasMixedStyleTspans = () => {
1631
- const tspansAll = textEl.querySelectorAll("tspan");
1632
- const readProp = (el, prop) => {
1633
- const attr = (el.getAttribute(prop) || "").trim();
1634
- if (attr) return attr;
1635
- const style = el.getAttribute("style") || "";
1636
- const m = style.match(new RegExp(`(?:^|;)\\s*${prop}\\s*:\\s*([^;]+)`, "i"));
1637
- return m ? m[1].trim() : "";
1638
- };
1639
- const baseWeight = readProp(textEl, "font-weight");
1640
- const baseStyle = readProp(textEl, "font-style");
1641
- const baseFill = readProp(textEl, "fill");
1642
- const baseDeco = readProp(textEl, "text-decoration");
1643
- for (const ts of tspansAll) {
1644
- const tw = readProp(ts, "font-weight");
1645
- const tst = readProp(ts, "font-style");
1646
- const tFill = readProp(ts, "fill");
1647
- const tDeco = readProp(ts, "text-decoration");
1648
- const tBg = (ts.getAttribute("style") || "").match(/background|text-background/i);
1649
- if (tw && tw !== baseWeight || tst && tst !== baseStyle || tFill && tFill !== baseFill || tDeco && tDeco !== baseDeco || tBg) {
1650
- return true;
1651
- }
1652
- }
1653
- return false;
1654
- };
1655
- if (mode === "complex-only") {
1656
- const resolvedFamily = readResolvedFontFamily(textEl);
1657
- const decorative = isDecorativeFamily(resolvedFamily);
1658
- if (!needsComplexShaping(fullText) && !hasMixedStyleTspans() && !decorative) {
1659
- skippedCount++;
1660
- continue;
1661
- }
1662
- }
1663
- if (mode === "mixed-style-only" && !hasMixedStyleTspans()) {
1664
- skippedCount++;
1665
- continue;
1666
- }
1667
- const readStyleToken = (style, prop) => {
1668
- var _a2;
1669
- const m = style.match(new RegExp(`${prop}\\s*:\\s*([^;]+)`, "i"));
1670
- return ((_a2 = m == null ? void 0 : m[1]) == null ? void 0 : _a2.trim()) || null;
1671
- };
1672
- const getAttrOrStyle = (el, attr) => {
1673
- var _a2;
1674
- let current = el;
1675
- while (current) {
1676
- const attrVal = (_a2 = current.getAttribute(attr)) == null ? void 0 : _a2.trim();
1677
- if (attrVal) return attrVal;
1678
- const styleVal = readStyleToken(current.getAttribute("style") || "", attr);
1679
- if (styleVal) return styleVal;
1680
- current = current.parentElement;
1681
- }
1682
- return null;
1683
- };
1684
- const fontFamily = (_c = (_b = getAttrOrStyle(textEl, "font-family")) == null ? void 0 : _b.split(",")[0]) == null ? void 0 : _c.replace(/['"]/g, "").trim();
1685
- const fontSizeStr = getAttrOrStyle(textEl, "font-size") || "16";
1686
- const fontSize = parseFloat(fontSizeStr);
1687
- const fontWeightStr = getAttrOrStyle(textEl, "font-weight") || "400";
1688
- const fontWeight = Number.parseInt(fontWeightStr, 10) || 400;
1689
- const fillColor = getAttrOrStyle(textEl, "fill") || "#000000";
1690
- const fillOpacity = getAttrOrStyle(textEl, "fill-opacity") || "1";
1691
- if (!fontFamily) {
1692
- skippedCount++;
1693
- continue;
1694
- }
1695
- const primaryFont = await loadFont(fontFamily, fontWeight, baseUrl);
1696
- const primaryBytes = await getFontBytes(fontFamily, fontWeight, baseUrl);
1697
- const hasDeva = containsDevanagari(fullText);
1698
- const hasSymbol = [...fullText].some((char) => classifyCharForFontRun(char) === "symbol");
1699
- const hasMath = [...fullText].some((char) => classifyCharForFontRun(char) === "math");
1700
- const devaCandidateFamilies = hasDeva ? uniqueFamilies([fontFamily, FONT_FALLBACK_DEVANAGARI, resolveDevanagariSibling(fontFamily)]) : [];
1701
- const devaRunFontCache = /* @__PURE__ */ new Map();
1702
- const resolveDevaFontForRun = (runText, runFontSize) => {
1703
- const cacheKey = `${runText}__${runFontSize}`;
1704
- const cached = devaRunFontCache.get(cacheKey);
1705
- if (cached) return cached;
1706
- const promise = (async () => {
1707
- const browserWidth = measureBrowserWidth(fontFamily, fontWeight, runFontSize, runText);
1708
- let best = null;
1709
- for (const family of devaCandidateFamilies) {
1710
- const font = family === fontFamily ? primaryFont : await loadFont(family, fontWeight, baseUrl);
1711
- const bytes = family === fontFamily ? primaryBytes : await getFontBytes(family, fontWeight, baseUrl);
1712
- if (!font || !bytes || !fontSupportsRun(font, runText, "devanagari")) continue;
1713
- const width = measureRunWidth(font, runText, runFontSize);
1714
- const diff = browserWidth == null ? 0 : Math.abs(width - browserWidth);
1715
- if (!best || diff < best.diff) best = { family, font, bytes, diff };
1716
- if (browserWidth != null && diff <= 0.25) break;
1717
- }
1718
- if (best) {
1719
- console.log("[text-to-path] Devanagari font resolved", {
1720
- requestedFamily: fontFamily,
1721
- resolvedFamily: best.family,
1722
- browserWidth,
1723
- diff: Math.round(best.diff * 100) / 100
1724
- });
1725
- }
1726
- return best;
1727
- })();
1728
- devaRunFontCache.set(cacheKey, promise);
1729
- return promise;
1730
- };
1731
- const symbolRunFontPromise = hasSymbol ? (async () => {
1732
- const symbolFont = await loadFont(FONT_FALLBACK_SYMBOLS, 400, baseUrl);
1733
- const symbolBytes = await getFontBytes(FONT_FALLBACK_SYMBOLS, 400, baseUrl);
1734
- return symbolFont && symbolBytes ? { family: FONT_FALLBACK_SYMBOLS, font: symbolFont, bytes: symbolBytes } : null;
1735
- })() : null;
1736
- const mathRunFontPromise = hasMath ? (async () => {
1737
- const mathFont = await loadFont(FONT_FALLBACK_MATH, 400, baseUrl);
1738
- const mathBytes = await getFontBytes(FONT_FALLBACK_MATH, 400, baseUrl);
1739
- return mathFont && mathBytes ? { family: FONT_FALLBACK_MATH, font: mathFont, bytes: mathBytes } : null;
1740
- })() : null;
1741
- if (!primaryFont && !hasDeva && !hasSymbol && !hasMath) {
1742
- console.warn(`[text-to-path] No font available for "${fontFamily}", leaving as <text>`);
1743
- skippedCount++;
1744
- continue;
1745
- }
1746
- const textAnchorRaw = (getAttrOrStyle(textEl, "text-anchor") || "start").toLowerCase();
1747
- const baseTextAnchor = textAnchorRaw === "middle" ? "middle" : textAnchorRaw === "end" ? "end" : "start";
1748
- const tspans = textEl.querySelectorAll("tspan");
1749
- const elementsToProcess = tspans.length > 0 ? Array.from(tspans) : [textEl];
1750
- const group = doc.createElementNS("http://www.w3.org/2000/svg", "g");
1751
- const textTransform = textEl.getAttribute("transform");
1752
- if (textTransform) group.setAttribute("transform", textTransform);
1753
- const baseX = parseFloat(textEl.getAttribute("x") || "0");
1754
- const baseY = parseFloat(textEl.getAttribute("y") || "0");
1755
- for (const elem of elementsToProcess) {
1756
- const text = elem.textContent || "";
1757
- if (!text.trim()) continue;
1758
- const elemX = parseFloat(elem.getAttribute("x") || String(baseX));
1759
- const elemY = parseFloat(elem.getAttribute("y") || String(baseY));
1760
- const elemAnchorRaw = (getAttrOrStyle(elem, "text-anchor") || baseTextAnchor).toLowerCase();
1761
- const elemTextAnchor = elemAnchorRaw === "middle" ? "middle" : elemAnchorRaw === "end" ? "end" : "start";
1762
- const elemTransform = elem !== textEl ? parseTranslate(elem.getAttribute("transform")) : { tx: 0, ty: 0 };
1763
- let x = elemX + elemTransform.tx;
1764
- const y = elemY + elemTransform.ty;
1765
- const elemFill = getAttrOrStyle(elem, "fill") || fillColor;
1766
- const elemFillOpacity = getAttrOrStyle(elem, "fill-opacity") || fillOpacity;
1767
- const elemFontSizeStr = getAttrOrStyle(elem, "font-size") || String(fontSize);
1768
- const elemFontSize = parseFloat(elemFontSizeStr);
1769
- const elemWeightStr = getAttrOrStyle(elem, "font-weight") || String(fontWeight);
1770
- const elemWeight = Number.parseInt(elemWeightStr, 10) || (/bold/i.test(elemWeightStr) ? 700 : fontWeight);
1771
- const elemStyleRaw = (getAttrOrStyle(elem, "font-style") || "normal").toLowerCase();
1772
- const elemItalic = /italic|oblique/i.test(elemStyleRaw);
1773
- const sameAsPrimary = elemWeight === fontWeight && !elemItalic;
1774
- const elemFont = sameAsPrimary ? primaryFont : await loadFont(fontFamily, elemWeight, baseUrl, elemItalic);
1775
- const elemBytes = sameAsPrimary ? primaryBytes : await getFontBytes(fontFamily, elemWeight, baseUrl, elemItalic);
1776
- const fontForElem = elemFont || primaryFont;
1777
- const bytesForElem = elemBytes || primaryBytes;
1778
- const runs = splitByFontRun(text);
1779
- let totalAdvance = 0;
1780
- let canMeasureAll = true;
1781
- for (const r of runs) {
1782
- if (r.runType === "devanagari") {
1783
- const resolved = await resolveDevaFontForRun(r.text, elemFontSize);
1784
- if (resolved) totalAdvance += measureRunWidth(resolved.font, r.text, elemFontSize);
1785
- else canMeasureAll = false;
1786
- } else if (r.runType === "symbol") {
1787
- const resolved = await symbolRunFontPromise;
1788
- if (resolved && fontSupportsRun(resolved.font, r.text, "symbol")) totalAdvance += measureRunWidth(resolved.font, r.text, elemFontSize);
1789
- else canMeasureAll = false;
1790
- } else if (r.runType === "math") {
1791
- const resolved = await mathRunFontPromise;
1792
- if (resolved && fontSupportsRun(resolved.font, r.text, "math")) totalAdvance += measureRunWidth(resolved.font, r.text, elemFontSize);
1793
- else canMeasureAll = false;
1794
- } else {
1795
- if (fontForElem) totalAdvance += measureRunWidth(fontForElem, r.text, elemFontSize);
1796
- else canMeasureAll = false;
1797
- }
1798
- }
1799
- if (canMeasureAll) {
1800
- if (elemTextAnchor === "middle") x -= totalAdvance / 2;
1801
- else if (elemTextAnchor === "end") x -= totalAdvance;
1802
- }
1803
- let cursor = x;
1804
- let elemConverted = false;
1805
- for (const r of runs) {
1806
- const resolvedDeva = r.runType === "devanagari" ? await resolveDevaFontForRun(r.text, elemFontSize) : null;
1807
- const resolvedSymbol = r.runType === "symbol" ? await symbolRunFontPromise : null;
1808
- const resolvedMath = r.runType === "math" ? await mathRunFontPromise : null;
1809
- const useDeva = !!resolvedDeva;
1810
- const fontForRun = (resolvedDeva == null ? void 0 : resolvedDeva.font) ?? (resolvedSymbol == null ? void 0 : resolvedSymbol.font) ?? (resolvedMath == null ? void 0 : resolvedMath.font) ?? fontForElem;
1811
- const bytesForRun = (resolvedDeva == null ? void 0 : resolvedDeva.bytes) ?? (resolvedSymbol == null ? void 0 : resolvedSymbol.bytes) ?? (resolvedMath == null ? void 0 : resolvedMath.bytes) ?? bytesForElem;
1812
- if (!fontForRun) continue;
1813
- const result = await shapeRunToPath(
1814
- r.text,
1815
- !!useDeva,
1816
- fontForRun,
1817
- bytesForRun,
1818
- (resolvedDeva == null ? void 0 : resolvedDeva.font) ?? null,
1819
- (resolvedDeva == null ? void 0 : resolvedDeva.bytes) ?? null,
1820
- cursor,
1821
- y,
1822
- elemFontSize
1823
- );
1824
- if (result && result.pathData) {
1825
- const pathEl = doc.createElementNS("http://www.w3.org/2000/svg", "path");
1826
- pathEl.setAttribute("d", result.pathData);
1827
- pathEl.setAttribute("fill", elemFill);
1828
- if (elemItalic && !fontLooksItalic(fontForRun)) {
1829
- pathEl.setAttribute("transform", syntheticItalicTransform(cursor, y));
1830
- }
1831
- if (elemFillOpacity !== "1") {
1832
- pathEl.setAttribute("fill-opacity", elemFillOpacity);
1833
- }
1834
- group.appendChild(pathEl);
1835
- elemConverted = true;
1836
- }
1837
- if (result) cursor += result.advance;
1838
- }
1839
- if (elemConverted) {
1840
- convertedCount++;
1841
- } else {
1842
- if (elem === textEl) {
1843
- const clone = elem.cloneNode(true);
1844
- if (textTransform) clone.removeAttribute("transform");
1845
- group.appendChild(clone);
1846
- } else {
1847
- const newText = doc.createElementNS("http://www.w3.org/2000/svg", "text");
1848
- newText.setAttribute("x", String(elemX));
1849
- newText.setAttribute("y", String(elemY));
1850
- if (elem.getAttribute("style")) newText.setAttribute("style", elem.getAttribute("style"));
1851
- if (elem.getAttribute("font-family")) newText.setAttribute("font-family", elem.getAttribute("font-family"));
1852
- if (elem.getAttribute("font-size")) newText.setAttribute("font-size", elem.getAttribute("font-size"));
1853
- if (elem.getAttribute("font-weight")) newText.setAttribute("font-weight", elem.getAttribute("font-weight"));
1854
- newText.textContent = text;
1855
- group.appendChild(newText);
1856
- }
1857
- }
1858
- }
1859
- if (group.childNodes.length > 0) {
1860
- (_d = textEl.parentNode) == null ? void 0 : _d.replaceChild(group, textEl);
1861
- }
1862
- }
1863
- console.log(
1864
- `[text-to-path] Universal outline complete: converted=${convertedCount} skipped=${skippedCount}`
1865
- );
1866
- return new XMLSerializer().serializeToString(doc.documentElement);
1867
- }
1868
- const convertAllTextToPath = convertDevanagariTextToPath;
1869
- async function preloadDevanagariFont(fontBaseUrl) {
1870
- const baseUrl = fontBaseUrl ?? (typeof window !== "undefined" ? window.location.origin + "/fonts/" : "/fonts/");
1871
- for (const weight of [300, 400, 500, 600, 700]) {
1872
- await loadFont(FONT_FALLBACK_DEVANAGARI, weight, baseUrl);
1873
- }
1874
- }
1875
- const svgTextToPath = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1876
- __proto__: null,
1877
- convertAllTextToPath,
1878
- convertDevanagariTextToPath,
1879
- preloadDevanagariFont
1880
- }, Symbol.toStringTag, { value: "Module" }));
1881
1108
  exports.FONT_FALLBACK_DEVANAGARI = FONT_FALLBACK_DEVANAGARI;
1882
1109
  exports.FONT_FALLBACK_MATH = FONT_FALLBACK_MATH;
1883
1110
  exports.FONT_FALLBACK_SYMBOLS = FONT_FALLBACK_SYMBOLS;
1884
- exports.convertAllTextToPath = convertAllTextToPath;
1111
+ exports.FONT_FILES = FONT_FILES;
1112
+ exports.FONT_WEIGHT_LABELS = FONT_WEIGHT_LABELS;
1113
+ exports.LATIN_TO_DEVANAGARI = LATIN_TO_DEVANAGARI;
1885
1114
  exports.doesVariantSupportChar = doesVariantSupportChar;
1115
+ exports.embedFont = embedFont;
1886
1116
  exports.embedFontWithGoogleFallback = embedFontWithGoogleFallback;
1117
+ exports.fetchFontshareTTF = fetchFontshareTTF;
1118
+ exports.fetchGoogleFontTTF = fetchGoogleFontTTF;
1887
1119
  exports.getEmbeddedJsPDFFontName = getEmbeddedJsPDFFontName;
1888
1120
  exports.getEmbeddedVariantsList = getEmbeddedVariantsList;
1121
+ exports.getFontshareFontBytes = getFontshareFontBytes;
1122
+ exports.getGoogleFontBytes = getGoogleFontBytes;
1123
+ exports.getJsPDFFontName = getJsPDFFontName;
1889
1124
  exports.isFamilyEmbedded = isFamilyEmbedded;
1890
1125
  exports.isFontAvailable = isFontAvailable;
1891
- exports.pdfFonts = pdfFonts;
1126
+ exports.isVariantEmbedded = isVariantEmbedded;
1892
1127
  exports.resetPdfFontRegistry = resetPdfFontRegistry;
1893
1128
  exports.resolveBestRegisteredVariant = resolveBestRegisteredVariant;
1129
+ exports.resolveDevanagariSibling = resolveDevanagariSibling;
1894
1130
  exports.resolveFontWeight = resolveFontWeight;
1895
- exports.svgTextToPath = svgTextToPath;
1896
- //# sourceMappingURL=svgTextToPath-7fhL08qs.cjs.map
1131
+ //# sourceMappingURL=pdfFonts-BTEVnYX8.cjs.map