@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
|
@@ -5712,7 +5712,8 @@ function applyTextBackground(obj, cfg) {
|
|
|
5712
5712
|
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)}"`;
|
|
5713
5713
|
const wrapShadow = (markup) => blur <= 0 ? `<g transform="translate(${ox.toFixed(3)} ${oy.toFixed(3)})">${markup}</g>` : `<g class="__pdShadowRaster" ${dataAttrs}>${markup}</g>`;
|
|
5714
5714
|
if (hasBg && (bg == null ? void 0 : bg.shadowAffectsBg) !== false) {
|
|
5715
|
-
const
|
|
5715
|
+
const shadowOpacityAttr = bgOpacity < 1 ? ` fill-opacity="${bgOpacity}"` : "";
|
|
5716
|
+
const shadowBgPath = `<path d="${bgD}" fill="${escapeXmlAttr(shadowColor)}"${shadowOpacityAttr} />`;
|
|
5716
5717
|
bgShadowMarker = wrapShadow(shadowBgPath);
|
|
5717
5718
|
}
|
|
5718
5719
|
if ((bg == null ? void 0 : bg.shadowAffectsText) !== false) {
|
|
@@ -14013,7 +14014,8 @@ async function fetchGoogleFontTTF(fontFamily, weight, isItalic = false) {
|
|
|
14013
14014
|
async function fetchFontshareTTF(fontFamily, weight, isItalic = false) {
|
|
14014
14015
|
const cacheKey = `fs:${fontFamily}:${weight}:${isItalic ? "i" : "n"}`;
|
|
14015
14016
|
if (ttfCache.has(cacheKey)) return ttfCache.get(cacheKey);
|
|
14016
|
-
|
|
14017
|
+
const notFoundKey = remoteVariantKey(fontFamily, weight, isItalic);
|
|
14018
|
+
if (fontshareNotFound.has(notFoundKey)) return null;
|
|
14017
14019
|
const slug = fontFamily.trim().toLowerCase().replace(/\s+/g, "-");
|
|
14018
14020
|
const proxyBytes = await fetchTtfViaProxy(fontFamily, weight, isItalic, "fontshare");
|
|
14019
14021
|
if (proxyBytes) {
|
|
@@ -14026,13 +14028,13 @@ async function fetchFontshareTTF(fontFamily, weight, isItalic = false) {
|
|
|
14026
14028
|
const cssUrl = `https://api.fontshare.com/v2/css?f[]=${slug}@${weight}${styleSuffix}&display=swap`;
|
|
14027
14029
|
const cssRes = await fetch(cssUrl);
|
|
14028
14030
|
if (!cssRes.ok) {
|
|
14029
|
-
if (cssRes.status === 400 || cssRes.status === 404) fontshareNotFound.add(
|
|
14031
|
+
if (cssRes.status === 400 || cssRes.status === 404) fontshareNotFound.add(notFoundKey);
|
|
14030
14032
|
return null;
|
|
14031
14033
|
}
|
|
14032
14034
|
const css = await cssRes.text();
|
|
14033
14035
|
const ttMatch = css.match(/url\(([^)]+)\)\s+format\(['"]?truetype['"]?\)/i);
|
|
14034
14036
|
if (!ttMatch) {
|
|
14035
|
-
fontshareNotFound.add(
|
|
14037
|
+
fontshareNotFound.add(notFoundKey);
|
|
14036
14038
|
return null;
|
|
14037
14039
|
}
|
|
14038
14040
|
let ttfUrl = ttMatch[1].replace(/['"]/g, "").trim();
|
|
@@ -14079,11 +14081,38 @@ async function embedFontWithGoogleFallback(pdf, fontName, weight = 400, fontBase
|
|
|
14079
14081
|
if (ok) return true;
|
|
14080
14082
|
}
|
|
14081
14083
|
const resolved = resolveFontWeight(weight);
|
|
14082
|
-
const
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
|
|
14086
|
-
|
|
14084
|
+
const weightLadder = [resolved];
|
|
14085
|
+
for (const w of [400, 500, 700, 600, 300]) {
|
|
14086
|
+
if (!weightLadder.includes(w)) weightLadder.push(w);
|
|
14087
|
+
}
|
|
14088
|
+
const tryFetch = async (w, italic) => {
|
|
14089
|
+
const fs = await fetchFontshareTTF(fontName, w, italic);
|
|
14090
|
+
if (fs) return fs;
|
|
14091
|
+
const g = await fetchGoogleFontTTF(fontName, w, italic);
|
|
14092
|
+
return g;
|
|
14093
|
+
};
|
|
14094
|
+
let b64 = null;
|
|
14095
|
+
let usedItalic = isItalic;
|
|
14096
|
+
let usedWeight = resolved;
|
|
14097
|
+
for (const w of weightLadder) {
|
|
14098
|
+
b64 = await tryFetch(w, isItalic);
|
|
14099
|
+
if (b64) {
|
|
14100
|
+
usedWeight = w;
|
|
14101
|
+
break;
|
|
14102
|
+
}
|
|
14103
|
+
}
|
|
14104
|
+
if (!b64 && isItalic) {
|
|
14105
|
+
for (const w of weightLadder) {
|
|
14106
|
+
b64 = await tryFetch(w, false);
|
|
14107
|
+
if (b64) {
|
|
14108
|
+
usedItalic = false;
|
|
14109
|
+
usedWeight = w;
|
|
14110
|
+
break;
|
|
14111
|
+
}
|
|
14112
|
+
}
|
|
14113
|
+
}
|
|
14114
|
+
if (!b64) return false;
|
|
14115
|
+
return registerJsPdfFont(pdf, fontName, usedWeight, usedItalic, b64);
|
|
14087
14116
|
}
|
|
14088
14117
|
async function embedFontsForConfig(pdf, config, fontBaseUrl) {
|
|
14089
14118
|
const fontKeys = /* @__PURE__ */ new Set();
|
|
@@ -16185,7 +16214,7 @@ class PixldocsRenderer {
|
|
|
16185
16214
|
await this.waitForCanvasScene(container, cloned, i);
|
|
16186
16215
|
}
|
|
16187
16216
|
console.log(`[canvas-renderer][pdf-unified] mounted ${cloned.pages.length} page(s), handing off to client exportMultiPagePdf`);
|
|
16188
|
-
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-
|
|
16217
|
+
const { exportMultiPagePdf, preparePagesForExport } = await import("./vectorPdfExport-BQO8W14A.js");
|
|
16189
16218
|
const prepared = preparePagesForExport(
|
|
16190
16219
|
cloned.pages,
|
|
16191
16220
|
canvasWidth,
|
|
@@ -18178,7 +18207,7 @@ async function prepareLiveCanvasSvgForPdf(rawSvg, pageWidth, pageHeight, pageKey
|
|
|
18178
18207
|
if (options == null ? void 0 : options.stripPageBackground) stripRootPageBackgroundFromSvg(svgToDraw);
|
|
18179
18208
|
sanitizeSvgTreeForPdf(svgToDraw);
|
|
18180
18209
|
try {
|
|
18181
|
-
const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-
|
|
18210
|
+
const { bakeTextAnchorPositionsFromLiveSvg } = await import("./vectorPdfExport-BQO8W14A.js");
|
|
18182
18211
|
await bakeTextAnchorPositionsFromLiveSvg(svgToDraw);
|
|
18183
18212
|
} catch (e) {
|
|
18184
18213
|
console.warn("[canvas-renderer][pdf-export] anchor-bake pass failed (continuing):", e);
|
|
@@ -18309,7 +18338,7 @@ async function assemblePdfFromSvgs(svgResults, options = {}) {
|
|
|
18309
18338
|
}
|
|
18310
18339
|
if (shouldOutlineText) {
|
|
18311
18340
|
try {
|
|
18312
|
-
const { convertAllTextToPath } = await import("./svgTextToPath-
|
|
18341
|
+
const { convertAllTextToPath } = await import("./svgTextToPath-DG7rcbDE.js");
|
|
18313
18342
|
pageSvg = await convertAllTextToPath(pageSvg, fontBaseUrl, { mode: outlineSubMode });
|
|
18314
18343
|
try {
|
|
18315
18344
|
dumpSvgTextDiagnostics(pageSvg, i, PARITY_TAG, "STAGE-1b-after-text-to-path-raw");
|
|
@@ -18523,4 +18552,4 @@ export {
|
|
|
18523
18552
|
collectFontDescriptorsFromConfig as y,
|
|
18524
18553
|
collectFontsFromConfig as z
|
|
18525
18554
|
};
|
|
18526
|
-
//# sourceMappingURL=index-
|
|
18555
|
+
//# sourceMappingURL=index-DMkFzgNL.js.map
|