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.
Files changed (146) hide show
  1. package/dist/building-block-styles.d.ts +0 -1
  2. package/dist/chart/data-sheet-labels.d.ts +0 -1
  3. package/dist/chart/data-sheet.d.ts +1 -2
  4. package/dist/chart/format-pane-3d.d.ts +0 -1
  5. package/dist/chart/format-pane-advanced-intent.d.ts +0 -1
  6. package/dist/chart/format-pane-advanced-space.d.ts +0 -1
  7. package/dist/chart/format-pane-analysis.d.ts +0 -1
  8. package/dist/chart/format-pane-axis.d.ts +0 -1
  9. package/dist/chart/format-pane-common.d.ts +0 -1
  10. package/dist/chart/format-pane-effects.d.ts +0 -1
  11. package/dist/chart/format-pane-fill-kinds.d.ts +0 -1
  12. package/dist/chart/format-pane-intent.d.ts +0 -1
  13. package/dist/chart/format-pane-locales/de.d.ts +0 -1
  14. package/dist/chart/format-pane-locales/es.d.ts +0 -1
  15. package/dist/chart/format-pane-locales/fr.d.ts +0 -1
  16. package/dist/chart/format-pane-locales/ja.d.ts +0 -1
  17. package/dist/chart/format-pane-locales/ko.d.ts +0 -1
  18. package/dist/chart/format-pane-locales/zh-CN.d.ts +0 -1
  19. package/dist/chart/format-pane-options.d.ts +0 -1
  20. package/dist/chart/format-pane-types.d.ts +0 -1
  21. package/dist/chart/gallery-tiles.d.ts +0 -1
  22. package/dist/chrome/account-profile.d.ts +0 -1
  23. package/dist/chrome/account.d.ts +1 -2
  24. package/dist/chrome/find-bar.d.ts +1 -2
  25. package/dist/chrome/format-section.d.ts +1 -2
  26. package/dist/chrome/print-preview.d.ts +1 -2
  27. package/dist/chrome/status-bar.d.ts +1 -2
  28. package/dist/chrome/status-item.d.ts +1 -2
  29. package/dist/chrome/tab-drag.d.ts +0 -1
  30. package/dist/chrome/task-pane.d.ts +1 -2
  31. package/dist/chrome/title-bar-types.d.ts +0 -1
  32. package/dist/{chunk-ALWA7Q42.js → chunk-ELVHRXWE.js} +1 -1
  33. package/dist/comments/types.d.ts +0 -1
  34. package/dist/controls.d.ts +0 -1
  35. package/dist/dialog/chart-picker.d.ts +1 -2
  36. package/dist/dialog/dialog-footer.d.ts +1 -2
  37. package/dist/dialog/dialog-session.d.ts +0 -1
  38. package/dist/dialog/dialog.d.ts +1 -2
  39. package/dist/dialog/focus.d.ts +0 -1
  40. package/dist/dialog/message-dialog.d.ts +1 -2
  41. package/dist/dialog/message-dialogs.d.ts +0 -1
  42. package/dist/dialog/options-categories.d.ts +0 -1
  43. package/dist/dialog/options-controls.d.ts +0 -1
  44. package/dist/dialog/options-dialog.d.ts +1 -2
  45. package/dist/dialog/share-dialog-locales.d.ts +0 -1
  46. package/dist/dialog/share-dialog.d.ts +1 -2
  47. package/dist/embedding/region-host.d.ts +0 -1
  48. package/dist/export/pdf-cid-font.d.ts +35 -0
  49. package/dist/export/pdf-cid-font.d.ts.map +1 -0
  50. package/dist/export/pdf-embedded-font.d.ts +10 -16
  51. package/dist/export/pdf-embedded-font.d.ts.map +1 -1
  52. package/dist/export/pdf-font-faces.d.ts +0 -1
  53. package/dist/export/pdf-svg-gradient.d.ts +0 -1
  54. package/dist/export/pdf-svg-text.d.ts +0 -1
  55. package/dist/export/pdf-text-layer-font.d.ts +13 -0
  56. package/dist/export/pdf-text-layer-font.d.ts.map +1 -0
  57. package/dist/export/pdf-vector.d.ts +3 -3
  58. package/dist/export/pdf-vector.d.ts.map +1 -1
  59. package/dist/files/cloud-files-view.d.ts +0 -1
  60. package/dist/files/cloud-files.d.ts +1 -2
  61. package/dist/files/open-places.d.ts +1 -2
  62. package/dist/files/save-progress-label.d.ts +0 -1
  63. package/dist/fonts/availability.d.ts +0 -1
  64. package/dist/fonts/catalog.d.ts +0 -1
  65. package/dist/fonts/custom-fonts.d.ts +0 -1
  66. package/dist/fonts/webfonts.d.ts +0 -1
  67. package/dist/form/checkbox.d.ts +1 -2
  68. package/dist/form/color-custom.d.ts +1 -2
  69. package/dist/form/color-grid.d.ts +1 -2
  70. package/dist/form/color-input/live-color-input.d.ts +0 -1
  71. package/dist/form/color-input/live-color-leaves.d.ts +0 -1
  72. package/dist/form/color-swatches.d.ts +0 -1
  73. package/dist/form/radio.d.ts +1 -2
  74. package/dist/form/range-control.d.ts +0 -1
  75. package/dist/form/search-field.d.ts +1 -2
  76. package/dist/form/select.d.ts +1 -2
  77. package/dist/form/symbol-picker.d.ts +1 -2
  78. package/dist/form/zoom-slider.d.ts +1 -2
  79. package/dist/glyph.d.ts +0 -1
  80. package/dist/icon.d.ts +0 -1
  81. package/dist/icons.d.ts +0 -1
  82. package/dist/index.js +2 -2
  83. package/dist/keytips.d.ts +0 -1
  84. package/dist/menu/command-search.d.ts +1 -2
  85. package/dist/menu/context-menu.d.ts +1 -2
  86. package/dist/menu/menu-item.d.ts +1 -2
  87. package/dist/menu/menu-separator.d.ts +1 -2
  88. package/dist/notices/paste-options.d.ts +1 -2
  89. package/dist/notices/read-only-banner.d.ts +1 -2
  90. package/dist/picture-artistic-filters.d.ts +0 -1
  91. package/dist/picture-artistic-preview.d.ts +0 -1
  92. package/dist/picture-effects.d.ts +0 -1
  93. package/dist/picture-pixels.d.ts +0 -1
  94. package/dist/picture-standard-filter.d.ts +0 -1
  95. package/dist/pptx/{chunk-5454QDUH.mjs → chunk-4K4DO7RJ.mjs} +1 -0
  96. package/dist/pptx/{chunk-NGOH4ENE.mjs → chunk-FQGG3DGL.mjs} +1 -1
  97. package/dist/pptx/{chunk-WKKLVLLP.cjs → chunk-JVCSVLFU.cjs} +1 -0
  98. package/dist/pptx/{chunk-7ZRVQFQN.cjs → chunk-OATLMHQL.cjs} +42 -42
  99. package/dist/pptx/{chunk-KCIIXE4D.mjs → chunk-OFXOF5ZX.mjs} +277 -175
  100. package/dist/pptx/{chunk-SC4VATDY.cjs → chunk-SWJV6FQN.cjs} +280 -178
  101. package/dist/pptx/dom/index.cjs +377 -377
  102. package/dist/pptx/dom/index.mjs +6 -6
  103. package/dist/pptx/export/pdf-export-diagnostics.d.ts +1 -1
  104. package/dist/pptx/export/pdf-export-diagnostics.d.ts.map +1 -1
  105. package/dist/pptx/export/pdf-vector-collect.d.ts.map +1 -1
  106. package/dist/pptx/export/pdf-vector-export.d.ts.map +1 -1
  107. package/dist/pptx/export/pdf-vector-media.d.ts +11 -0
  108. package/dist/pptx/export/pdf-vector-media.d.ts.map +1 -0
  109. package/dist/pptx/export/pdf-vector-paint.d.ts +5 -1
  110. package/dist/pptx/export/pdf-vector-paint.d.ts.map +1 -1
  111. package/dist/pptx/export/pdf-vector-text.d.ts.map +1 -1
  112. package/dist/pptx/i18n/index.cjs +6 -6
  113. package/dist/pptx/i18n/index.mjs +1 -1
  114. package/dist/pptx/i18n/translations-en-pdf-export.d.ts.map +1 -1
  115. package/dist/pptx/index.cjs +3270 -3270
  116. package/dist/pptx/index.mjs +2 -2
  117. package/dist/pptx/{smartart-insert-preview-MMCWPA26.cjs → smartart-insert-preview-BYPU325G.cjs} +4 -4
  118. package/dist/pptx/{smartart-insert-preview-H2LZCTYG.mjs → smartart-insert-preview-DF6KSG3D.mjs} +3 -3
  119. package/dist/presence/presence.d.ts +1 -2
  120. package/dist/presence.d.ts +0 -1
  121. package/dist/recovery-scheduler.d.ts +0 -1
  122. package/dist/render-cache.d.ts +0 -1
  123. package/dist/ribbon/auto-collapse.d.ts +0 -1
  124. package/dist/ribbon/button.d.ts +1 -2
  125. package/dist/ribbon/color-preview.d.ts +0 -1
  126. package/dist/ribbon/gallery-styles.d.ts +0 -1
  127. package/dist/ribbon/gallery.d.ts +1 -2
  128. package/dist/ribbon/group-overflow.d.ts +0 -1
  129. package/dist/ribbon/keytip-run.d.ts +0 -1
  130. package/dist/ribbon/overflow.d.ts +0 -1
  131. package/dist/ribbon/ribbon-group.d.ts +1 -2
  132. package/dist/ribbon/ribbon-stack.d.ts +1 -2
  133. package/dist/ribbon/ribbon-toggle.d.ts +1 -2
  134. package/dist/ribbon/safe-svg.d.ts +0 -1
  135. package/dist/ribbon/scroll-more.d.ts +0 -1
  136. package/dist/ribbon/svg-preview.d.ts +0 -1
  137. package/dist/smartart/smartart-picker.d.ts +1 -2
  138. package/dist/smartart/smartart-text-pane-tools.d.ts +0 -1
  139. package/dist/smartart/smartart-text-pane.d.ts +1 -2
  140. package/dist/styles.d.ts +0 -1
  141. package/dist/teams.js +1 -1
  142. package/dist/theme.d.ts +0 -1
  143. package/dist/visio.js +92 -28
  144. package/dist/xlsx.js +3 -3
  145. package/package.json +2 -2
  146. /package/dist/{chunk-JNCHVQQA.js → chunk-2N6QBIKM.js} +0 -0
