ooxml-ui 1.52.0 → 1.52.1
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/building-block-styles.d.ts +0 -1
- package/dist/chart/data-sheet-labels.d.ts +0 -1
- package/dist/chart/data-sheet.d.ts +1 -2
- package/dist/chart/format-pane-3d.d.ts +0 -1
- package/dist/chart/format-pane-advanced-intent.d.ts +0 -1
- package/dist/chart/format-pane-advanced-space.d.ts +0 -1
- package/dist/chart/format-pane-analysis.d.ts +0 -1
- package/dist/chart/format-pane-axis.d.ts +0 -1
- package/dist/chart/format-pane-common.d.ts +0 -1
- package/dist/chart/format-pane-effects.d.ts +0 -1
- package/dist/chart/format-pane-fill-kinds.d.ts +0 -1
- package/dist/chart/format-pane-intent.d.ts +0 -1
- package/dist/chart/format-pane-locales/de.d.ts +0 -1
- package/dist/chart/format-pane-locales/es.d.ts +0 -1
- package/dist/chart/format-pane-locales/fr.d.ts +0 -1
- package/dist/chart/format-pane-locales/ja.d.ts +0 -1
- package/dist/chart/format-pane-locales/ko.d.ts +0 -1
- package/dist/chart/format-pane-locales/zh-CN.d.ts +0 -1
- package/dist/chart/format-pane-options.d.ts +0 -1
- package/dist/chart/format-pane-types.d.ts +0 -1
- package/dist/chart/gallery-tiles.d.ts +0 -1
- package/dist/chrome/account-profile.d.ts +0 -1
- package/dist/chrome/account.d.ts +1 -2
- package/dist/chrome/find-bar.d.ts +1 -2
- package/dist/chrome/format-section.d.ts +1 -2
- package/dist/chrome/print-preview.d.ts +1 -2
- package/dist/chrome/status-bar.d.ts +1 -2
- package/dist/chrome/status-item.d.ts +1 -2
- package/dist/chrome/tab-drag.d.ts +0 -1
- package/dist/chrome/task-pane.d.ts +1 -2
- package/dist/chrome/title-bar-types.d.ts +0 -1
- package/dist/{chunk-ALWA7Q42.js → chunk-ELVHRXWE.js} +1 -1
- package/dist/comments/types.d.ts +0 -1
- package/dist/controls.d.ts +0 -1
- package/dist/dialog/chart-picker.d.ts +1 -2
- package/dist/dialog/dialog-footer.d.ts +1 -2
- package/dist/dialog/dialog-session.d.ts +0 -1
- package/dist/dialog/dialog.d.ts +1 -2
- package/dist/dialog/focus.d.ts +0 -1
- package/dist/dialog/message-dialog.d.ts +1 -2
- package/dist/dialog/message-dialogs.d.ts +0 -1
- package/dist/dialog/options-categories.d.ts +0 -1
- package/dist/dialog/options-controls.d.ts +0 -1
- package/dist/dialog/options-dialog.d.ts +1 -2
- package/dist/dialog/share-dialog-locales.d.ts +0 -1
- package/dist/dialog/share-dialog.d.ts +1 -2
- package/dist/embedding/region-host.d.ts +0 -1
- package/dist/export/pdf-cid-font.d.ts +35 -0
- package/dist/export/pdf-cid-font.d.ts.map +1 -0
- package/dist/export/pdf-embedded-font.d.ts +10 -16
- package/dist/export/pdf-embedded-font.d.ts.map +1 -1
- package/dist/export/pdf-font-faces.d.ts +0 -1
- package/dist/export/pdf-svg-gradient.d.ts +0 -1
- package/dist/export/pdf-svg-text.d.ts +0 -1
- package/dist/export/pdf-text-layer-font.d.ts +13 -0
- package/dist/export/pdf-text-layer-font.d.ts.map +1 -0
- package/dist/export/pdf-vector.d.ts +3 -3
- package/dist/export/pdf-vector.d.ts.map +1 -1
- package/dist/files/cloud-files-view.d.ts +0 -1
- package/dist/files/cloud-files.d.ts +1 -2
- package/dist/files/open-places.d.ts +1 -2
- package/dist/files/save-progress-label.d.ts +0 -1
- package/dist/fonts/availability.d.ts +0 -1
- package/dist/fonts/catalog.d.ts +0 -1
- package/dist/fonts/custom-fonts.d.ts +0 -1
- package/dist/fonts/webfonts.d.ts +0 -1
- package/dist/form/checkbox.d.ts +1 -2
- package/dist/form/color-custom.d.ts +1 -2
- package/dist/form/color-grid.d.ts +1 -2
- package/dist/form/color-input/live-color-input.d.ts +0 -1
- package/dist/form/color-input/live-color-leaves.d.ts +0 -1
- package/dist/form/color-swatches.d.ts +0 -1
- package/dist/form/radio.d.ts +1 -2
- package/dist/form/range-control.d.ts +0 -1
- package/dist/form/search-field.d.ts +1 -2
- package/dist/form/select.d.ts +1 -2
- package/dist/form/symbol-picker.d.ts +1 -2
- package/dist/form/zoom-slider.d.ts +1 -2
- package/dist/glyph.d.ts +0 -1
- package/dist/icon.d.ts +0 -1
- package/dist/icons.d.ts +0 -1
- package/dist/index.js +2 -2
- package/dist/keytips.d.ts +0 -1
- package/dist/menu/command-search.d.ts +1 -2
- package/dist/menu/context-menu.d.ts +1 -2
- package/dist/menu/menu-item.d.ts +1 -2
- package/dist/menu/menu-separator.d.ts +1 -2
- package/dist/notices/paste-options.d.ts +1 -2
- package/dist/notices/read-only-banner.d.ts +1 -2
- package/dist/picture-artistic-filters.d.ts +0 -1
- package/dist/picture-artistic-preview.d.ts +0 -1
- package/dist/picture-effects.d.ts +0 -1
- package/dist/picture-pixels.d.ts +0 -1
- package/dist/picture-standard-filter.d.ts +0 -1
- package/dist/pptx/{chunk-5454QDUH.mjs → chunk-4K4DO7RJ.mjs} +1 -0
- package/dist/pptx/{chunk-NGOH4ENE.mjs → chunk-FQGG3DGL.mjs} +1 -1
- package/dist/pptx/{chunk-WKKLVLLP.cjs → chunk-JVCSVLFU.cjs} +1 -0
- package/dist/pptx/{chunk-7ZRVQFQN.cjs → chunk-OATLMHQL.cjs} +42 -42
- package/dist/pptx/{chunk-KCIIXE4D.mjs → chunk-OFXOF5ZX.mjs} +277 -175
- package/dist/pptx/{chunk-SC4VATDY.cjs → chunk-SWJV6FQN.cjs} +280 -178
- package/dist/pptx/dom/index.cjs +377 -377
- package/dist/pptx/dom/index.mjs +6 -6
- package/dist/pptx/export/pdf-export-diagnostics.d.ts +1 -1
- package/dist/pptx/export/pdf-export-diagnostics.d.ts.map +1 -1
- package/dist/pptx/export/pdf-vector-collect.d.ts.map +1 -1
- package/dist/pptx/export/pdf-vector-export.d.ts.map +1 -1
- package/dist/pptx/export/pdf-vector-media.d.ts +11 -0
- package/dist/pptx/export/pdf-vector-media.d.ts.map +1 -0
- package/dist/pptx/export/pdf-vector-paint.d.ts +5 -1
- package/dist/pptx/export/pdf-vector-paint.d.ts.map +1 -1
- package/dist/pptx/export/pdf-vector-text.d.ts.map +1 -1
- package/dist/pptx/i18n/index.cjs +6 -6
- package/dist/pptx/i18n/index.mjs +1 -1
- package/dist/pptx/i18n/translations-en-pdf-export.d.ts.map +1 -1
- package/dist/pptx/index.cjs +3270 -3270
- package/dist/pptx/index.mjs +2 -2
- package/dist/pptx/{smartart-insert-preview-MMCWPA26.cjs → smartart-insert-preview-BYPU325G.cjs} +4 -4
- package/dist/pptx/{smartart-insert-preview-H2LZCTYG.mjs → smartart-insert-preview-DF6KSG3D.mjs} +3 -3
- package/dist/presence/presence.d.ts +1 -2
- package/dist/presence.d.ts +0 -1
- package/dist/recovery-scheduler.d.ts +0 -1
- package/dist/render-cache.d.ts +0 -1
- package/dist/ribbon/auto-collapse.d.ts +0 -1
- package/dist/ribbon/button.d.ts +1 -2
- package/dist/ribbon/color-preview.d.ts +0 -1
- package/dist/ribbon/gallery-styles.d.ts +0 -1
- package/dist/ribbon/gallery.d.ts +1 -2
- package/dist/ribbon/group-overflow.d.ts +0 -1
- package/dist/ribbon/keytip-run.d.ts +0 -1
- package/dist/ribbon/overflow.d.ts +0 -1
- package/dist/ribbon/ribbon-group.d.ts +1 -2
- package/dist/ribbon/ribbon-stack.d.ts +1 -2
- package/dist/ribbon/ribbon-toggle.d.ts +1 -2
- package/dist/ribbon/safe-svg.d.ts +0 -1
- package/dist/ribbon/scroll-more.d.ts +0 -1
- package/dist/ribbon/svg-preview.d.ts +0 -1
- package/dist/smartart/smartart-picker.d.ts +1 -2
- package/dist/smartart/smartart-text-pane-tools.d.ts +0 -1
- package/dist/smartart/smartart-text-pane.d.ts +1 -2
- package/dist/styles.d.ts +0 -1
- package/dist/teams.js +1 -1
- package/dist/theme.d.ts +0 -1
- package/dist/visio.js +92 -28
- package/dist/xlsx.js +3 -3
- package/package.json +2 -2
- /package/dist/{chunk-JNCHVQQA.js → chunk-2N6QBIKM.js} +0 -0
|
@@ -22,7 +22,7 @@ import { A4_PORTRAIT } from './chunk-WHUMPYEM.mjs';
|
|
|
22
22
|
import { escapeHtml } from './chunk-IEAO7N4E.mjs';
|
|
23
23
|
import { TOUCH, tok, OFFICE_TOKENS, installOfficeUiTheme, withOfficeThemeCss, installOfficeUiThemeFor, LEGACY_OFFICE_THEME_TOKENS, legacyThemeBridge, GALLERY_THEME_PRESETS, activeGalleryThemePreset } from './chunk-Q23MZFWZ.mjs';
|
|
24
24
|
import { resolveTableCellImageUrls, resolveTextFillBlipUrls, collectMediaElements, resolveMediaElementSource } from './chunk-AEQGGKRZ.mjs';
|
|
25
|
-
import { CHART_FORMAT_STRINGS, CHART_FORMAT_LOCALES, translationsEn } from './chunk-
|
|
25
|
+
import { CHART_FORMAT_STRINGS, CHART_FORMAT_LOCALES, translationsEn } from './chunk-4K4DO7RJ.mjs';
|
|
26
26
|
import { createControllerStore } from './chunk-PM2SOLK3.mjs';
|
|
27
27
|
import { updateTextSegmentStyle } from './chunk-PEDGPFLR.mjs';
|
|
28
28
|
import { html, LitElement, nothing, render, unsafeCSS, svg } from 'lit';
|
|
@@ -37,7 +37,7 @@ export { buildImageBiLevelTable, buildImageLuminanceTransfer } from 'ooxml-core/
|
|
|
37
37
|
import { keyed } from 'lit/directives/keyed.js';
|
|
38
38
|
import { OFFICE_STANDARD_COLORS, normalizePaletteHex, buildThemePalette, contrastTextColor, colorWithOpacity, parseHex, linearToSrgb255, srgb255ToLinear, hexToRgbChannels } from 'ooxml-core/color';
|
|
39
39
|
export { contrastTextColor, parseHex } from 'ooxml-core/color';
|
|
40
|
-
import { parseLocaleNumber, formatLocaleNumber, parseTsv, segmentByFont, resolveFontItalic, fontWeightAttribute, mayDisplayEmbeddedFont, embeddingPermission, servedGoogleFontsFamily, resolveFontWeight, namedFontVerticalMetrics, officeFontVerticalMetrics, ooxmlDateTimeFieldPicture, formatDatePicture, fontStyleShorthand, decimalSeparatorForLanguage, decimalAnchorIndex, collectWebfontFaces, selectGoogleWebfontFamilies, resolveGoogleFontsCss2Base, fontWeightShorthand, resolveGoogleFontsFace, matchGoogleWebfontFragments, buildGoogleFontsHref, hasDesignAdvances, designTextWidthEm, resolveScriptFontSet, parseTrueType, mayEmbedFontSubset, subsetTrueType, GOOGLE_FONTS_CSS2_BASE } from 'ooxml-core/text';
|
|
40
|
+
import { parseLocaleNumber, formatLocaleNumber, parseTsv, segmentByFont, resolveFontItalic, fontWeightAttribute, mayDisplayEmbeddedFont, embeddingPermission, servedGoogleFontsFamily, resolveFontWeight, namedFontVerticalMetrics, officeFontVerticalMetrics, ooxmlDateTimeFieldPicture, formatDatePicture, fontStyleShorthand, decimalSeparatorForLanguage, decimalAnchorIndex, collectWebfontFaces, selectGoogleWebfontFamilies, resolveGoogleFontsCss2Base, fontWeightShorthand, resolveGoogleFontsFace, matchGoogleWebfontFragments, buildGoogleFontsHref, hasDesignAdvances, designTextWidthEm, resolveScriptFontSet, parseTrueType, mayEmbedFontSubset, subsetTrueType, MAX_GLYPHLESS_GLYPHS, glyphlessTrueType, isEastAsianChar as isEastAsianChar$1, GOOGLE_FONTS_CSS2_BASE } from 'ooxml-core/text';
|
|
41
41
|
export { GOOGLE_FONTS_CSS2_BASE, GOOGLE_WEBFONT_AXIS, buildGoogleFontsFragment, buildGoogleFontsHref, buildLeaderString, detectFontScript, findGoogleFontsFamily, findMetricCompatibleGoogleFontsFamily, fontStyleShorthand, fontWeightAttribute, fontWeightShorthand, getLeaderCharacter, getLeaderStyles, hasDistinctScriptFonts, normalizeGoogleFontsBaseUrl, parseFontWeightName, resolveFontForScript, resolveFontItalic, resolveFontWeight, resolveGoogleFontsCss2Base, resolveGoogleFontsFace, resolveScriptFontSet, segmentByScript, selectGoogleWebfontFamilies } from 'ooxml-core/text';
|
|
42
42
|
import { addSmartArtNode, addSmartArtNodeBefore, addSmartArtNodeAbove, addSmartArtNodeAsChild, evaluatePresetShape, flattenNodes, updateMergeAttrsInRawXml, chartDataToSheet, chartDataApplySheetEdits, chartModelLabelPositions, chartSupportsSecondaryAxis, isChartSeriesOnSecondaryAxis, readChartElementFormat, setSmartArtNodeStyle, updateSmartArtNodeText, THEME_COLOR_SCHEME_KEYS, parseChartFormatTargetKey, withChartSeriesOnSecondaryAxis, withChartSeriesOptions, withChartAxisOptions, withChartLegendOptions, withChartDataLabelOptions, withChartElementFormat, reflowSmartArtPictures, applySmartArtQuickStyle3d, reorderSmartArtNode, demoteSmartArtNode, promoteSmartArtNode, removeSmartArtNode, createChartElement, interpretSmartArtLayout, styleStroke, strokeFor, nodeTextStyle, fitFontSize, truncate, nodeOpacity, nodeStroke, nodeFill, styleShadow, gearPoints, buildTree, treeWidth, treeDepth, MIN_ELEMENT_SIZE, makeStoreAwareId, hasShapeProperties, getElementTextContent, hasTextProperties, isImageLikeElement, applyDrawingColorTransforms as applyDrawingColorTransforms$1, hslToRgb as hslToRgb$1, PRESET_COLOR_MAP, getSubstituteFontFamily, evaluateGuides, deobfuscateFont, chartDataChangeType, resetChartElementFormat, isNativeAfterAnimationOnly, resolveThemeColorRef, resolveOoxmlPresetMapping, getCapturedPreset, resolveDirectionSubtype, capturedPresetNativeAnimation, timingCurveToAccelDecel, applyAfterAnimationFromEditorList, parsePanoseString, EMU_PER_PX as EMU_PER_PX$1, DEFAULT_POWERPOINT_TABLE_STYLE_ID, DEFAULT_SCHEME_COLOR_MAP as DEFAULT_SCHEME_COLOR_MAP$1, ELEMENT_PARAGRAPH_GEOMETRY_KEYS, createAutoNumberSequence, nextAutoNumber, breakAutoNumberRun, getLinkedTextBoxSegments, deriveSlideTitle, svgPathToPolygons, createBuiltinVariables, resolveCoordinate, getPresetConnectionSites, getConnectorPathGeometry, getShapeType, detectFontFormat, getPptxLoadLimitViolation, createEditorId, reassignDescendantIds, checkMissingAltText, checkMissingSlideTitle, checkLowContrast, checkComplexTables, checkBlankSlide, checkDuplicateTitles, rebaseCommentMentions, resolveModifyVerifierAlgorithmName, inspectSignaturesFromBuffer, renameSlideMaster, deleteSlideMaster, duplicateSlideMaster, insertSlideMaster, renameLayout, deleteLayout, duplicateLayout, insertLayout, switchSmartArtLayout, buildThemeColorMap, verifyModifyPassword, evaluateCustomGeometryPaths, cloneElement, SLIDE_PACKAGE_CLIPBOARD_MIME, deserializeSlidePackageClipboard, importSlidePackage, PptxHandler, createSlideClipboardPackage, serializeSlidePackageClipboard, serializePptxToJson, PPTX_JSON_MIME_TYPE, douglasPeucker, resolveEffectTiming, lookupPresetShape, normalizeStShapeType, resolveCustomGeometryGuideContext, smartArtQuickStyleHas3d, relayoutSmartArt, customGeometryPathsToSvgSubpaths, BACKGROUND_STYLE_PRESETS, THEME_EFFECT_SCHEMES, findThemeEffectSchemeByName, SWITCHABLE_LAYOUT_TYPES, reResolveSlideFonts, reResolveSlideColors, reResolveElementColors, reResolveElementFonts, resolveOpacitySet, resolveTableBackgroundFillRef, resolveTableBackgroundEffectRef, getRoundRectRadiusPx, resolveCustomGeometryToken, formatSchemeKey, cropShapeForPresetGeometry, resolveVisibilitySetTiming, resolveTableStyleLineRef, backgroundStylePreset, ooxmlGradientAngleToCssDegrees, themeColorRefFromColorChoice } from 'ooxml-core/pptx';
|
|
43
43
|
export { AFTER_ANIMATION_VALUES, DEFAULT_AFTER_ANIMATION_DIM_COLOR, algorithmParam, applySpeedToDuration, buildTree, chartGridAddCategory, chartGridAddSeries, chartGridRemoveCategory, chartGridRemoveSeries, chartGridSetCategoryLabel, chartGridSetCellValue, chevronPoints, colour, discoverArrangement, findConstraint, fitFontSize, flattenNodes, gearPoints, getAfterAnimation, getAfterAnimationState, interpretSmartArtLayout, isNativeAfterAnimationOnly, itemNode, nodeFill, nodeOpacity, nodeStroke, nodeTextStyle, numericParam, ratioConstraint, reassignDescendantIds, resolveEffectTiming, resolveFlowDirection, resolveIterationCount, setAfterAnimation, setAfterAnimationColor, shouldHoldEndState, strokeFor, styleShadow, styleStroke, treeDepth, treeWidth, truncate } from 'ooxml-core/pptx';
|
|
@@ -92914,7 +92914,7 @@ function definePptxInsertSmartArtDialog(registry2) {
|
|
|
92914
92914
|
if (this.#live || this.#draw) {
|
|
92915
92915
|
return;
|
|
92916
92916
|
}
|
|
92917
|
-
this.#live = import('./smartart-insert-preview-
|
|
92917
|
+
this.#live = import('./smartart-insert-preview-DF6KSG3D.mjs').then((module) => {
|
|
92918
92918
|
if (this.#draw || !this.#picker) {
|
|
92919
92919
|
return;
|
|
92920
92920
|
}
|
|
@@ -99518,6 +99518,88 @@ async function collectLocalFontFiles(doc) {
|
|
|
99518
99518
|
}
|
|
99519
99519
|
return files;
|
|
99520
99520
|
}
|
|
99521
|
+
|
|
99522
|
+
// src/export/pdf-cid-font.ts
|
|
99523
|
+
var hex4 = (value) => value.toString(16).padStart(4, "0");
|
|
99524
|
+
var utf16 = (code) => {
|
|
99525
|
+
if (code < 65536) return hex4(code);
|
|
99526
|
+
const v = code - 65536;
|
|
99527
|
+
return hex4(55296 + (v >> 10)) + hex4(56320 + (v & 1023));
|
|
99528
|
+
};
|
|
99529
|
+
function toUnicodeCMap(codes) {
|
|
99530
|
+
const lines = [
|
|
99531
|
+
"/CIDInit /ProcSet findresource begin",
|
|
99532
|
+
"12 dict begin",
|
|
99533
|
+
"begincmap",
|
|
99534
|
+
"/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def",
|
|
99535
|
+
"/CMapName /Adobe-Identity-UCS def",
|
|
99536
|
+
"/CMapType 2 def",
|
|
99537
|
+
"1 begincodespacerange",
|
|
99538
|
+
"<0000> <FFFF>",
|
|
99539
|
+
"endcodespacerange"
|
|
99540
|
+
];
|
|
99541
|
+
for (let start = 0; start < codes.length; start += 100) {
|
|
99542
|
+
const chunk = codes.slice(start, start + 100);
|
|
99543
|
+
lines.push(`${chunk.length} beginbfchar`);
|
|
99544
|
+
chunk.forEach((code, index) => lines.push(`<${hex4(start + index + 1)}> <${utf16(code)}>`));
|
|
99545
|
+
lines.push("endbfchar");
|
|
99546
|
+
}
|
|
99547
|
+
lines.push("endcmap", "CMapName currentdict /CMap defineresource pop", "end", "end");
|
|
99548
|
+
return lines.join("\n");
|
|
99549
|
+
}
|
|
99550
|
+
var advanceOf = (char) => isEastAsianChar$1(char) ? 1e3 : 500;
|
|
99551
|
+
var PdfTextLayerFont = class {
|
|
99552
|
+
family = "TextLayer";
|
|
99553
|
+
bold = false;
|
|
99554
|
+
italic = false;
|
|
99555
|
+
#cids = /* @__PURE__ */ new Map();
|
|
99556
|
+
#codes = [];
|
|
99557
|
+
/** Advance width of `text` in em units. */
|
|
99558
|
+
width(text5) {
|
|
99559
|
+
let total = 0;
|
|
99560
|
+
for (const char of text5) total += advanceOf(char) / 1e3;
|
|
99561
|
+
return total;
|
|
99562
|
+
}
|
|
99563
|
+
/** `text` as the hex digits of 2-byte CIDs; each new character takes the next CID. */
|
|
99564
|
+
encode(text5) {
|
|
99565
|
+
let out = "";
|
|
99566
|
+
for (const char of text5) {
|
|
99567
|
+
const code = char.codePointAt(0);
|
|
99568
|
+
let cid = this.#cids.get(code);
|
|
99569
|
+
if (cid === void 0) {
|
|
99570
|
+
cid = this.#codes.length + 1 < MAX_GLYPHLESS_GLYPHS ? this.#codes.length + 1 : 0;
|
|
99571
|
+
if (cid) {
|
|
99572
|
+
this.#cids.set(code, cid);
|
|
99573
|
+
this.#codes.push(code);
|
|
99574
|
+
}
|
|
99575
|
+
}
|
|
99576
|
+
out += cid.toString(16).padStart(4, "0");
|
|
99577
|
+
}
|
|
99578
|
+
return out;
|
|
99579
|
+
}
|
|
99580
|
+
get used() {
|
|
99581
|
+
return this.#codes.length > 0;
|
|
99582
|
+
}
|
|
99583
|
+
build() {
|
|
99584
|
+
const widths = [0, ...this.#codes.map((code) => advanceOf(String.fromCodePoint(code)))];
|
|
99585
|
+
return {
|
|
99586
|
+
fontFile: glyphlessTrueType(widths),
|
|
99587
|
+
widths,
|
|
99588
|
+
toUnicode: toUnicodeCMap(this.#codes),
|
|
99589
|
+
descriptor: {
|
|
99590
|
+
flags: 4,
|
|
99591
|
+
bbox: [0, -200, 1e3, 800],
|
|
99592
|
+
italicAngle: 0,
|
|
99593
|
+
ascent: 800,
|
|
99594
|
+
descent: -200,
|
|
99595
|
+
capHeight: 700,
|
|
99596
|
+
stemV: 80
|
|
99597
|
+
}
|
|
99598
|
+
};
|
|
99599
|
+
}
|
|
99600
|
+
};
|
|
99601
|
+
|
|
99602
|
+
// src/export/pdf-embedded-font.ts
|
|
99521
99603
|
var PdfEmbeddedFont = class _PdfEmbeddedFont {
|
|
99522
99604
|
constructor(file, font) {
|
|
99523
99605
|
this.font = font;
|
|
@@ -99604,35 +99686,9 @@ var PdfEmbeddedFont = class _PdfEmbeddedFont {
|
|
|
99604
99686
|
};
|
|
99605
99687
|
}
|
|
99606
99688
|
};
|
|
99607
|
-
var hex4 = (value) => value.toString(16).padStart(4, "0");
|
|
99608
|
-
var utf16 = (code) => {
|
|
99609
|
-
if (code < 65536) return hex4(code);
|
|
99610
|
-
const v = code - 65536;
|
|
99611
|
-
return hex4(55296 + (v >> 10)) + hex4(56320 + (v & 1023));
|
|
99612
|
-
};
|
|
99613
|
-
function toUnicodeCMap(codes) {
|
|
99614
|
-
const lines = [
|
|
99615
|
-
"/CIDInit /ProcSet findresource begin",
|
|
99616
|
-
"12 dict begin",
|
|
99617
|
-
"begincmap",
|
|
99618
|
-
"/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def",
|
|
99619
|
-
"/CMapName /Adobe-Identity-UCS def",
|
|
99620
|
-
"/CMapType 2 def",
|
|
99621
|
-
"1 begincodespacerange",
|
|
99622
|
-
"<0000> <FFFF>",
|
|
99623
|
-
"endcodespacerange"
|
|
99624
|
-
];
|
|
99625
|
-
for (let start = 0; start < codes.length; start += 100) {
|
|
99626
|
-
const chunk = codes.slice(start, start + 100);
|
|
99627
|
-
lines.push(`${chunk.length} beginbfchar`);
|
|
99628
|
-
chunk.forEach((code, index) => lines.push(`<${hex4(start + index + 1)}> <${utf16(code)}>`));
|
|
99629
|
-
lines.push("endbfchar");
|
|
99630
|
-
}
|
|
99631
|
-
lines.push("endcmap", "CMapName currentdict /CMap defineresource pop", "end", "end");
|
|
99632
|
-
return lines.join("\n");
|
|
99633
|
-
}
|
|
99634
99689
|
var PdfFontSet = class {
|
|
99635
99690
|
fonts;
|
|
99691
|
+
#textLayer;
|
|
99636
99692
|
constructor(files = []) {
|
|
99637
99693
|
this.fonts = files.flatMap((file) => {
|
|
99638
99694
|
const font = PdfEmbeddedFont.create(file);
|
|
@@ -99642,6 +99698,14 @@ var PdfFontSet = class {
|
|
|
99642
99698
|
get size() {
|
|
99643
99699
|
return this.fonts.length;
|
|
99644
99700
|
}
|
|
99701
|
+
/**
|
|
99702
|
+
* The glyphless font of this document's invisible text layer, for text over a picture of it
|
|
99703
|
+
* that no supplied font can write (one font for every page, created on first use).
|
|
99704
|
+
*/
|
|
99705
|
+
get textLayer() {
|
|
99706
|
+
this.#textLayer ??= new PdfTextLayerFont();
|
|
99707
|
+
return this.#textLayer;
|
|
99708
|
+
}
|
|
99645
99709
|
/** The best font that has every character of `text`, or `undefined`. */
|
|
99646
99710
|
pick(family2, bold, italic, text5) {
|
|
99647
99711
|
const names = family2.split(",").map(
|
|
@@ -100143,7 +100207,8 @@ var PDF_PICTURE_CODES = [
|
|
|
100143
100207
|
"shadowAsPicture",
|
|
100144
100208
|
"verticalTextAsPicture",
|
|
100145
100209
|
"textColourAsPicture",
|
|
100146
|
-
"complexScriptAsPicture"
|
|
100210
|
+
"complexScriptAsPicture",
|
|
100211
|
+
"noFontTextAsPicture"
|
|
100147
100212
|
];
|
|
100148
100213
|
var PDF_SLIDE_CODES = [
|
|
100149
100214
|
"slideTooMuchText",
|
|
@@ -100713,6 +100778,21 @@ function paintBox(style, box, matrix, clips, alpha, boxShadow, collapsed = false
|
|
|
100713
100778
|
return { items, ...image ? { image } : {} };
|
|
100714
100779
|
}
|
|
100715
100780
|
|
|
100781
|
+
// src/pptx/export/pdf-vector-media.ts
|
|
100782
|
+
var HAVE_CURRENT_DATA = 2;
|
|
100783
|
+
function shownVideoPoster(video) {
|
|
100784
|
+
if (!video.getAttribute("poster")) return void 0;
|
|
100785
|
+
const noFrame = video.readyState < HAVE_CURRENT_DATA;
|
|
100786
|
+
const notStarted = video.paused && video.played.length === 0 && video.currentTime === 0;
|
|
100787
|
+
return noFrame || notStarted ? video.poster || video.getAttribute("poster") || void 0 : void 0;
|
|
100788
|
+
}
|
|
100789
|
+
async function videoPicture(doc, video) {
|
|
100790
|
+
const frame = () => drawableToPdfImage(doc, video, video.videoWidth, video.videoHeight);
|
|
100791
|
+
const poster = shownVideoPoster(video);
|
|
100792
|
+
if (!poster) return frame();
|
|
100793
|
+
return await decodePdfImage(doc, poster) ?? frame();
|
|
100794
|
+
}
|
|
100795
|
+
|
|
100716
100796
|
// src/pptx/export/pdf-vector-timeout.ts
|
|
100717
100797
|
var RASTER_TIMEOUT_MS = 2e4;
|
|
100718
100798
|
var IMAGE_TIMEOUT_MS = 15e3;
|
|
@@ -102054,6 +102134,151 @@ function externalFontCache(doc) {
|
|
|
102054
102134
|
};
|
|
102055
102135
|
}
|
|
102056
102136
|
|
|
102137
|
+
// src/pptx/export/pdf-vector-paint.ts
|
|
102138
|
+
function primaryFamily(family2) {
|
|
102139
|
+
const first = family2.split(",")[0] ?? "";
|
|
102140
|
+
return first.trim().replace(/^['"]|['"]$/g, "");
|
|
102141
|
+
}
|
|
102142
|
+
function resolvePdfTextFont(text5, family2, bold, italic, fonts) {
|
|
102143
|
+
if (fonts?.has(family2)) {
|
|
102144
|
+
const font = fonts.pick(family2, bold, italic, text5);
|
|
102145
|
+
if (font) return { kind: "embedded", font, named: true };
|
|
102146
|
+
}
|
|
102147
|
+
const encoded = encodeWinAnsi(text5);
|
|
102148
|
+
if (encoded !== void 0)
|
|
102149
|
+
return { kind: "standard", baseFont: pdfBaseFont(family2, bold, italic), encoded };
|
|
102150
|
+
const fallback = fonts?.pick(family2, bold, italic, text5);
|
|
102151
|
+
return fallback ? { kind: "embedded", font: fallback, named: false } : void 0;
|
|
102152
|
+
}
|
|
102153
|
+
function clipTo(page, clip) {
|
|
102154
|
+
const segments = parsePath(clip.d);
|
|
102155
|
+
if (!segments) return;
|
|
102156
|
+
const [a, b, c, d, e, f] = clip.matrix;
|
|
102157
|
+
const det = a * d - b * c;
|
|
102158
|
+
if (!segments.length || Math.abs(det) < 1e-12) {
|
|
102159
|
+
page.rect(0, 0, 0, 0);
|
|
102160
|
+
page.op("W n");
|
|
102161
|
+
return;
|
|
102162
|
+
}
|
|
102163
|
+
page.concat(clip.matrix);
|
|
102164
|
+
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102165
|
+
page.op(clip.evenOdd ? "W* n" : "W n");
|
|
102166
|
+
page.concat([d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det]);
|
|
102167
|
+
}
|
|
102168
|
+
function canWritePdfText(text5, family2, bold, italic, fonts) {
|
|
102169
|
+
return resolvePdfTextFont(text5, family2, bold, italic, fonts) !== void 0;
|
|
102170
|
+
}
|
|
102171
|
+
function paintTextLayer(page, item4, font) {
|
|
102172
|
+
const natural = font.width(item4.text) * item4.size;
|
|
102173
|
+
const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
|
|
102174
|
+
page.embeddedText(font, item4.size, item4.x, item4.baseline, item4.text, {
|
|
102175
|
+
scale: scale3,
|
|
102176
|
+
invisible: true
|
|
102177
|
+
});
|
|
102178
|
+
}
|
|
102179
|
+
function paintText(page, item4, fonts, notes) {
|
|
102180
|
+
const font = resolvePdfTextFont(item4.text, item4.family, item4.bold, item4.italic, fonts.set);
|
|
102181
|
+
if (!font) {
|
|
102182
|
+
if (!item4.invisible) notes.add("unsearchableText");
|
|
102183
|
+
paintTextLayer(page, item4, fonts.textLayer);
|
|
102184
|
+
return;
|
|
102185
|
+
}
|
|
102186
|
+
const family2 = primaryFamily(item4.family) || "";
|
|
102187
|
+
if (font.kind === "standard" && !item4.invisible)
|
|
102188
|
+
notes.add("fontStandard", { family: family2, substitute: font.baseFont.split("-")[0] ?? "" });
|
|
102189
|
+
else if (font.kind === "embedded" && !font.named && !item4.invisible)
|
|
102190
|
+
notes.add("fontSubstituted", { family: family2, substitute: font.font.family });
|
|
102191
|
+
const natural = (font.kind === "embedded" ? font.font.width(item4.text) : pdfTextWidth(font.encoded, font.baseFont)) * item4.size;
|
|
102192
|
+
const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
|
|
102193
|
+
const spacing = { scale: scale3, ...item4.invisible ? { invisible: true } : {} };
|
|
102194
|
+
page.fillColor(item4.color.r, item4.color.g, item4.color.b);
|
|
102195
|
+
const alpha = item4.alpha * item4.color.a;
|
|
102196
|
+
if (alpha < 1) page.alpha(alpha);
|
|
102197
|
+
if (font.kind === "embedded")
|
|
102198
|
+
page.embeddedText(font.font, item4.size, item4.x, item4.baseline, item4.text, spacing);
|
|
102199
|
+
else page.text(font.baseFont, item4.size, item4.x, item4.baseline, font.encoded, spacing);
|
|
102200
|
+
if (item4.invisible) return;
|
|
102201
|
+
const thickness = Math.max(0.5, item4.size * 0.06);
|
|
102202
|
+
if (item4.underline) {
|
|
102203
|
+
page.rect(item4.x, item4.baseline + item4.size * 0.12, item4.width, thickness);
|
|
102204
|
+
page.op("f");
|
|
102205
|
+
}
|
|
102206
|
+
if (item4.strike) {
|
|
102207
|
+
page.rect(item4.x, item4.baseline - item4.size * 0.3, item4.width, thickness);
|
|
102208
|
+
page.op("f");
|
|
102209
|
+
}
|
|
102210
|
+
}
|
|
102211
|
+
function paintItem(page, item4, fonts, notes) {
|
|
102212
|
+
page.save();
|
|
102213
|
+
for (const clip of item4.clips) clipTo(page, clip);
|
|
102214
|
+
page.concat(item4.matrix);
|
|
102215
|
+
switch (item4.kind) {
|
|
102216
|
+
case "path": {
|
|
102217
|
+
const segments = parsePath(item4.d);
|
|
102218
|
+
if (!segments?.length) break;
|
|
102219
|
+
const evenOdd = item4.evenOdd ? "*" : "";
|
|
102220
|
+
if (item4.shading) {
|
|
102221
|
+
page.save();
|
|
102222
|
+
const alpha = item4.alpha * item4.shading.opacity;
|
|
102223
|
+
if (alpha < 1) page.alpha(alpha, 1);
|
|
102224
|
+
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102225
|
+
page.op(`W${evenOdd} n`);
|
|
102226
|
+
for (const matrix of item4.shading.matrices) page.concat(matrix);
|
|
102227
|
+
page.paintShading(item4.shading.shading);
|
|
102228
|
+
page.restore();
|
|
102229
|
+
}
|
|
102230
|
+
const fill3 = item4.fill && item4.fill.a > 0 ? item4.fill : void 0;
|
|
102231
|
+
const stroke = item4.stroke && item4.stroke.color.a > 0 && item4.stroke.width > 0;
|
|
102232
|
+
if (!fill3 && !stroke) break;
|
|
102233
|
+
const fillAlpha = fill3 ? item4.alpha * fill3.a : 1;
|
|
102234
|
+
const strokeAlpha = item4.stroke ? item4.alpha * item4.stroke.color.a : 1;
|
|
102235
|
+
if (fillAlpha < 1 || strokeAlpha < 1) page.alpha(fillAlpha, strokeAlpha);
|
|
102236
|
+
if (fill3) page.fillColor(fill3.r, fill3.g, fill3.b);
|
|
102237
|
+
if (stroke && item4.stroke) {
|
|
102238
|
+
const s = item4.stroke;
|
|
102239
|
+
page.strokeColor(s.color.r, s.color.g, s.color.b);
|
|
102240
|
+
page.lineStyle(s.width, s.cap, s.join, s.dash);
|
|
102241
|
+
}
|
|
102242
|
+
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102243
|
+
page.op(fill3 && stroke ? `B${evenOdd}` : fill3 ? `f${evenOdd}` : "S");
|
|
102244
|
+
break;
|
|
102245
|
+
}
|
|
102246
|
+
case "image":
|
|
102247
|
+
if (!(item4.width > 0 && item4.height > 0)) break;
|
|
102248
|
+
if (item4.alpha < 1) page.alpha(item4.alpha);
|
|
102249
|
+
page.concat([item4.width, 0, 0, -item4.height, item4.x, item4.y + item4.height]);
|
|
102250
|
+
page.drawImage(item4.image);
|
|
102251
|
+
break;
|
|
102252
|
+
case "text":
|
|
102253
|
+
paintText(page, item4, fonts, notes);
|
|
102254
|
+
break;
|
|
102255
|
+
case "svg":
|
|
102256
|
+
try {
|
|
102257
|
+
for (const note of drawSvgSubtree(page, item4.svg, item4.images, fonts.set, item4.alpha))
|
|
102258
|
+
notes.add(note);
|
|
102259
|
+
} catch {
|
|
102260
|
+
notes.add("drawingPartMissing");
|
|
102261
|
+
}
|
|
102262
|
+
break;
|
|
102263
|
+
}
|
|
102264
|
+
page.restore();
|
|
102265
|
+
}
|
|
102266
|
+
function paintSlide(items, options) {
|
|
102267
|
+
const page = new PdfVectorPage(options.pageWidth, options.pageHeight);
|
|
102268
|
+
const notes = new PdfDiagnosticSet();
|
|
102269
|
+
const sx = options.pageWidth / options.canvasWidth;
|
|
102270
|
+
const sy = options.pageHeight / options.canvasHeight;
|
|
102271
|
+
page.concat([sx, 0, 0, -sy, 0, options.pageHeight]);
|
|
102272
|
+
page.rect(0, 0, options.canvasWidth, options.canvasHeight);
|
|
102273
|
+
page.op("W n");
|
|
102274
|
+
const fonts = {
|
|
102275
|
+
set: options.fonts,
|
|
102276
|
+
textLayer: options.fonts?.textLayer ?? new PdfTextLayerFont()
|
|
102277
|
+
};
|
|
102278
|
+
for (const item4 of items) paintItem(page, item4, fonts, notes);
|
|
102279
|
+
return { page, diagnostics: notes.toArray() };
|
|
102280
|
+
}
|
|
102281
|
+
|
|
102057
102282
|
// src/pptx/export/pdf-vector-text.ts
|
|
102058
102283
|
var COMPLEX_SCRIPT = new RegExp(
|
|
102059
102284
|
"[\u0590-\u08FF\u0900-\u0DFF\u0F00-\u0FFF\u1000-\u109F\u1780-\u17FF\u1800-\u18AF\uA840-\uA87F\uFB1D-\uFDFF\uFE70-\uFEFF\u200F\u202B\u202E]|\u200D|\\p{M}",
|
|
@@ -102090,10 +102315,15 @@ function ascentRatio(family2, bold, italic, fonts) {
|
|
|
102090
102315
|
function measureTextNode(node, style, context3, tokenBudget) {
|
|
102091
102316
|
const raw = node.data;
|
|
102092
102317
|
if (!raw.trim()) return { items: [], tokens: 0 };
|
|
102093
|
-
|
|
102094
|
-
return { items: [], tokens: 0, raster: "verticalTextAsPicture" };
|
|
102318
|
+
const vertical2 = !/^horizontal/.test(style.writingMode || "horizontal-tb");
|
|
102095
102319
|
const display = applyTextTransform(raw, style.textTransform);
|
|
102096
102320
|
const shaping = needsShaping(display);
|
|
102321
|
+
const weight = style.fontWeight;
|
|
102322
|
+
const bold = weight === "bold" || Number.parseInt(weight, 10) >= 600;
|
|
102323
|
+
const italic = /italic|oblique/.test(style.fontStyle);
|
|
102324
|
+
const family2 = style.fontFamily;
|
|
102325
|
+
const noFont = !shaping && !context3.invisible && !canWritePdfText(display.replace(/\s+/g, " ").trim(), family2, bold, italic, context3.fonts);
|
|
102326
|
+
const picture = vertical2 || shaping || noFont;
|
|
102097
102327
|
const color = cssColor(style.getPropertyValue("-webkit-text-fill-color") || style.color);
|
|
102098
102328
|
if (color === void 0) return { items: [], tokens: 0, raster: "textColourAsPicture" };
|
|
102099
102329
|
const doc = node.ownerDocument;
|
|
@@ -102117,7 +102347,7 @@ function measureTextNode(node, style, context3, tokenBudget) {
|
|
|
102117
102347
|
range.setStart(node, start);
|
|
102118
102348
|
range.setEnd(node, end);
|
|
102119
102349
|
const rects = rectsOf(range);
|
|
102120
|
-
if (rects.length === 1) {
|
|
102350
|
+
if (rects.length === 1 && (!vertical2 || end - start === 1)) {
|
|
102121
102351
|
const r = rects[0];
|
|
102122
102352
|
tokens.push(token(start, end, r));
|
|
102123
102353
|
continue;
|
|
@@ -102133,10 +102363,6 @@ function measureTextNode(node, style, context3, tokenBudget) {
|
|
|
102133
102363
|
range.detach?.();
|
|
102134
102364
|
if (!tokens.length) return { items: [], tokens: words.length };
|
|
102135
102365
|
const size2 = Number.parseFloat(style.fontSize) || 16;
|
|
102136
|
-
const weight = style.fontWeight;
|
|
102137
|
-
const bold = weight === "bold" || Number.parseInt(weight, 10) >= 600;
|
|
102138
|
-
const italic = /italic|oblique/.test(style.fontStyle);
|
|
102139
|
-
const family2 = style.fontFamily;
|
|
102140
102366
|
const ratio = ascentRatio(family2, bold, italic, context3.fonts);
|
|
102141
102367
|
const decoration = style.textDecorationLine || "";
|
|
102142
102368
|
const justify = /justify/.test(style.textAlign);
|
|
@@ -102163,13 +102389,13 @@ function measureTextNode(node, style, context3, tokenBudget) {
|
|
|
102163
102389
|
color: color ?? { r: 0, g: 0, b: 0, a: 0 },
|
|
102164
102390
|
...decoration.includes("underline") ? { underline: true } : {},
|
|
102165
102391
|
...decoration.includes("line-through") ? { strike: true } : {},
|
|
102166
|
-
...context3.invisible ||
|
|
102392
|
+
...context3.invisible || picture || !color ? { invisible: true } : {}
|
|
102167
102393
|
});
|
|
102168
102394
|
};
|
|
102169
102395
|
let group = [];
|
|
102170
102396
|
for (const token2 of tokens) {
|
|
102171
102397
|
const previous = group[group.length - 1];
|
|
102172
|
-
const sameLine = previous && Math.abs(token2.top - previous.top) < Math.max(token2.height, previous.height) * 0.5 && token2.left >= previous.right - 1 && !justify && // Characters of a broken word join without spaces; words join with one.
|
|
102398
|
+
const sameLine = previous && !vertical2 && Math.abs(token2.top - previous.top) < Math.max(token2.height, previous.height) * 0.5 && token2.left >= previous.right - 1 && !justify && // Characters of a broken word join without spaces; words join with one.
|
|
102173
102399
|
(token2.start === previous.end || display.slice(previous.end, token2.start).trim() === "");
|
|
102174
102400
|
if (previous && !sameLine) {
|
|
102175
102401
|
flush(group);
|
|
@@ -102181,8 +102407,8 @@ function measureTextNode(node, style, context3, tokenBudget) {
|
|
|
102181
102407
|
return {
|
|
102182
102408
|
items,
|
|
102183
102409
|
tokens: words.length,
|
|
102184
|
-
...
|
|
102185
|
-
raster: "complexScriptAsPicture"
|
|
102410
|
+
...picture && !context3.invisible ? {
|
|
102411
|
+
raster: vertical2 ? "verticalTextAsPicture" : shaping ? "complexScriptAsPicture" : "noFontTextAsPicture"
|
|
102186
102412
|
} : {}
|
|
102187
102413
|
};
|
|
102188
102414
|
}
|
|
@@ -102369,12 +102595,12 @@ async function collectSlide(stage, options) {
|
|
|
102369
102595
|
if (tag === "img" || MEDIA_TAGS.has(tag)) {
|
|
102370
102596
|
if (!visible || ctx.invisible || !(content.w > 0 && content.h > 0)) return;
|
|
102371
102597
|
const media = el;
|
|
102372
|
-
const natural = tag === "img" ? [media.naturalWidth, media.naturalHeight] :
|
|
102598
|
+
const natural = tag === "img" ? [media.naturalWidth, media.naturalHeight] : [media.width, media.height];
|
|
102373
102599
|
if (tag !== "img") notes.add(MEDIA_REASON);
|
|
102374
102600
|
const item4 = placeholderImage(matrix, [...clips, boxClip(matrix, content)], alpha, content);
|
|
102375
102601
|
items.push(item4);
|
|
102376
102602
|
const fit = style.objectFit === "cover" ? "cover" : style.objectFit === "contain" ? "contain" : "fill";
|
|
102377
|
-
const load = () => drawableToPdfImage(doc, media, natural[0] ?? 0, natural[1] ?? 0);
|
|
102603
|
+
const load = () => tag === "video" ? videoPicture(doc, media) : drawableToPdfImage(doc, media, natural[0] ?? 0, natural[1] ?? 0);
|
|
102378
102604
|
pending4.push({
|
|
102379
102605
|
item: item4,
|
|
102380
102606
|
fit,
|
|
@@ -102415,6 +102641,7 @@ async function collectSlide(stage, options) {
|
|
|
102415
102641
|
});
|
|
102416
102642
|
children.sort((a, b) => a.z - b.z || a.index - b.index);
|
|
102417
102643
|
let shadowDone = false;
|
|
102644
|
+
let textPicture = false;
|
|
102418
102645
|
for (const { node } of children) {
|
|
102419
102646
|
if (picture) return;
|
|
102420
102647
|
if (node.nodeType === 1) {
|
|
@@ -102447,7 +102674,9 @@ async function collectSlide(stage, options) {
|
|
|
102447
102674
|
return;
|
|
102448
102675
|
}
|
|
102449
102676
|
if (result.raster) {
|
|
102450
|
-
raster(el, "subtree", ctx.matrix, boxOf2(el), 4, result.raster);
|
|
102677
|
+
if (!textPicture) raster(el, "subtree", ctx.matrix, boxOf2(el), 4, result.raster);
|
|
102678
|
+
else notes.add(result.raster);
|
|
102679
|
+
textPicture = true;
|
|
102451
102680
|
items.push(...result.items.map((item4) => ({ ...item4, invisible: true })));
|
|
102452
102681
|
} else items.push(...result.items);
|
|
102453
102682
|
}
|
|
@@ -102519,135 +102748,6 @@ async function collectSlide(stage, options) {
|
|
|
102519
102748
|
};
|
|
102520
102749
|
}
|
|
102521
102750
|
|
|
102522
|
-
// src/pptx/export/pdf-vector-paint.ts
|
|
102523
|
-
function primaryFamily(family2) {
|
|
102524
|
-
const first = family2.split(",")[0] ?? "";
|
|
102525
|
-
return first.trim().replace(/^['"]|['"]$/g, "");
|
|
102526
|
-
}
|
|
102527
|
-
function resolvePdfTextFont(text5, family2, bold, italic, fonts) {
|
|
102528
|
-
if (fonts?.has(family2)) {
|
|
102529
|
-
const font = fonts.pick(family2, bold, italic, text5);
|
|
102530
|
-
if (font) return { kind: "embedded", font, named: true };
|
|
102531
|
-
}
|
|
102532
|
-
const encoded = encodeWinAnsi(text5);
|
|
102533
|
-
if (encoded !== void 0)
|
|
102534
|
-
return { kind: "standard", baseFont: pdfBaseFont(family2, bold, italic), encoded };
|
|
102535
|
-
const fallback = fonts?.pick(family2, bold, italic, text5);
|
|
102536
|
-
return fallback ? { kind: "embedded", font: fallback, named: false } : void 0;
|
|
102537
|
-
}
|
|
102538
|
-
function clipTo(page, clip) {
|
|
102539
|
-
const segments = parsePath(clip.d);
|
|
102540
|
-
if (!segments) return;
|
|
102541
|
-
const [a, b, c, d, e, f] = clip.matrix;
|
|
102542
|
-
const det = a * d - b * c;
|
|
102543
|
-
if (!segments.length || Math.abs(det) < 1e-12) {
|
|
102544
|
-
page.rect(0, 0, 0, 0);
|
|
102545
|
-
page.op("W n");
|
|
102546
|
-
return;
|
|
102547
|
-
}
|
|
102548
|
-
page.concat(clip.matrix);
|
|
102549
|
-
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102550
|
-
page.op(clip.evenOdd ? "W* n" : "W n");
|
|
102551
|
-
page.concat([d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det]);
|
|
102552
|
-
}
|
|
102553
|
-
function paintText(page, item4, fonts, notes) {
|
|
102554
|
-
const font = resolvePdfTextFont(item4.text, item4.family, item4.bold, item4.italic, fonts);
|
|
102555
|
-
if (!font) {
|
|
102556
|
-
notes.add("unsearchableText");
|
|
102557
|
-
return;
|
|
102558
|
-
}
|
|
102559
|
-
const family2 = primaryFamily(item4.family) || "";
|
|
102560
|
-
if (font.kind === "standard" && !item4.invisible)
|
|
102561
|
-
notes.add("fontStandard", { family: family2, substitute: font.baseFont.split("-")[0] ?? "" });
|
|
102562
|
-
else if (font.kind === "embedded" && !font.named && !item4.invisible)
|
|
102563
|
-
notes.add("fontSubstituted", { family: family2, substitute: font.font.family });
|
|
102564
|
-
const natural = (font.kind === "embedded" ? font.font.width(item4.text) : pdfTextWidth(font.encoded, font.baseFont)) * item4.size;
|
|
102565
|
-
const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
|
|
102566
|
-
const spacing = { scale: scale3, ...item4.invisible ? { invisible: true } : {} };
|
|
102567
|
-
page.fillColor(item4.color.r, item4.color.g, item4.color.b);
|
|
102568
|
-
const alpha = item4.alpha * item4.color.a;
|
|
102569
|
-
if (alpha < 1) page.alpha(alpha);
|
|
102570
|
-
if (font.kind === "embedded")
|
|
102571
|
-
page.embeddedText(font.font, item4.size, item4.x, item4.baseline, item4.text, spacing);
|
|
102572
|
-
else page.text(font.baseFont, item4.size, item4.x, item4.baseline, font.encoded, spacing);
|
|
102573
|
-
if (item4.invisible) return;
|
|
102574
|
-
const thickness = Math.max(0.5, item4.size * 0.06);
|
|
102575
|
-
if (item4.underline) {
|
|
102576
|
-
page.rect(item4.x, item4.baseline + item4.size * 0.12, item4.width, thickness);
|
|
102577
|
-
page.op("f");
|
|
102578
|
-
}
|
|
102579
|
-
if (item4.strike) {
|
|
102580
|
-
page.rect(item4.x, item4.baseline - item4.size * 0.3, item4.width, thickness);
|
|
102581
|
-
page.op("f");
|
|
102582
|
-
}
|
|
102583
|
-
}
|
|
102584
|
-
function paintItem(page, item4, fonts, notes) {
|
|
102585
|
-
page.save();
|
|
102586
|
-
for (const clip of item4.clips) clipTo(page, clip);
|
|
102587
|
-
page.concat(item4.matrix);
|
|
102588
|
-
switch (item4.kind) {
|
|
102589
|
-
case "path": {
|
|
102590
|
-
const segments = parsePath(item4.d);
|
|
102591
|
-
if (!segments?.length) break;
|
|
102592
|
-
const evenOdd = item4.evenOdd ? "*" : "";
|
|
102593
|
-
if (item4.shading) {
|
|
102594
|
-
page.save();
|
|
102595
|
-
const alpha = item4.alpha * item4.shading.opacity;
|
|
102596
|
-
if (alpha < 1) page.alpha(alpha, 1);
|
|
102597
|
-
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102598
|
-
page.op(`W${evenOdd} n`);
|
|
102599
|
-
for (const matrix of item4.shading.matrices) page.concat(matrix);
|
|
102600
|
-
page.paintShading(item4.shading.shading);
|
|
102601
|
-
page.restore();
|
|
102602
|
-
}
|
|
102603
|
-
const fill3 = item4.fill && item4.fill.a > 0 ? item4.fill : void 0;
|
|
102604
|
-
const stroke = item4.stroke && item4.stroke.color.a > 0 && item4.stroke.width > 0;
|
|
102605
|
-
if (!fill3 && !stroke) break;
|
|
102606
|
-
const fillAlpha = fill3 ? item4.alpha * fill3.a : 1;
|
|
102607
|
-
const strokeAlpha = item4.stroke ? item4.alpha * item4.stroke.color.a : 1;
|
|
102608
|
-
if (fillAlpha < 1 || strokeAlpha < 1) page.alpha(fillAlpha, strokeAlpha);
|
|
102609
|
-
if (fill3) page.fillColor(fill3.r, fill3.g, fill3.b);
|
|
102610
|
-
if (stroke && item4.stroke) {
|
|
102611
|
-
const s = item4.stroke;
|
|
102612
|
-
page.strokeColor(s.color.r, s.color.g, s.color.b);
|
|
102613
|
-
page.lineStyle(s.width, s.cap, s.join, s.dash);
|
|
102614
|
-
}
|
|
102615
|
-
for (const operator of pathOperators(segments)) page.op(operator);
|
|
102616
|
-
page.op(fill3 && stroke ? `B${evenOdd}` : fill3 ? `f${evenOdd}` : "S");
|
|
102617
|
-
break;
|
|
102618
|
-
}
|
|
102619
|
-
case "image":
|
|
102620
|
-
if (!(item4.width > 0 && item4.height > 0)) break;
|
|
102621
|
-
if (item4.alpha < 1) page.alpha(item4.alpha);
|
|
102622
|
-
page.concat([item4.width, 0, 0, -item4.height, item4.x, item4.y + item4.height]);
|
|
102623
|
-
page.drawImage(item4.image);
|
|
102624
|
-
break;
|
|
102625
|
-
case "text":
|
|
102626
|
-
paintText(page, item4, fonts, notes);
|
|
102627
|
-
break;
|
|
102628
|
-
case "svg":
|
|
102629
|
-
try {
|
|
102630
|
-
for (const note of drawSvgSubtree(page, item4.svg, item4.images, fonts, item4.alpha))
|
|
102631
|
-
notes.add(note);
|
|
102632
|
-
} catch {
|
|
102633
|
-
notes.add("drawingPartMissing");
|
|
102634
|
-
}
|
|
102635
|
-
break;
|
|
102636
|
-
}
|
|
102637
|
-
page.restore();
|
|
102638
|
-
}
|
|
102639
|
-
function paintSlide(items, options) {
|
|
102640
|
-
const page = new PdfVectorPage(options.pageWidth, options.pageHeight);
|
|
102641
|
-
const notes = new PdfDiagnosticSet();
|
|
102642
|
-
const sx = options.pageWidth / options.canvasWidth;
|
|
102643
|
-
const sy = options.pageHeight / options.canvasHeight;
|
|
102644
|
-
page.concat([sx, 0, 0, -sy, 0, options.pageHeight]);
|
|
102645
|
-
page.rect(0, 0, options.canvasWidth, options.canvasHeight);
|
|
102646
|
-
page.op("W n");
|
|
102647
|
-
for (const item4 of items) paintItem(page, item4, options.fonts, notes);
|
|
102648
|
-
return { page, diagnostics: notes.toArray() };
|
|
102649
|
-
}
|
|
102650
|
-
|
|
102651
102751
|
// src/pptx/export/pdf-vector-export.ts
|
|
102652
102752
|
var abortError = () => new DOMException("Export cancelled", "AbortError");
|
|
102653
102753
|
async function exportSlidesVectorPdf(options) {
|
|
@@ -102731,7 +102831,9 @@ async function exportSlidesVectorPdf(options) {
|
|
|
102731
102831
|
options.onProgress?.(indexes.length, indexes.length);
|
|
102732
102832
|
const bytes = buildVectorPdf(pages, options.title ? { title: options.title } : {});
|
|
102733
102833
|
const embedded = new Set(
|
|
102734
|
-
pages.flatMap(
|
|
102834
|
+
pages.flatMap(
|
|
102835
|
+
(page) => [...page.embeddedFonts.values()].filter((font) => font !== fonts.textLayer).map((font) => font.family)
|
|
102836
|
+
)
|
|
102735
102837
|
);
|
|
102736
102838
|
return {
|
|
102737
102839
|
blob: new Blob([bytes], { type: "application/pdf" }),
|