@pixldocs/canvas-renderer 0.5.132 → 0.5.133
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.
- package/dist/{index-4IzWx9f-.cjs → index-D5rY5lp8.cjs} +42 -13
- package/dist/index-D5rY5lp8.cjs.map +1 -0
- package/dist/{index-TWLUgM18.js → index-DMkFzgNL.js} +42 -13
- package/dist/index-DMkFzgNL.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/{pdfFonts-Cr8l-y3z.cjs → pdfFonts-BU2Lqz_O.cjs} +36 -11
- package/dist/{pdfFonts-Cr8l-y3z.cjs.map → pdfFonts-BU2Lqz_O.cjs.map} +1 -1
- package/dist/{pdfFonts-Y49FLHuG.js → pdfFonts-BVHbPFEz.js} +36 -11
- package/dist/{pdfFonts-Y49FLHuG.js.map → pdfFonts-BVHbPFEz.js.map} +1 -1
- package/dist/{svgTextToPath-Bne0QyE7.js → svgTextToPath-DG7rcbDE.js} +2 -2
- package/dist/{svgTextToPath-Bne0QyE7.js.map → svgTextToPath-DG7rcbDE.js.map} +1 -1
- package/dist/{svgTextToPath-D6xJoPO2.cjs → svgTextToPath-GeR0CexD.cjs} +2 -2
- package/dist/{svgTextToPath-D6xJoPO2.cjs.map → svgTextToPath-GeR0CexD.cjs.map} +1 -1
- package/dist/{vectorPdfExport-3QFNDStb.js → vectorPdfExport-BQO8W14A.js} +8 -31
- package/dist/vectorPdfExport-BQO8W14A.js.map +1 -0
- package/dist/{vectorPdfExport-BmqYmqUF.cjs → vectorPdfExport-DCNpWd6K.cjs} +8 -31
- package/dist/vectorPdfExport-DCNpWd6K.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/index-4IzWx9f-.cjs.map +0 -1
- package/dist/index-TWLUgM18.js.map +0 -1
- package/dist/vectorPdfExport-3QFNDStb.js.map +0 -1
- package/dist/vectorPdfExport-BmqYmqUF.cjs.map +0 -1
|
@@ -5730,7 +5730,8 @@ function applyTextBackground(obj, cfg) {
|
|
|
5730
5730
|
const dataAttrs = `data-blur="${blur.toFixed(3)}" data-ox="${ox.toFixed(3)}" data-oy="${oy.toFixed(3)}" data-bx="${bx.toFixed(3)}" data-by="${by.toFixed(3)}" data-bw="${bw.toFixed(3)}" data-bh="${bh.toFixed(3)}" data-color="${escapeXmlAttr(shadowColor)}"`;
|
|
5731
5731
|
const wrapShadow = (markup) => blur <= 0 ? `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${markup}</g>` : `<g class="__pdShadowRaster" ${dataAttrs}>${markup}</g>`;
|
|
5732
5732
|
if (hasBg && (bg == null ? void 0 : bg.shadowAffectsBg) !== false) {
|
|
5733
|
-
const
|
|
5733
|
+
const shadowOpacityAttr = bgOpacity < 1 ? ` fill-opacity="${bgOpacity}"` : "";
|
|
5734
|
+
const shadowBgPath = `<path d="${bgD}" fill="${escapeXmlAttr(shadowColor)}"${shadowOpacityAttr} />`;
|
|
5734
5735
|
bgShadowMarker = wrapShadow(shadowBgPath);
|
|
5735
5736
|
}
|
|
5736
5737
|
if ((bg == null ? void 0 : bg.shadowAffectsText) !== false) {
|
|
@@ -14031,7 +14032,8 @@ async function fetchGoogleFontTTF(fontFamily, weight, isItalic = false) {
|
|
|
14031
14032
|
async function fetchFontshareTTF(fontFamily, weight, isItalic = false) {
|
|
14032
14033
|
const cacheKey = `fs:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
|
|
14033
14034
|
if (ttfCache.has(cacheKey)) return ttfCache.get(cacheKey);
|
|
14034
|
-
|
|
14035
|
+
const notFoundKey = remoteVariantKey(fontFamily, weight, isItalic);
|
|
14036
|
+
if (fontshareNotFound.has(notFoundKey)) return null;
|
|
14035
14037
|
const slug = fontFamily.trim().toLowerCase().replace(/\s+/g, "-");
|
|
14036
14038
|
const proxyBytes = await fetchTtfViaProxy(fontFamily, weight, isItalic, "fontshare");
|
|
14037
14039
|
if (proxyBytes) {
|
|
@@ -14044,13 +14046,13 @@ async function fetchFontshareTTF(fontFamily, weight, isItalic = false) {
|
|
|
14044
14046
|
const cssUrl = `https://api.fontshare.com/v2/css?f[]=${slug}@${weight}${styleSuffix}&display=swap`;
|
|
14045
14047
|
const cssRes = await fetch(cssUrl);
|
|
14046
14048
|
if (!cssRes.ok) {
|
|
14047
|
-
if (cssRes.status === 400 || cssRes.status === 404) fontshareNotFound.add(
|
|
14049
|
+
if (cssRes.status === 400 || cssRes.status === 404) fontshareNotFound.add(notFoundKey);
|
|
14048
14050
|
return null;
|
|
14049
14051
|
}
|
|
14050
14052
|
const css = await cssRes.text();
|
|
14051
14053
|
const ttMatch = css.match(/url\(([^)]+)\)\s+format\(['"]?truetype['"]?\)/i);
|
|
14052
14054
|
if (!ttMatch) {
|
|
14053
|
-
fontshareNotFound.add(
|
|
14055
|
+
fontshareNotFound.add(notFoundKey);
|
|
14054
14056
|
return null;
|
|
14055
14057
|
}
|
|
14056
14058
|
let ttfUrl = ttMatch[1].replace(/['"]/g, "").trim();
|
|
@@ -14097,11 +14099,38 @@ async function embedFontWithGoogleFallback(pdf, fontName, weight = 400, fontBase
|
|
|
14097
14099
|
if (ok) return true;
|
|
14098
14100
|
}
|
|
14099
14101
|
const resolved = resolveFontWeight(weight);
|
|
14100
|
-
const
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14102
|
+
const weightLadder = [resolved];
|
|
14103
|
+
for (const w of [400, 500, 700, 600, 300]) {
|
|
14104
|
+
if (!weightLadder.includes(w)) weightLadder.push(w);
|
|
14105
|
+
}
|
|
14106
|
+
const tryFetch = async (w, italic) => {
|
|
14107
|
+
const fs = await fetchFontshareTTF(fontName, w, italic);
|
|
14108
|
+
if (fs) return fs;
|
|
14109
|
+
const g = await fetchGoogleFontTTF(fontName, w, italic);
|
|
14110
|
+
return g;
|
|
14111
|
+
};
|
|
14112
|
+
let b64 = null;
|
|
14113
|
+
let usedItalic = isItalic;
|
|
14114
|
+
let usedWeight = resolved;
|
|
14115
|
+
for (const w of weightLadder) {
|
|
14116
|
+
b64 = await tryFetch(w, isItalic);
|
|
14117
|
+
if (b64) {
|
|
14118
|
+
usedWeight = w;
|
|
14119
|
+
break;
|
|
14120
|
+
}
|
|
14121
|
+
}
|
|
14122
|
+
if (!b64 && isItalic) {
|
|
14123
|
+
for (const w of weightLadder) {
|
|
14124
|
+
b64 = await tryFetch(w, false);
|
|
14125
|
+
if (b64) {
|
|
14126
|
+
usedItalic = false;
|
|
14127
|
+
usedWeight = w;
|
|
14128
|
+
break;
|
|
14129
|
+
}
|
|
14130
|
+
}
|
|
14131
|
+
}
|
|
14132
|
+
if (!b64) return false;
|
|
14133
|
+
return registerJsPdfFont(pdf, fontName, usedWeight, usedItalic, b64);
|
|
14105
14134
|
}
|
|
14106
14135
|
async function embedFontsForConfig(pdf, config, fontBaseUrl) {
|
|
14107
14136
|
const fontKeys = /* @__PURE__ */ new Set();
|
|
@@ -16203,7 +16232,7 @@ class PixldocsRenderer {
|
|
|
16203
16232
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16204
16233
|
}
|
|
16205
16234
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16206
|
-
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
16235
|
+
const { exportMultiPagePdf, preparePagesForExport } = await Promise.resolve().then(() => require("./vectorPdfExport-DCNpWd6K.cjs"));
|
|
16207
16236
|
const prepared = preparePagesForExport(
|
|
16208
16237
|
cloned.pages,
|
|
16209
16238
|
canvasWidth,
|
|
@@ -18196,7 +18225,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18196
18225
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18197
18226
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18198
18227
|
try {
|
|
18199
|
-
const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-
|
|
18228
|
+
const { bakeTextAnchorPositionsFromLiveSvg } = await Promise.resolve().then(() => require("./vectorPdfExport-DCNpWd6K.cjs"));
|
|
18200
18229
|
await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
|
|
18201
18230
|
} catch (e) {
|
|
18202
18231
|
console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
|
|
@@ -18327,7 +18356,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
18327
18356
|
}
|
|
18328
18357
|
if (shouldOutlineText) {
|
|
18329
18358
|
try {
|
|
18330
|
-
const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-
|
|
18359
|
+
const { convertAllTextToPath } = await Promise.resolve().then(() => require("./svgTextToPath-GeR0CexD.cjs"));
|
|
18331
18360
|
pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl, { mode: outlineSubMode });
|
|
18332
18361
|
try {
|
|
18333
18362
|
dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
|
|
@@ -18538,4 +18567,4 @@ exports.setAutoShrinkDebug = setAutoShrinkDebug;
|
|
|
18538
18567
|
exports.setBundledAssetPrefixes = setBundledAssetPrefixes;
|
|
18539
18568
|
exports.warmResolvedTemplateForPreview = warmResolvedTemplateForPreview;
|
|
18540
18569
|
exports.warmTemplateFromForm = warmTemplateFromForm;
|
|
18541
|
-
//# sourceMappingURL=index-
|
|
18570
|
+
//# sourceMappingURL=index-D5rY5lp8.cjs.map
|