@@ -24,7 +24,7 @@ var chunkEW5DW5KR_cjs = require('./chunk-EW5DW5KR.cjs');
24
24
  var chunkUPN5FFKP_cjs = require('./chunk-UPN5FFKP.cjs');
25
25
  var chunkIV2F5JWR_cjs = require('./chunk-IV2F5JWR.cjs');
26
26
  var chunkU47LRWDT_cjs = require('./chunk-U47LRWDT.cjs');
27
- var chunkWKKLVLLP_cjs = require('./chunk-WKKLVLLP.cjs');
27
+ var chunkJVCSVLFU_cjs = require('./chunk-JVCSVLFU.cjs');
28
28
  var chunk3RIGT7H6_cjs = require('./chunk-3RIGT7H6.cjs');
29
29
  var chunkPBZWDEXQ_cjs = require('./chunk-PBZWDEXQ.cjs');
30
30
  var lit = require('lit');
@@ -4243,13 +4243,13 @@ function chartSpaceFormatSource(space, options = {}) {
4243
4243
  labelOptions: labels
4244
4244
  };
4245
4245
  }
4246
- var chartFormatLocale = (value) => i18n.normalizeLocale(value, chunkWKKLVLLP_cjs.CHART_FORMAT_LOCALES, "en");
4246
+ var chartFormatLocale = (value) => i18n.normalizeLocale(value, chunkJVCSVLFU_cjs.CHART_FORMAT_LOCALES, "en");
4247
4247
  function chartFormatTranslator(locale, override) {
4248
- const strings = chunkWKKLVLLP_cjs.CHART_FORMAT_STRINGS[chartFormatLocale(locale)];
4248
+ const strings = chunkJVCSVLFU_cjs.CHART_FORMAT_STRINGS[chartFormatLocale(locale)];
4249
4249
  return (key2, params, fallback) => {
4250
4250
  const own = override?.(key2, params, fallback);
4251
4251
  if (own && own !== key2) return own;
4252
- return strings[key2] ?? chunkWKKLVLLP_cjs.CHART_FORMAT_STRINGS.en[key2] ?? key2;
4252
+ return strings[key2] ?? chunkJVCSVLFU_cjs.CHART_FORMAT_STRINGS.en[key2] ?? key2;
4253
4253
  };
4254
4254
  }
