pptx-glimpse 0.10.0 → 0.10.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 (3) hide show
  1. package/dist/index.cjs +117 -17
  2. package/dist/index.js +117 -17
  3. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -2044,6 +2044,17 @@ function parseDefaultRunProperties(defRPr, colorResolver) {
2044
2044
  }
2045
2045
  return Object.keys(result).length > 0 ? result : void 0;
2046
2046
  }
2047
+ var VALID_AUTO_NUM_SCHEMES = /* @__PURE__ */ new Set([
2048
+ "arabicPeriod",
2049
+ "arabicParenR",
2050
+ "romanUcPeriod",
2051
+ "romanLcPeriod",
2052
+ "alphaUcPeriod",
2053
+ "alphaLcPeriod",
2054
+ "alphaLcParenR",
2055
+ "alphaUcParenR",
2056
+ "arabicPlain"
2057
+ ]);
2047
2058
  function parseParagraphLevelProperties(node, colorResolver) {
2048
2059
  if (!node) return void 0;
2049
2060
  const result = {};
@@ -2056,6 +2067,36 @@ function parseParagraphLevelProperties(node, colorResolver) {
2056
2067
  if (node["@_indent"] !== void 0) {
2057
2068
  result.indent = asEmu(Number(node["@_indent"]));
2058
2069
  }
2070
+ if (node.buNone !== void 0) {
2071
+ result.bullet = { type: "none" };
2072
+ } else if (node.buChar) {
2073
+ const buChar = node.buChar;
2074
+ result.bullet = { type: "char", char: buChar["@_char"] ?? "\u2022" };
2075
+ } else if (node.buAutoNum) {
2076
+ const buAutoNum = node.buAutoNum;
2077
+ const scheme = buAutoNum["@_type"] ?? "arabicPeriod";
2078
+ result.bullet = {
2079
+ type: "autoNum",
2080
+ scheme: VALID_AUTO_NUM_SCHEMES.has(scheme) ? scheme : "arabicPeriod",
2081
+ startAt: Number(buAutoNum["@_startAt"] ?? 1)
2082
+ };
2083
+ }
2084
+ if (node.buFont) {
2085
+ const buFont = node.buFont;
2086
+ const typeface = buFont["@_typeface"] ?? null;
2087
+ if (typeface) result.bulletFont = typeface;
2088
+ }
2089
+ if (colorResolver) {
2090
+ const buClr = node.buClr;
2091
+ if (buClr) {
2092
+ const color = colorResolver.resolve(buClr);
2093
+ if (color) result.bulletColor = color;
2094
+ }
2095
+ }
2096
+ const buSzPct = node.buSzPct;
2097
+ if (buSzPct) {
2098
+ result.bulletSizePct = Number(buSzPct["@_val"]);
2099
+ }
2059
2100
  const defRPr = parseDefaultRunProperties(node.defRPr, colorResolver);
2060
2101
  if (defRPr) {
2061
2102
  result.defaultRunProperties = defRPr;
@@ -3921,7 +3962,7 @@ function parseTextBody(txBody, colorResolver, rels, fontScheme, lstStyleOverride
3921
3962
  if (paragraphs.length === 0) return null;
3922
3963
  return { paragraphs, bodyProperties };
3923
3964
  }
3924
- var VALID_AUTO_NUM_SCHEMES = /* @__PURE__ */ new Set([
3965
+ var VALID_AUTO_NUM_SCHEMES2 = /* @__PURE__ */ new Set([
3925
3966
  "arabicPeriod",
3926
3967
  "arabicParenR",
3927
3968
  "romanUcPeriod",
@@ -3950,7 +3991,7 @@ function parseBullet(pPr, colorResolver) {
3950
3991
  const scheme = buAutoNum["@_type"] ?? "arabicPeriod";
3951
3992
  bullet = {
3952
3993
  type: "autoNum",
3953
- scheme: VALID_AUTO_NUM_SCHEMES.has(scheme) ? scheme : "arabicPeriod",
3994
+ scheme: VALID_AUTO_NUM_SCHEMES2.has(scheme) ? scheme : "arabicPeriod",
3954
3995
  startAt: Number(buAutoNum["@_startAt"] ?? 1)
3955
3996
  };
3956
3997
  }
@@ -4024,12 +4065,12 @@ function parseParagraph(p, colorResolver, rels, fontScheme, lstStyle, orderedPCh
4024
4065
  spaceBefore: parseSpacing(pPr?.spcBef),
4025
4066
  spaceAfter: parseSpacing(pPr?.spcAft),
4026
4067
  level,
4027
- bullet,
4028
- bulletFont,
4029
- bulletColor,
4030
- bulletSizePct,
4031
- marginLeft: pPr?.["@_marL"] !== void 0 ? asEmu(Number(pPr["@_marL"])) : lstLevelProps?.marginLeft ?? asEmu(0),
4032
- indent: pPr?.["@_indent"] !== void 0 ? asEmu(Number(pPr["@_indent"])) : lstLevelProps?.indent ?? asEmu(0),
4068
+ bullet: bullet ?? lstLevelProps?.bullet ?? null,
4069
+ bulletFont: bulletFont ?? lstLevelProps?.bulletFont ?? null,
4070
+ bulletColor: bulletColor ?? lstLevelProps?.bulletColor ?? null,
4071
+ bulletSizePct: bulletSizePct ?? lstLevelProps?.bulletSizePct ?? null,
4072
+ marginLeft: pPr?.["@_marL"] !== void 0 ? asEmu(Number(pPr["@_marL"])) : lstLevelProps?.marginLeft ?? null,
4073
+ indent: pPr?.["@_indent"] !== void 0 ? asEmu(Number(pPr["@_indent"])) : lstLevelProps?.indent ?? null,
4033
4074
  tabStops
4034
4075
  };
4035
4076
  const pPrDefRPr = parseDefaultRunProperties(pPr?.defRPr);
@@ -4186,7 +4227,8 @@ function parseRunProperties(rPr, colorResolver, rels, fontScheme, defaults) {
4186
4227
  );
4187
4228
  const bold = rPr["@_b"] !== void 0 ? rPr["@_b"] === "1" || rPr["@_b"] === "true" : defaults?.bold ?? false;
4188
4229
  const italic = rPr["@_i"] !== void 0 ? rPr["@_i"] === "1" || rPr["@_i"] === "true" : defaults?.italic ?? false;
4189
- const underline = rPr["@_u"] !== void 0 ? rPr["@_u"] !== "none" : defaults?.underline ?? false;
4230
+ const hasExplicitUnderline = rPr["@_u"] !== void 0;
4231
+ let underline = hasExplicitUnderline ? rPr["@_u"] !== "none" : defaults?.underline ?? false;
4190
4232
  const strikethrough = rPr["@_strike"] !== void 0 ? rPr["@_strike"] !== "noStrike" : defaults?.strikethrough ?? false;
4191
4233
  const baseline = rPr["@_baseline"] ? Number(rPr["@_baseline"]) / 1e3 : 0;
4192
4234
  const solidFill = rPr.solidFill;
@@ -4195,6 +4237,14 @@ function parseRunProperties(rPr, colorResolver, rels, fontScheme, defaults) {
4195
4237
  color = null;
4196
4238
  }
4197
4239
  const hyperlink = parseHyperlink(rPr.hlinkClick, rels);
4240
+ if (hyperlink) {
4241
+ if (!color) {
4242
+ color = colorResolver.resolve({ schemeClr: { "@_val": "hlink" } });
4243
+ }
4244
+ if (!hasExplicitUnderline && !underline) {
4245
+ underline = true;
4246
+ }
4247
+ }
4198
4248
  const ln = rPr.ln;
4199
4249
  let outline = null;
4200
4250
  if (ln) {
@@ -4716,6 +4766,51 @@ function resolveShapeTextInheritance(shape, context) {
4716
4766
  paragraph.properties.alignment = "l";
4717
4767
  }
4718
4768
  }
4769
+ if (paragraph.properties.bullet === null) {
4770
+ for (const source of chainSources) {
4771
+ if (!source) continue;
4772
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4773
+ if (!levelProps?.bullet) continue;
4774
+ paragraph.properties.bullet = levelProps.bullet;
4775
+ break;
4776
+ }
4777
+ }
4778
+ const hasBullet = paragraph.properties.bullet !== null && paragraph.properties.bullet.type !== "none";
4779
+ if (hasBullet && (paragraph.properties.bulletFont === null || paragraph.properties.bulletColor === null || paragraph.properties.bulletSizePct === null)) {
4780
+ for (const source of chainSources) {
4781
+ if (!source) continue;
4782
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4783
+ if (!levelProps) continue;
4784
+ if (paragraph.properties.bulletFont === null && levelProps.bulletFont) {
4785
+ paragraph.properties.bulletFont = levelProps.bulletFont;
4786
+ }
4787
+ if (paragraph.properties.bulletColor === null && levelProps.bulletColor) {
4788
+ paragraph.properties.bulletColor = levelProps.bulletColor;
4789
+ }
4790
+ if (paragraph.properties.bulletSizePct === null && levelProps.bulletSizePct) {
4791
+ paragraph.properties.bulletSizePct = levelProps.bulletSizePct;
4792
+ }
4793
+ if (paragraph.properties.bulletFont !== null && paragraph.properties.bulletColor !== null && paragraph.properties.bulletSizePct !== null) {
4794
+ break;
4795
+ }
4796
+ }
4797
+ }
4798
+ if (paragraph.properties.marginLeft === null || paragraph.properties.indent === null) {
4799
+ for (const source of chainSources) {
4800
+ if (!source) continue;
4801
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4802
+ if (!levelProps) continue;
4803
+ if (paragraph.properties.marginLeft === null && levelProps.marginLeft !== void 0) {
4804
+ paragraph.properties.marginLeft = levelProps.marginLeft;
4805
+ }
4806
+ if (paragraph.properties.indent === null && levelProps.indent !== void 0) {
4807
+ paragraph.properties.indent = levelProps.indent;
4808
+ }
4809
+ if (paragraph.properties.marginLeft !== null && paragraph.properties.indent !== null) {
4810
+ break;
4811
+ }
4812
+ }
4813
+ }
4719
4814
  for (const run of paragraph.runs) {
4720
4815
  const props = run.properties;
4721
4816
  for (const source of chainSources) {
@@ -7691,8 +7786,8 @@ function renderTextBody(textBody, transform) {
7691
7786
  const autoNumCounters = /* @__PURE__ */ new Map();
7692
7787
  let prevSpaceAfterPx = 0;
7693
7788
  for (const para of paragraphs) {
7694
- const paraMarginLeft = emuToPixels(para.properties.marginLeft);
7695
- const paraIndent = emuToPixels(para.properties.indent);
7789
+ const paraMarginLeft = emuToPixels(para.properties.marginLeft ?? asEmu(0));
7790
+ const paraIndent = emuToPixels(para.properties.indent ?? asEmu(0));
7696
7791
  const textStartX = marginLeftPx + paraMarginLeft;
7697
7792
  const bulletX = textStartX + paraIndent;
7698
7793
  const effectiveTextWidth = textWidth - paraMarginLeft;
@@ -8393,13 +8488,13 @@ function renderSegmentAsPath(text, props, x, y, fontScale, defaultFontSize, font
8393
8488
  }
8394
8489
  return { svg, width: totalWidth };
8395
8490
  }
8396
- function renderBulletAsPath(bulletText, x, y, paraProps, textFontSizePt, fontScale, fontResolver) {
8491
+ function renderBulletAsPath(bulletText, x, y, paraProps, textFontSizePt, fontScale, fontResolver, runFontFamily, runFontFamilyEa) {
8397
8492
  let bulletFontSize = textFontSizePt;
8398
8493
  if (paraProps.bulletSizePct !== null) {
8399
8494
  bulletFontSize = textFontSizePt * (paraProps.bulletSizePct / 1e5);
8400
8495
  }
8401
8496
  const fontSizePx = bulletFontSize * PX_PER_PT3;
8402
- const font = fontResolver.resolveFont(paraProps.bulletFont, null);
8497
+ const font = paraProps.bulletFont ? fontResolver.resolveFont(paraProps.bulletFont, null) : fontResolver.resolveFont(runFontFamily ?? null, runFontFamilyEa ?? null);
8403
8498
  if (!font) return [];
8404
8499
  const path = font.getPath(bulletText, x, y, fontSizePx);
8405
8500
  const pathData = path.toPathData(2);
@@ -8467,8 +8562,8 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8467
8562
  const autoNumCounters = /* @__PURE__ */ new Map();
8468
8563
  let prevSpaceAfterPx = 0;
8469
8564
  for (const para of paragraphs) {
8470
- const paraMarginLeft = emuToPixels(para.properties.marginLeft);
8471
- const paraIndent = emuToPixels(para.properties.indent);
8565
+ const paraMarginLeft = emuToPixels(para.properties.marginLeft ?? asEmu(0));
8566
+ const paraIndent = emuToPixels(para.properties.indent ?? asEmu(0));
8472
8567
  const textStartX = marginLeftPx + paraMarginLeft;
8473
8568
  const bulletX = textStartX + paraIndent;
8474
8569
  const effectiveTextWidth = textWidth - paraMarginLeft;
@@ -8522,6 +8617,7 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8522
8617
  let currentX = lineStartX;
8523
8618
  if (lineIdx === 0 && bulletText) {
8524
8619
  const lineFontSize = getLineFontSize(line.segments, defaultFontSize) * fontScale;
8620
+ const firstSeg = line.segments[0];
8525
8621
  elements.push(
8526
8622
  ...renderBulletAsPath(
8527
8623
  bulletText,
@@ -8530,7 +8626,9 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8530
8626
  para.properties,
8531
8627
  lineFontSize,
8532
8628
  fontScale,
8533
- fontResolver
8629
+ fontResolver,
8630
+ firstSeg?.properties.fontFamily,
8631
+ firstSeg?.properties.fontFamilyEa
8534
8632
  )
8535
8633
  );
8536
8634
  }
@@ -8577,7 +8675,9 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8577
8675
  para.properties,
8578
8676
  fontSize,
8579
8677
  fontScale,
8580
- fontResolver
8678
+ fontResolver,
8679
+ firstRun?.properties.fontFamily,
8680
+ firstRun?.properties.fontFamilyEa
8581
8681
  )
8582
8682
  );
8583
8683
  }
package/dist/index.js CHANGED
@@ -2006,6 +2006,17 @@ function parseDefaultRunProperties(defRPr, colorResolver) {
2006
2006
  }
2007
2007
  return Object.keys(result).length > 0 ? result : void 0;
2008
2008
  }
2009
+ var VALID_AUTO_NUM_SCHEMES = /* @__PURE__ */ new Set([
2010
+ "arabicPeriod",
2011
+ "arabicParenR",
2012
+ "romanUcPeriod",
2013
+ "romanLcPeriod",
2014
+ "alphaUcPeriod",
2015
+ "alphaLcPeriod",
2016
+ "alphaLcParenR",
2017
+ "alphaUcParenR",
2018
+ "arabicPlain"
2019
+ ]);
2009
2020
  function parseParagraphLevelProperties(node, colorResolver) {
2010
2021
  if (!node) return void 0;
2011
2022
  const result = {};
@@ -2018,6 +2029,36 @@ function parseParagraphLevelProperties(node, colorResolver) {
2018
2029
  if (node["@_indent"] !== void 0) {
2019
2030
  result.indent = asEmu(Number(node["@_indent"]));
2020
2031
  }
2032
+ if (node.buNone !== void 0) {
2033
+ result.bullet = { type: "none" };
2034
+ } else if (node.buChar) {
2035
+ const buChar = node.buChar;
2036
+ result.bullet = { type: "char", char: buChar["@_char"] ?? "\u2022" };
2037
+ } else if (node.buAutoNum) {
2038
+ const buAutoNum = node.buAutoNum;
2039
+ const scheme = buAutoNum["@_type"] ?? "arabicPeriod";
2040
+ result.bullet = {
2041
+ type: "autoNum",
2042
+ scheme: VALID_AUTO_NUM_SCHEMES.has(scheme) ? scheme : "arabicPeriod",
2043
+ startAt: Number(buAutoNum["@_startAt"] ?? 1)
2044
+ };
2045
+ }
2046
+ if (node.buFont) {
2047
+ const buFont = node.buFont;
2048
+ const typeface = buFont["@_typeface"] ?? null;
2049
+ if (typeface) result.bulletFont = typeface;
2050
+ }
2051
+ if (colorResolver) {
2052
+ const buClr = node.buClr;
2053
+ if (buClr) {
2054
+ const color = colorResolver.resolve(buClr);
2055
+ if (color) result.bulletColor = color;
2056
+ }
2057
+ }
2058
+ const buSzPct = node.buSzPct;
2059
+ if (buSzPct) {
2060
+ result.bulletSizePct = Number(buSzPct["@_val"]);
2061
+ }
2021
2062
  const defRPr = parseDefaultRunProperties(node.defRPr, colorResolver);
2022
2063
  if (defRPr) {
2023
2064
  result.defaultRunProperties = defRPr;
@@ -3883,7 +3924,7 @@ function parseTextBody(txBody, colorResolver, rels, fontScheme, lstStyleOverride
3883
3924
  if (paragraphs.length === 0) return null;
3884
3925
  return { paragraphs, bodyProperties };
3885
3926
  }
3886
- var VALID_AUTO_NUM_SCHEMES = /* @__PURE__ */ new Set([
3927
+ var VALID_AUTO_NUM_SCHEMES2 = /* @__PURE__ */ new Set([
3887
3928
  "arabicPeriod",
3888
3929
  "arabicParenR",
3889
3930
  "romanUcPeriod",
@@ -3912,7 +3953,7 @@ function parseBullet(pPr, colorResolver) {
3912
3953
  const scheme = buAutoNum["@_type"] ?? "arabicPeriod";
3913
3954
  bullet = {
3914
3955
  type: "autoNum",
3915
- scheme: VALID_AUTO_NUM_SCHEMES.has(scheme) ? scheme : "arabicPeriod",
3956
+ scheme: VALID_AUTO_NUM_SCHEMES2.has(scheme) ? scheme : "arabicPeriod",
3916
3957
  startAt: Number(buAutoNum["@_startAt"] ?? 1)
3917
3958
  };
3918
3959
  }
@@ -3986,12 +4027,12 @@ function parseParagraph(p, colorResolver, rels, fontScheme, lstStyle, orderedPCh
3986
4027
  spaceBefore: parseSpacing(pPr?.spcBef),
3987
4028
  spaceAfter: parseSpacing(pPr?.spcAft),
3988
4029
  level,
3989
- bullet,
3990
- bulletFont,
3991
- bulletColor,
3992
- bulletSizePct,
3993
- marginLeft: pPr?.["@_marL"] !== void 0 ? asEmu(Number(pPr["@_marL"])) : lstLevelProps?.marginLeft ?? asEmu(0),
3994
- indent: pPr?.["@_indent"] !== void 0 ? asEmu(Number(pPr["@_indent"])) : lstLevelProps?.indent ?? asEmu(0),
4030
+ bullet: bullet ?? lstLevelProps?.bullet ?? null,
4031
+ bulletFont: bulletFont ?? lstLevelProps?.bulletFont ?? null,
4032
+ bulletColor: bulletColor ?? lstLevelProps?.bulletColor ?? null,
4033
+ bulletSizePct: bulletSizePct ?? lstLevelProps?.bulletSizePct ?? null,
4034
+ marginLeft: pPr?.["@_marL"] !== void 0 ? asEmu(Number(pPr["@_marL"])) : lstLevelProps?.marginLeft ?? null,
4035
+ indent: pPr?.["@_indent"] !== void 0 ? asEmu(Number(pPr["@_indent"])) : lstLevelProps?.indent ?? null,
3995
4036
  tabStops
3996
4037
  };
3997
4038
  const pPrDefRPr = parseDefaultRunProperties(pPr?.defRPr);
@@ -4148,7 +4189,8 @@ function parseRunProperties(rPr, colorResolver, rels, fontScheme, defaults) {
4148
4189
  );
4149
4190
  const bold = rPr["@_b"] !== void 0 ? rPr["@_b"] === "1" || rPr["@_b"] === "true" : defaults?.bold ?? false;
4150
4191
  const italic = rPr["@_i"] !== void 0 ? rPr["@_i"] === "1" || rPr["@_i"] === "true" : defaults?.italic ?? false;
4151
- const underline = rPr["@_u"] !== void 0 ? rPr["@_u"] !== "none" : defaults?.underline ?? false;
4192
+ const hasExplicitUnderline = rPr["@_u"] !== void 0;
4193
+ let underline = hasExplicitUnderline ? rPr["@_u"] !== "none" : defaults?.underline ?? false;
4152
4194
  const strikethrough = rPr["@_strike"] !== void 0 ? rPr["@_strike"] !== "noStrike" : defaults?.strikethrough ?? false;
4153
4195
  const baseline = rPr["@_baseline"] ? Number(rPr["@_baseline"]) / 1e3 : 0;
4154
4196
  const solidFill = rPr.solidFill;
@@ -4157,6 +4199,14 @@ function parseRunProperties(rPr, colorResolver, rels, fontScheme, defaults) {
4157
4199
  color = null;
4158
4200
  }
4159
4201
  const hyperlink = parseHyperlink(rPr.hlinkClick, rels);
4202
+ if (hyperlink) {
4203
+ if (!color) {
4204
+ color = colorResolver.resolve({ schemeClr: { "@_val": "hlink" } });
4205
+ }
4206
+ if (!hasExplicitUnderline && !underline) {
4207
+ underline = true;
4208
+ }
4209
+ }
4160
4210
  const ln = rPr.ln;
4161
4211
  let outline = null;
4162
4212
  if (ln) {
@@ -4678,6 +4728,51 @@ function resolveShapeTextInheritance(shape, context) {
4678
4728
  paragraph.properties.alignment = "l";
4679
4729
  }
4680
4730
  }
4731
+ if (paragraph.properties.bullet === null) {
4732
+ for (const source of chainSources) {
4733
+ if (!source) continue;
4734
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4735
+ if (!levelProps?.bullet) continue;
4736
+ paragraph.properties.bullet = levelProps.bullet;
4737
+ break;
4738
+ }
4739
+ }
4740
+ const hasBullet = paragraph.properties.bullet !== null && paragraph.properties.bullet.type !== "none";
4741
+ if (hasBullet && (paragraph.properties.bulletFont === null || paragraph.properties.bulletColor === null || paragraph.properties.bulletSizePct === null)) {
4742
+ for (const source of chainSources) {
4743
+ if (!source) continue;
4744
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4745
+ if (!levelProps) continue;
4746
+ if (paragraph.properties.bulletFont === null && levelProps.bulletFont) {
4747
+ paragraph.properties.bulletFont = levelProps.bulletFont;
4748
+ }
4749
+ if (paragraph.properties.bulletColor === null && levelProps.bulletColor) {
4750
+ paragraph.properties.bulletColor = levelProps.bulletColor;
4751
+ }
4752
+ if (paragraph.properties.bulletSizePct === null && levelProps.bulletSizePct) {
4753
+ paragraph.properties.bulletSizePct = levelProps.bulletSizePct;
4754
+ }
4755
+ if (paragraph.properties.bulletFont !== null && paragraph.properties.bulletColor !== null && paragraph.properties.bulletSizePct !== null) {
4756
+ break;
4757
+ }
4758
+ }
4759
+ }
4760
+ if (paragraph.properties.marginLeft === null || paragraph.properties.indent === null) {
4761
+ for (const source of chainSources) {
4762
+ if (!source) continue;
4763
+ const levelProps = source.levels[level] ?? source.defaultParagraph;
4764
+ if (!levelProps) continue;
4765
+ if (paragraph.properties.marginLeft === null && levelProps.marginLeft !== void 0) {
4766
+ paragraph.properties.marginLeft = levelProps.marginLeft;
4767
+ }
4768
+ if (paragraph.properties.indent === null && levelProps.indent !== void 0) {
4769
+ paragraph.properties.indent = levelProps.indent;
4770
+ }
4771
+ if (paragraph.properties.marginLeft !== null && paragraph.properties.indent !== null) {
4772
+ break;
4773
+ }
4774
+ }
4775
+ }
4681
4776
  for (const run of paragraph.runs) {
4682
4777
  const props = run.properties;
4683
4778
  for (const source of chainSources) {
@@ -7653,8 +7748,8 @@ function renderTextBody(textBody, transform) {
7653
7748
  const autoNumCounters = /* @__PURE__ */ new Map();
7654
7749
  let prevSpaceAfterPx = 0;
7655
7750
  for (const para of paragraphs) {
7656
- const paraMarginLeft = emuToPixels(para.properties.marginLeft);
7657
- const paraIndent = emuToPixels(para.properties.indent);
7751
+ const paraMarginLeft = emuToPixels(para.properties.marginLeft ?? asEmu(0));
7752
+ const paraIndent = emuToPixels(para.properties.indent ?? asEmu(0));
7658
7753
  const textStartX = marginLeftPx + paraMarginLeft;
7659
7754
  const bulletX = textStartX + paraIndent;
7660
7755
  const effectiveTextWidth = textWidth - paraMarginLeft;
@@ -8355,13 +8450,13 @@ function renderSegmentAsPath(text, props, x, y, fontScale, defaultFontSize, font
8355
8450
  }
8356
8451
  return { svg, width: totalWidth };
8357
8452
  }
8358
- function renderBulletAsPath(bulletText, x, y, paraProps, textFontSizePt, fontScale, fontResolver) {
8453
+ function renderBulletAsPath(bulletText, x, y, paraProps, textFontSizePt, fontScale, fontResolver, runFontFamily, runFontFamilyEa) {
8359
8454
  let bulletFontSize = textFontSizePt;
8360
8455
  if (paraProps.bulletSizePct !== null) {
8361
8456
  bulletFontSize = textFontSizePt * (paraProps.bulletSizePct / 1e5);
8362
8457
  }
8363
8458
  const fontSizePx = bulletFontSize * PX_PER_PT3;
8364
- const font = fontResolver.resolveFont(paraProps.bulletFont, null);
8459
+ const font = paraProps.bulletFont ? fontResolver.resolveFont(paraProps.bulletFont, null) : fontResolver.resolveFont(runFontFamily ?? null, runFontFamilyEa ?? null);
8365
8460
  if (!font) return [];
8366
8461
  const path = font.getPath(bulletText, x, y, fontSizePx);
8367
8462
  const pathData = path.toPathData(2);
@@ -8429,8 +8524,8 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8429
8524
  const autoNumCounters = /* @__PURE__ */ new Map();
8430
8525
  let prevSpaceAfterPx = 0;
8431
8526
  for (const para of paragraphs) {
8432
- const paraMarginLeft = emuToPixels(para.properties.marginLeft);
8433
- const paraIndent = emuToPixels(para.properties.indent);
8527
+ const paraMarginLeft = emuToPixels(para.properties.marginLeft ?? asEmu(0));
8528
+ const paraIndent = emuToPixels(para.properties.indent ?? asEmu(0));
8434
8529
  const textStartX = marginLeftPx + paraMarginLeft;
8435
8530
  const bulletX = textStartX + paraIndent;
8436
8531
  const effectiveTextWidth = textWidth - paraMarginLeft;
@@ -8484,6 +8579,7 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8484
8579
  let currentX = lineStartX;
8485
8580
  if (lineIdx === 0 && bulletText) {
8486
8581
  const lineFontSize = getLineFontSize(line.segments, defaultFontSize) * fontScale;
8582
+ const firstSeg = line.segments[0];
8487
8583
  elements.push(
8488
8584
  ...renderBulletAsPath(
8489
8585
  bulletText,
@@ -8492,7 +8588,9 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8492
8588
  para.properties,
8493
8589
  lineFontSize,
8494
8590
  fontScale,
8495
- fontResolver
8591
+ fontResolver,
8592
+ firstSeg?.properties.fontFamily,
8593
+ firstSeg?.properties.fontFamilyEa
8496
8594
  )
8497
8595
  );
8498
8596
  }
@@ -8539,7 +8637,9 @@ function renderTextBodyAsPath(textBody, transform, fontResolver) {
8539
8637
  para.properties,
8540
8638
  fontSize,
8541
8639
  fontScale,
8542
- fontResolver
8640
+ fontResolver,
8641
+ firstRun?.properties.fontFamily,
8642
+ firstRun?.properties.fontFamilyEa
8543
8643
  )
8544
8644
  );
8545
8645
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pptx-glimpse",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "A lightweight JavaScript library for rendering PowerPoint (.pptx) files as SVG or PNG in Node.js. No LibreOffice required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",