4255
4255
 
@@ -35020,7 +35020,7 @@ function createTemplateContext(options = {}) {
35020
35020
  const scheme = { ...pptx.DEFAULT_SCHEME_COLOR_MAP, ...options.scheme ?? {} };
35021
35021
  let counter = 0;
35022
35022
  const idFor = options.idFor ?? ((index) => `template-el-${Date.now()}-${index}`);
35023
- const dictionary = chunkWKKLVLLP_cjs.translationsEn;
35023
+ const dictionary = chunkJVCSVLFU_cjs.translationsEn;
35024
35024
  const translate2 = options.translate ?? ((key2) => dictionary[key2] ?? key2);
35025
35025
  return {
35026
35026
  scheme,
@@ -92873,7 +92873,7 @@ function definePptxInsertSmartArtDialog(registry2) {
92873
92873
  if (this.#live || this.#draw) {
92874
92874
  return;
92875
92875
  }
92876
- this.#live = import('./smartart-insert-preview-MMCWPA26.cjs').then((module) => {
92876
+ this.#live = import('./smartart-insert-preview-BYPU325G.cjs').then((module) => {
92877
92877
  if (this.#draw || !this.#picker) {
92878
92878
  return;
92879
92879
  }
@@ -99477,6 +99477,88 @@ async function collectLocalFontFiles(doc) {
99477
99477
  }
99478
99478
  return files;
99479
99479
  }
99480
+
99481
+ // src/export/pdf-cid-font.ts
99482
+ var hex4 = (value) => value.toString(16).padStart(4, "0");
99483
+ var utf16 = (code) => {
99484
+ if (code < 65536) return hex4(code);
99485
+ const v = code - 65536;
99486
+ return hex4(55296 + (v >> 10)) + hex4(56320 + (v & 1023));
99487
+ };
99488
+ function toUnicodeCMap(codes) {
99489
+ const lines = [
99490
+ "/CIDInit /ProcSet findresource begin",
99491
+ "12 dict begin",
99492
+ "begincmap",
99493
+ "/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def",
99494
+ "/CMapName /Adobe-Identity-UCS def",
99495
+ "/CMapType 2 def",
99496
+ "1 begincodespacerange",
99497
+ "<0000> <FFFF>",
99498
+ "endcodespacerange"
99499
+ ];
99500
+ for (let start = 0; start < codes.length; start += 100) {
99501
+ const chunk = codes.slice(start, start + 100);
99502
+ lines.push(`${chunk.length} beginbfchar`);
99503
+ chunk.forEach((code, index) => lines.push(`<${hex4(start + index + 1)}> <${utf16(code)}>`));
99504
+ lines.push("endbfchar");
99505
+ }
99506
+ lines.push("endcmap", "CMapName currentdict /CMap defineresource pop", "end", "end");
99507
+ return lines.join("\n");
99508
+ }
99509
+ var advanceOf = (char) => text$1.isEastAsianChar(char) ? 1e3 : 500;
99510
+ var PdfTextLayerFont = class {
99511
+ family = "TextLayer";
99512
+ bold = false;
99513
+ italic = false;
99514
+ #cids = /* @__PURE__ */ new Map();
99515
+ #codes = [];
99516
+ /** Advance width of `text` in em units. */
99517
+ width(text5) {
99518
+ let total = 0;
99519
+ for (const char of text5) total += advanceOf(char) / 1e3;
99520
+ return total;
99521
+ }
99522
+ /** `text` as the hex digits of 2-byte CIDs; each new character takes the next CID. */
99523
+ encode(text5) {
99524
+ let out = "";
99525
+ for (const char of text5) {
99526
+ const code = char.codePointAt(0);
99527
+ let cid = this.#cids.get(code);
99528
+ if (cid === void 0) {
99529
+ cid = this.#codes.length + 1 < text$1.MAX_GLYPHLESS_GLYPHS ? this.#codes.length + 1 : 0;
99530
+ if (cid) {
99531
+ this.#cids.set(code, cid);
99532
+ this.#codes.push(code);
99533
+ }
99534
+ }
99535
+ out += cid.toString(16).padStart(4, "0");
99536
+ }
99537
+ return out;
99538
+ }
99539
+ get used() {
99540
+ return this.#codes.length > 0;
99541
+ }
99542
+ build() {
99543
+ const widths = [0, ...this.#codes.map((code) => advanceOf(String.fromCodePoint(code)))];
99544
+ return {
99545
+ fontFile: text$1.glyphlessTrueType(widths),
99546
+ widths,
99547
+ toUnicode: toUnicodeCMap(this.#codes),
99548
+ descriptor: {
99549
+ flags: 4,
99550
+ bbox: [0, -200, 1e3, 800],
99551
+ italicAngle: 0,
99552
+ ascent: 800,
99553
+ descent: -200,
99554
+ capHeight: 700,
99555
+ stemV: 80
99556
+ }
99557
+ };
99558
+ }
99559
+ };
99560
+
99561
+ // src/export/pdf-embedded-font.ts
99480
99562
  var PdfEmbeddedFont = class _PdfEmbeddedFont {
99481
99563
  constructor(file, font) {
99482
99564
  this.font = font;
@@ -99563,35 +99645,9 @@ var PdfEmbeddedFont = class _PdfEmbeddedFont {
99563
99645
  };
99564
99646
  }
99565
99647
  };
99566
- var hex4 = (value) => value.toString(16).padStart(4, "0");
99567
- var utf16 = (code) => {
99568
- if (code < 65536) return hex4(code);
99569
- const v = code - 65536;
99570
- return hex4(55296 + (v >> 10)) + hex4(56320 + (v & 1023));
99571
- };
99572
- function toUnicodeCMap(codes) {
99573
- const lines = [
99574
- "/CIDInit /ProcSet findresource begin",
99575
- "12 dict begin",
99576
- "begincmap",
99577
- "/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def",
99578
- "/CMapName /Adobe-Identity-UCS def",
99579
- "/CMapType 2 def",
99580
- "1 begincodespacerange",
99581
- "<0000> <FFFF>",
99582
- "endcodespacerange"
99583
- ];
99584
- for (let start = 0; start < codes.length; start += 100) {
99585
- const chunk = codes.slice(start, start + 100);
99586
- lines.push(`${chunk.length} beginbfchar`);
99587
- chunk.forEach((code, index) => lines.push(`<${hex4(start + index + 1)}> <${utf16(code)}>`));
99588
- lines.push("endbfchar");
99589
- }
99590
- lines.push("endcmap", "CMapName currentdict /CMap defineresource pop", "end", "end");
99591
- return lines.join("\n");
99592
- }
99593
99648
  var PdfFontSet = class {
99594
99649
  fonts;
99650
+ #textLayer;
99595
99651
  constructor(files = []) {
99596
99652
  this.fonts = files.flatMap((file) => {
99597
99653
  const font = PdfEmbeddedFont.create(file);
@@ -99601,6 +99657,14 @@ var PdfFontSet = class {
99601
99657
  get size() {
99602
99658
  return this.fonts.length;
99603
99659
  }
99660
+ /**
99661
+ * The glyphless font of this document's invisible text layer, for text over a picture of it
99662
+ * that no supplied font can write (one font for every page, created on first use).
99663
+ */
99664
+ get textLayer() {
99665
+ this.#textLayer ??= new PdfTextLayerFont();
99666
+ return this.#textLayer;
99667
+ }
99604
99668
  /** The best font that has every character of `text`, or `undefined`. */
99605
99669
  pick(family2, bold, italic, text5) {
99606
99670
  const names = family2.split(",").map(
@@ -100102,7 +100166,8 @@ var PDF_PICTURE_CODES = [
100102
100166
  "shadowAsPicture",
100103
100167
  "verticalTextAsPicture",
100104
100168
  "textColourAsPicture",
100105
- "complexScriptAsPicture"
100169
+ "complexScriptAsPicture",
100170
+ "noFontTextAsPicture"
100106
100171
  ];
100107
100172
  var PDF_SLIDE_CODES = [
100108
100173
  "slideTooMuchText",
@@ -100672,6 +100737,21 @@ function paintBox(style, box, matrix, clips, alpha, boxShadow, collapsed = false
100672
100737
  return { items, ...image ? { image } : {} };
100673
100738
  }
100674
100739
 
100740
+ // src/pptx/export/pdf-vector-media.ts
100741
+ var HAVE_CURRENT_DATA = 2;
100742
+ function shownVideoPoster(video) {
100743
+ if (!video.getAttribute("poster")) return void 0;
100744
+ const noFrame = video.readyState < HAVE_CURRENT_DATA;
100745
+ const notStarted = video.paused && video.played.length === 0 && video.currentTime === 0;
100746
+ return noFrame || notStarted ? video.poster || video.getAttribute("poster") || void 0 : void 0;
100747
+ }
100748
+ async function videoPicture(doc, video) {
100749
+ const frame = () => drawableToPdfImage(doc, video, video.videoWidth, video.videoHeight);
100750
+ const poster = shownVideoPoster(video);
100751
+ if (!poster) return frame();
100752
+ return await decodePdfImage(doc, poster) ?? frame();
100753
+ }
100754
+
100675
100755
  // src/pptx/export/pdf-vector-timeout.ts
100676
100756
  var RASTER_TIMEOUT_MS = 2e4;
100677
100757
  var IMAGE_TIMEOUT_MS = 15e3;
@@ -102013,6 +102093,151 @@ function externalFontCache(doc) {
102013
102093
  };
102014
102094
  }
102015
102095
 
102096
+ // src/pptx/export/pdf-vector-paint.ts
102097
+ function primaryFamily(family2) {
102098
+ const first = family2.split(",")[0] ?? "";
102099
+ return first.trim().replace(/^['"]|['"]$/g, "");
102100
+ }
102101
+ function resolvePdfTextFont(text5, family2, bold, italic, fonts) {
102102
+ if (fonts?.has(family2)) {
102103
+ const font = fonts.pick(family2, bold, italic, text5);
102104
+ if (font) return { kind: "embedded", font, named: true };
102105
+ }
102106
+ const encoded = encodeWinAnsi(text5);
102107
+ if (encoded !== void 0)
102108
+ return { kind: "standard", baseFont: pdfBaseFont(family2, bold, italic), encoded };
102109
+ const fallback = fonts?.pick(family2, bold, italic, text5);
102110
+ return fallback ? { kind: "embedded", font: fallback, named: false } : void 0;
102111
+ }
102112
+ function clipTo(page, clip) {
102113
+ const segments = visio.parsePath(clip.d);
102114
+ if (!segments) return;
102115
+ const [a, b, c, d, e, f] = clip.matrix;
102116
+ const det = a * d - b * c;
102117
+ if (!segments.length || Math.abs(det) < 1e-12) {
102118
+ page.rect(0, 0, 0, 0);
102119
+ page.op("W n");
102120
+ return;
102121
+ }
102122
+ page.concat(clip.matrix);
102123
+ for (const operator of pathOperators(segments)) page.op(operator);
102124
+ page.op(clip.evenOdd ? "W* n" : "W n");
102125
+ page.concat([d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det]);
102126
+ }
102127
+ function canWritePdfText(text5, family2, bold, italic, fonts) {
102128
+ return resolvePdfTextFont(text5, family2, bold, italic, fonts) !== void 0;
102129
+ }
102130
+ function paintTextLayer(page, item4, font) {
102131
+ const natural = font.width(item4.text) * item4.size;
102132
+ const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
102133
+ page.embeddedText(font, item4.size, item4.x, item4.baseline, item4.text, {
102134
+ scale: scale3,
102135
+ invisible: true
102136
+ });
102137
+ }
102138
+ function paintText(page, item4, fonts, notes) {
102139
+ const font = resolvePdfTextFont(item4.text, item4.family, item4.bold, item4.italic, fonts.set);
102140
+ if (!font) {
102141
+ if (!item4.invisible) notes.add("unsearchableText");
102142
+ paintTextLayer(page, item4, fonts.textLayer);
102143
+ return;
102144
+ }
102145
+ const family2 = primaryFamily(item4.family) || "";
102146
+ if (font.kind === "standard" && !item4.invisible)
102147
+ notes.add("fontStandard", { family: family2, substitute: font.baseFont.split("-")[0] ?? "" });
102148
+ else if (font.kind === "embedded" && !font.named && !item4.invisible)
102149
+ notes.add("fontSubstituted", { family: family2, substitute: font.font.family });
102150
+ const natural = (font.kind === "embedded" ? font.font.width(item4.text) : pdfTextWidth(font.encoded, font.baseFont)) * item4.size;
102151
+ const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
102152
+ const spacing = { scale: scale3, ...item4.invisible ? { invisible: true } : {} };
102153
+ page.fillColor(item4.color.r, item4.color.g, item4.color.b);
102154
+ const alpha = item4.alpha * item4.color.a;
102155
+ if (alpha < 1) page.alpha(alpha);
102156
+ if (font.kind === "embedded")
102157
+ page.embeddedText(font.font, item4.size, item4.x, item4.baseline, item4.text, spacing);
102158
+ else page.text(font.baseFont, item4.size, item4.x, item4.baseline, font.encoded, spacing);
102159
+ if (item4.invisible) return;
102160
+ const thickness = Math.max(0.5, item4.size * 0.06);
102161
+ if (item4.underline) {
102162
+ page.rect(item4.x, item4.baseline + item4.size * 0.12, item4.width, thickness);
102163
+ page.op("f");
102164
+ }
102165
+ if (item4.strike) {
102166
+ page.rect(item4.x, item4.baseline - item4.size * 0.3, item4.width, thickness);
102167
+ page.op("f");
102168
+ }
102169
+ }
102170
+ function paintItem(page, item4, fonts, notes) {
102171
+ page.save();
102172
+ for (const clip of item4.clips) clipTo(page, clip);
102173
+ page.concat(item4.matrix);
102174
+ switch (item4.kind) {
102175
+ case "path": {
102176
+ const segments = visio.parsePath(item4.d);
102177
+ if (!segments?.length) break;
102178
+ const evenOdd = item4.evenOdd ? "*" : "";
102179
+ if (item4.shading) {
102180
+ page.save();
102181
+ const alpha = item4.alpha * item4.shading.opacity;
102182
+ if (alpha < 1) page.alpha(alpha, 1);
102183
+ for (const operator of pathOperators(segments)) page.op(operator);
102184
+ page.op(`W${evenOdd} n`);
102185
+ for (const matrix of item4.shading.matrices) page.concat(matrix);
102186
+ page.paintShading(item4.shading.shading);
102187
+ page.restore();
102188
+ }
102189
+ const fill3 = item4.fill && item4.fill.a > 0 ? item4.fill : void 0;
102190
+ const stroke = item4.stroke && item4.stroke.color.a > 0 && item4.stroke.width > 0;
102191
+ if (!fill3 && !stroke) break;
102192
+ const fillAlpha = fill3 ? item4.alpha * fill3.a : 1;
102193
+ const strokeAlpha = item4.stroke ? item4.alpha * item4.stroke.color.a : 1;
102194
+ if (fillAlpha < 1 || strokeAlpha < 1) page.alpha(fillAlpha, strokeAlpha);
102195
+ if (fill3) page.fillColor(fill3.r, fill3.g, fill3.b);
102196
+ if (stroke && item4.stroke) {
102197
+ const s = item4.stroke;
102198
+ page.strokeColor(s.color.r, s.color.g, s.color.b);
102199
+ page.lineStyle(s.width, s.cap, s.join, s.dash);
102200
+ }
102201
+ for (const operator of pathOperators(segments)) page.op(operator);
102202
+ page.op(fill3 && stroke ? `B${evenOdd}` : fill3 ? `f${evenOdd}` : "S");
102203
+ break;
102204
+ }
102205
+ case "image":
102206
+ if (!(item4.width > 0 && item4.height > 0)) break;
102207
+ if (item4.alpha < 1) page.alpha(item4.alpha);
102208
+ page.concat([item4.width, 0, 0, -item4.height, item4.x, item4.y + item4.height]);
102209
+ page.drawImage(item4.image);
102210
+ break;
102211
+ case "text":
102212
+ paintText(page, item4, fonts, notes);
102213
+ break;
102214
+ case "svg":
102215
+ try {
102216
+ for (const note of drawSvgSubtree(page, item4.svg, item4.images, fonts.set, item4.alpha))
102217
+ notes.add(note);
102218
+ } catch {
102219
+ notes.add("drawingPartMissing");
102220
+ }
102221
+ break;
102222
+ }
102223
+ page.restore();
102224
+ }
102225
+ function paintSlide(items, options) {
102226
+ const page = new PdfVectorPage(options.pageWidth, options.pageHeight);
102227
+ const notes = new PdfDiagnosticSet();
102228
+ const sx = options.pageWidth / options.canvasWidth;
102229
+ const sy = options.pageHeight / options.canvasHeight;
102230
+ page.concat([sx, 0, 0, -sy, 0, options.pageHeight]);
102231
+ page.rect(0, 0, options.canvasWidth, options.canvasHeight);
102232
+ page.op("W n");
102233
+ const fonts = {
102234
+ set: options.fonts,
102235
+ textLayer: options.fonts?.textLayer ?? new PdfTextLayerFont()
102236
+ };
102237
+ for (const item4 of items) paintItem(page, item4, fonts, notes);
102238
+ return { page, diagnostics: notes.toArray() };
102239
+ }
102240
+
102016
102241
  // src/pptx/export/pdf-vector-text.ts
102017
102242
  var COMPLEX_SCRIPT = new RegExp(
102018
102243
  "[\u0590-\u08FF\u0900-\u0DFF\u0F00-\u0FFF\u1000-\u109F\u1780-\u17FF\u1800-\u18AF\uA840-\uA87F\uFB1D-\uFDFF\uFE70-\uFEFF\u200F\u202B\u202E]|\u200D|\\p{M}",
@@ -102049,10 +102274,15 @@ function ascentRatio(family2, bold, italic, fonts) {
102049
102274
  function measureTextNode(node, style, context3, tokenBudget) {
102050
102275
  const raw = node.data;
102051
102276
  if (!raw.trim()) return { items: [], tokens: 0 };
102052
- if (!/^horizontal/.test(style.writingMode || "horizontal-tb"))
102053
- return { items: [], tokens: 0, raster: "verticalTextAsPicture" };
102277
+ const vertical2 = !/^horizontal/.test(style.writingMode || "horizontal-tb");
102054
102278
  const display = applyTextTransform(raw, style.textTransform);
102055
102279
  const shaping = needsShaping(display);
102280
+ const weight = style.fontWeight;
102281
+ const bold = weight === "bold" || Number.parseInt(weight, 10) >= 600;
102282
+ const italic = /italic|oblique/.test(style.fontStyle);
102283
+ const family2 = style.fontFamily;
102284
+ const noFont = !shaping && !context3.invisible && !canWritePdfText(display.replace(/\s+/g, " ").trim(), family2, bold, italic, context3.fonts);
102285
+ const picture = vertical2 || shaping || noFont;
102056
102286
  const color = cssColor(style.getPropertyValue("-webkit-text-fill-color") || style.color);
102057
102287
  if (color === void 0) return { items: [], tokens: 0, raster: "textColourAsPicture" };
102058
102288
  const doc = node.ownerDocument;
@@ -102076,7 +102306,7 @@ function measureTextNode(node, style, context3, tokenBudget) {
102076
102306
  range.setStart(node, start);
102077
102307
  range.setEnd(node, end);
102078
102308
  const rects = rectsOf(range);
102079
- if (rects.length === 1) {
102309
+ if (rects.length === 1 && (!vertical2 || end - start === 1)) {
102080
102310
  const r = rects[0];
102081
102311
  tokens.push(token(start, end, r));
102082
102312
  continue;
@@ -102092,10 +102322,6 @@ function measureTextNode(node, style, context3, tokenBudget) {
102092
102322
  range.detach?.();
102093
102323
  if (!tokens.length) return { items: [], tokens: words.length };
102094
102324
  const size2 = Number.parseFloat(style.fontSize) || 16;
102095
- const weight = style.fontWeight;
102096
- const bold = weight === "bold" || Number.parseInt(weight, 10) >= 600;
102097
- const italic = /italic|oblique/.test(style.fontStyle);
102098
- const family2 = style.fontFamily;
102099
102325
  const ratio = ascentRatio(family2, bold, italic, context3.fonts);
102100
102326
  const decoration = style.textDecorationLine || "";
102101
102327
  const justify = /justify/.test(style.textAlign);
@@ -102122,13 +102348,13 @@ function measureTextNode(node, style, context3, tokenBudget) {
102122
102348
  color: color ?? { r: 0, g: 0, b: 0, a: 0 },
102123
102349
  ...decoration.includes("underline") ? { underline: true } : {},
102124
102350
  ...decoration.includes("line-through") ? { strike: true } : {},
102125
- ...context3.invisible || shaping || !color ? { invisible: true } : {}
102351
+ ...context3.invisible || picture || !color ? { invisible: true } : {}
102126
102352
  });
102127
102353
  };
102128
102354
  let group = [];
102129
102355
  for (const token2 of tokens) {
102130
102356
  const previous = group[group.length - 1];
102131
- 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.
102357
+ 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.
102132
102358
  (token2.start === previous.end || display.slice(previous.end, token2.start).trim() === "");
102133
102359
  if (previous && !sameLine) {
102134
102360
  flush(group);
@@ -102140,8 +102366,8 @@ function measureTextNode(node, style, context3, tokenBudget) {
102140
102366
  return {
102141
102367
  items,
102142
102368
  tokens: words.length,
102143
- ...shaping && !context3.invisible ? {
102144
- raster: "complexScriptAsPicture"
102369
+ ...picture && !context3.invisible ? {
102370
+ raster: vertical2 ? "verticalTextAsPicture" : shaping ? "complexScriptAsPicture" : "noFontTextAsPicture"
102145
102371
  } : {}
102146
102372
  };
102147
102373
  }
@@ -102328,12 +102554,12 @@ async function collectSlide(stage, options) {
102328
102554
  if (tag === "img" || MEDIA_TAGS.has(tag)) {
102329
102555
  if (!visible || ctx.invisible || !(content.w > 0 && content.h > 0)) return;
102330
102556
  const media = el;
102331
- const natural = tag === "img" ? [media.naturalWidth, media.naturalHeight] : tag === "video" ? [media.videoWidth, media.videoHeight] : [media.width, media.height];
102557
+ const natural = tag === "img" ? [media.naturalWidth, media.naturalHeight] : [media.width, media.height];
102332
102558
  if (tag !== "img") notes.add(MEDIA_REASON);
102333
102559
  const item4 = placeholderImage(matrix, [...clips, boxClip(matrix, content)], alpha, content);
102334
102560
  items.push(item4);
102335
102561
  const fit = style.objectFit === "cover" ? "cover" : style.objectFit === "contain" ? "contain" : "fill";
102336
- const load = () => drawableToPdfImage(doc, media, natural[0] ?? 0, natural[1] ?? 0);
102562
+ const load = () => tag === "video" ? videoPicture(doc, media) : drawableToPdfImage(doc, media, natural[0] ?? 0, natural[1] ?? 0);
102337
102563
  pending4.push({
102338
102564
  item: item4,
102339
102565
  fit,
@@ -102374,6 +102600,7 @@ async function collectSlide(stage, options) {
102374
102600
  });
102375
102601
  children.sort((a, b) => a.z - b.z || a.index - b.index);
102376
102602
  let shadowDone = false;
102603
+ let textPicture = false;
102377
102604
  for (const { node } of children) {
102378
102605
  if (picture) return;
102379
102606
  if (node.nodeType === 1) {
@@ -102406,7 +102633,9 @@ async function collectSlide(stage, options) {
102406
102633
  return;
102407
102634
  }
102408
102635
  if (result.raster) {
102409
- raster(el, "subtree", ctx.matrix, boxOf2(el), 4, result.raster);
102636
+ if (!textPicture) raster(el, "subtree", ctx.matrix, boxOf2(el), 4, result.raster);
102637
+ else notes.add(result.raster);
102638
+ textPicture = true;
102410
102639
  items.push(...result.items.map((item4) => ({ ...item4, invisible: true })));
102411
102640
  } else items.push(...result.items);
102412
102641
  }
@@ -102478,135 +102707,6 @@ async function collectSlide(stage, options) {
102478
102707
  };
102479
102708
  }
102480
102709
 
102481
- // src/pptx/export/pdf-vector-paint.ts
102482
- function primaryFamily(family2) {
102483
- const first = family2.split(",")[0] ?? "";
102484
- return first.trim().replace(/^['"]|['"]$/g, "");
102485
- }
102486
- function resolvePdfTextFont(text5, family2, bold, italic, fonts) {
102487
- if (fonts?.has(family2)) {
102488
- const font = fonts.pick(family2, bold, italic, text5);
102489
- if (font) return { kind: "embedded", font, named: true };
102490
- }
102491
- const encoded = encodeWinAnsi(text5);
102492
- if (encoded !== void 0)
102493
- return { kind: "standard", baseFont: pdfBaseFont(family2, bold, italic), encoded };
102494
- const fallback = fonts?.pick(family2, bold, italic, text5);
102495
- return fallback ? { kind: "embedded", font: fallback, named: false } : void 0;
102496
- }
102497
- function clipTo(page, clip) {
102498
- const segments = visio.parsePath(clip.d);
102499
- if (!segments) return;
102500
- const [a, b, c, d, e, f] = clip.matrix;
102501
- const det = a * d - b * c;
102502
- if (!segments.length || Math.abs(det) < 1e-12) {
102503
- page.rect(0, 0, 0, 0);
102504
- page.op("W n");
102505
- return;
102506
- }
102507
- page.concat(clip.matrix);
102508
- for (const operator of pathOperators(segments)) page.op(operator);
102509
- page.op(clip.evenOdd ? "W* n" : "W n");
102510
- page.concat([d / det, -b / det, -c / det, a / det, (c * f - d * e) / det, (b * e - a * f) / det]);
102511
- }
102512
- function paintText(page, item4, fonts, notes) {
102513
- const font = resolvePdfTextFont(item4.text, item4.family, item4.bold, item4.italic, fonts);
102514
- if (!font) {
102515
- notes.add("unsearchableText");
102516
- return;
102517
- }
102518
- const family2 = primaryFamily(item4.family) || "";
102519
- if (font.kind === "standard" && !item4.invisible)
102520
- notes.add("fontStandard", { family: family2, substitute: font.baseFont.split("-")[0] ?? "" });
102521
- else if (font.kind === "embedded" && !font.named && !item4.invisible)
102522
- notes.add("fontSubstituted", { family: family2, substitute: font.font.family });
102523
- const natural = (font.kind === "embedded" ? font.font.width(item4.text) : pdfTextWidth(font.encoded, font.baseFont)) * item4.size;
102524
- const scale3 = natural > 0 && item4.width > 0 ? Math.min(400, Math.max(25, item4.width / natural * 100)) : 100;
102525
- const spacing = { scale: scale3, ...item4.invisible ? { invisible: true } : {} };
102526
- page.fillColor(item4.color.r, item4.color.g, item4.color.b);
102527
- const alpha = item4.alpha * item4.color.a;
102528
- if (alpha < 1) page.alpha(alpha);
102529
- if (font.kind === "embedded")
102530
- page.embeddedText(font.font, item4.size, item4.x, item4.baseline, item4.text, spacing);
102531
- else page.text(font.baseFont, item4.size, item4.x, item4.baseline, font.encoded, spacing);
102532
- if (item4.invisible) return;
102533
- const thickness = Math.max(0.5, item4.size * 0.06);
102534
- if (item4.underline) {
102535
- page.rect(item4.x, item4.baseline + item4.size * 0.12, item4.width, thickness);
102536
- page.op("f");
102537
- }
102538
- if (item4.strike) {
102539
- page.rect(item4.x, item4.baseline - item4.size * 0.3, item4.width, thickness);
102540
- page.op("f");
102541
- }
102542
- }
102543
- function paintItem(page, item4, fonts, notes) {
102544
- page.save();
102545
- for (const clip of item4.clips) clipTo(page, clip);
102546
- page.concat(item4.matrix);
102547
- switch (item4.kind) {
102548
- case "path": {
102549
- const segments = visio.parsePath(item4.d);
102550
- if (!segments?.length) break;
102551
- const evenOdd = item4.evenOdd ? "*" : "";
102552
- if (item4.shading) {
102553
- page.save();
102554
- const alpha = item4.alpha * item4.shading.opacity;
102555
- if (alpha < 1) page.alpha(alpha, 1);
102556
- for (const operator of pathOperators(segments)) page.op(operator);
102557
- page.op(`W${evenOdd} n`);
102558
- for (const matrix of item4.shading.matrices) page.concat(matrix);
102559
- page.paintShading(item4.shading.shading);
102560
- page.restore();
102561
- }
102562
- const fill3 = item4.fill && item4.fill.a > 0 ? item4.fill : void 0;
102563
- const stroke = item4.stroke && item4.stroke.color.a > 0 && item4.stroke.width > 0;
102564
- if (!fill3 && !stroke) break;
102565
- const fillAlpha = fill3 ? item4.alpha * fill3.a : 1;
102566
- const strokeAlpha = item4.stroke ? item4.alpha * item4.stroke.color.a : 1;
102567
- if (fillAlpha < 1 || strokeAlpha < 1) page.alpha(fillAlpha, strokeAlpha);
102568
- if (fill3) page.fillColor(fill3.r, fill3.g, fill3.b);
102569
- if (stroke && item4.stroke) {
102570
- const s = item4.stroke;
102571
- page.strokeColor(s.color.r, s.color.g, s.color.b);
102572
- page.lineStyle(s.width, s.cap, s.join, s.dash);
102573
- }
102574
- for (const operator of pathOperators(segments)) page.op(operator);
102575
- page.op(fill3 && stroke ? `B${evenOdd}` : fill3 ? `f${evenOdd}` : "S");
102576
- break;
102577
- }
102578
- case "image":
102579
- if (!(item4.width > 0 && item4.height > 0)) break;
102580
- if (item4.alpha < 1) page.alpha(item4.alpha);
102581
- page.concat([item4.width, 0, 0, -item4.height, item4.x, item4.y + item4.height]);
102582
- page.drawImage(item4.image);
102583
- break;
102584
- case "text":
102585
- paintText(page, item4, fonts, notes);
102586
- break;
102587
- case "svg":
102588
- try {
102589
- for (const note of drawSvgSubtree(page, item4.svg, item4.images, fonts, item4.alpha))
102590
- notes.add(note);
102591
- } catch {
102592
- notes.add("drawingPartMissing");
102593
- }
102594
- break;
102595
- }
102596
- page.restore();
102597
- }
102598
- function paintSlide(items, options) {
102599
- const page = new PdfVectorPage(options.pageWidth, options.pageHeight);
102600
- const notes = new PdfDiagnosticSet();
102601
- const sx = options.pageWidth / options.canvasWidth;
102602
- const sy = options.pageHeight / options.canvasHeight;
102603
- page.concat([sx, 0, 0, -sy, 0, options.pageHeight]);
102604
- page.rect(0, 0, options.canvasWidth, options.canvasHeight);
102605
- page.op("W n");
102606
- for (const item4 of items) paintItem(page, item4, options.fonts, notes);
102607
- return { page, diagnostics: notes.toArray() };
102608
- }
102609
-
102610
102710
  // src/pptx/export/pdf-vector-export.ts
102611
102711
  var abortError = () => new DOMException("Export cancelled", "AbortError");
102612
102712
  async function exportSlidesVectorPdf(options) {
@@ -102690,7 +102790,9 @@ async function exportSlidesVectorPdf(options) {
102690
102790
  options.onProgress?.(indexes.length, indexes.length);
102691
102791
  const bytes = buildVectorPdf(pages, options.title ? { title: options.title } : {});
102692
102792
  const embedded = new Set(
102693
- pages.flatMap((page) => [...page.embeddedFonts.values()].map((font) => font.family))
102793
+ pages.flatMap(
102794
+ (page) => [...page.embeddedFonts.values()].filter((font) => font !== fonts.textLayer).map((font) => font.family)
102795
+ )
102694
102796
  );
102695
102797
  return {
102696
102798
  blob: new Blob([bytes], { type: "application/pdf" }),