@poe-platform/safe-bash 0.1.774 → 0.1.775

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.
@@ -45697,21 +45697,23 @@ function resolvePageFonts(doc, resourcesDict) {
45697
45697
  }
45698
45698
  }
45699
45699
  } else {
45700
- const stdName = normalizeStandard14FontName(baseFont);
45701
- const stdMetrics = STANDARD_14_FONTS[stdName];
45702
- defaultWidth = stdMetrics.defaultWidth;
45703
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
45704
- widths.set(Number(codeStr), wVal);
45705
- }
45706
45700
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
45707
45701
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
45708
- if (firstCharNode?.kind === "number" && widthsArr) {
45702
+ if (widthsArr) {
45703
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
45704
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
45705
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
45706
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
45709
45707
  for (let k = 0; k < widthsArr.items.length; k++) {
45710
45708
  const wItem = doc.resolve(widthsArr.items[k]);
45711
45709
  if (wItem?.kind === "number") {
45712
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
45710
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
45713
45711
  }
45714
45712
  }
45713
+ } else {
45714
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
45715
+ defaultWidth = stdMetrics.defaultWidth;
45716
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
45715
45717
  }
45716
45718
  }
45717
45719
  let embeddedCff;
@@ -46467,13 +46469,11 @@ function evaluateContentStreamToDisplayList(params) {
46467
46469
  }
46468
46470
  if (font?.cmap) {
46469
46471
  if (!font.isTwoByteCid) {
46470
- const stdName2 = normalizeStandard14FontName(font.baseFont);
46471
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
46472
46472
  const out2 = [];
46473
46473
  for (let i = 0; i < bytes.length; i++) {
46474
46474
  const code = bytes[i];
46475
46475
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
46476
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
46476
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
46477
46477
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
46478
46478
  }
46479
46479
  return out2;
@@ -46505,7 +46505,7 @@ function evaluateContentStreamToDisplayList(params) {
46505
46505
  for (let i = 0; i < bytes.length; i++) {
46506
46506
  const code = bytes[i];
46507
46507
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
46508
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
46508
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
46509
46509
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
46510
46510
  }
46511
46511
  return out;
@@ -45697,21 +45697,23 @@ function resolvePageFonts(doc, resourcesDict) {
45697
45697
  }
45698
45698
  }
45699
45699
  } else {
45700
- const stdName = normalizeStandard14FontName(baseFont);
45701
- const stdMetrics = STANDARD_14_FONTS[stdName];
45702
- defaultWidth = stdMetrics.defaultWidth;
45703
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
45704
- widths.set(Number(codeStr), wVal);
45705
- }
45706
45700
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
45707
45701
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
45708
- if (firstCharNode?.kind === "number" && widthsArr) {
45702
+ if (widthsArr) {
45703
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
45704
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
45705
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
45706
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
45709
45707
  for (let k = 0; k < widthsArr.items.length; k++) {
45710
45708
  const wItem = doc.resolve(widthsArr.items[k]);
45711
45709
  if (wItem?.kind === "number") {
45712
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
45710
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
45713
45711
  }
45714
45712
  }
45713
+ } else {
45714
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
45715
+ defaultWidth = stdMetrics.defaultWidth;
45716
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
45715
45717
  }
45716
45718
  }
45717
45719
  let embeddedCff;
@@ -46467,13 +46469,11 @@ function evaluateContentStreamToDisplayList(params) {
46467
46469
  }
46468
46470
  if (font?.cmap) {
46469
46471
  if (!font.isTwoByteCid) {
46470
- const stdName2 = normalizeStandard14FontName(font.baseFont);
46471
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
46472
46472
  const out2 = [];
46473
46473
  for (let i = 0; i < bytes.length; i++) {
46474
46474
  const code = bytes[i];
46475
46475
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
46476
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
46476
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
46477
46477
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
46478
46478
  }
46479
46479
  return out2;
@@ -46505,7 +46505,7 @@ function evaluateContentStreamToDisplayList(params) {
46505
46505
  for (let i = 0; i < bytes.length; i++) {
46506
46506
  const code = bytes[i];
46507
46507
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
46508
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
46508
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
46509
46509
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
46510
46510
  }
46511
46511
  return out;
@@ -38413,21 +38413,23 @@ function resolvePageFonts(doc, resourcesDict) {
38413
38413
  }
38414
38414
  }
38415
38415
  } else {
38416
- const stdName = normalizeStandard14FontName(baseFont);
38417
- const stdMetrics = STANDARD_14_FONTS[stdName];
38418
- defaultWidth = stdMetrics.defaultWidth;
38419
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
38420
- widths.set(Number(codeStr), wVal);
38421
- }
38422
38416
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
38423
38417
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
38424
- if (firstCharNode?.kind === "number" && widthsArr) {
38418
+ if (widthsArr) {
38419
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
38420
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
38421
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
38422
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
38425
38423
  for (let k = 0; k < widthsArr.items.length; k++) {
38426
38424
  const wItem = doc.resolve(widthsArr.items[k]);
38427
38425
  if (wItem?.kind === "number") {
38428
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
38426
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
38429
38427
  }
38430
38428
  }
38429
+ } else {
38430
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
38431
+ defaultWidth = stdMetrics.defaultWidth;
38432
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
38431
38433
  }
38432
38434
  }
38433
38435
  let embeddedCff;
@@ -39183,13 +39185,11 @@ function evaluateContentStreamToDisplayList(params) {
39183
39185
  }
39184
39186
  if (font?.cmap) {
39185
39187
  if (!font.isTwoByteCid) {
39186
- const stdName2 = normalizeStandard14FontName(font.baseFont);
39187
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
39188
39188
  const out2 = [];
39189
39189
  for (let i = 0; i < bytes.length; i++) {
39190
39190
  const code = bytes[i];
39191
39191
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
39192
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
39192
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
39193
39193
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
39194
39194
  }
39195
39195
  return out2;
@@ -39221,7 +39221,7 @@ function evaluateContentStreamToDisplayList(params) {
39221
39221
  for (let i = 0; i < bytes.length; i++) {
39222
39222
  const code = bytes[i];
39223
39223
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
39224
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
39224
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
39225
39225
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
39226
39226
  }
39227
39227
  return out;
@@ -34209,21 +34209,23 @@ function resolvePageFonts(doc, resourcesDict) {
34209
34209
  }
34210
34210
  }
34211
34211
  } else {
34212
- const stdName = normalizeStandard14FontName(baseFont);
34213
- const stdMetrics = STANDARD_14_FONTS[stdName];
34214
- defaultWidth = stdMetrics.defaultWidth;
34215
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
34216
- widths.set(Number(codeStr), wVal);
34217
- }
34218
34212
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
34219
34213
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
34220
- if (firstCharNode?.kind === "number" && widthsArr) {
34214
+ if (widthsArr) {
34215
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
34216
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
34217
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
34218
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
34221
34219
  for (let k = 0; k < widthsArr.items.length; k++) {
34222
34220
  const wItem = doc.resolve(widthsArr.items[k]);
34223
34221
  if (wItem?.kind === "number") {
34224
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
34222
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
34225
34223
  }
34226
34224
  }
34225
+ } else {
34226
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
34227
+ defaultWidth = stdMetrics.defaultWidth;
34228
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
34227
34229
  }
34228
34230
  }
34229
34231
  let embeddedCff;
@@ -34979,13 +34981,11 @@ function evaluateContentStreamToDisplayList(params) {
34979
34981
  }
34980
34982
  if (font?.cmap) {
34981
34983
  if (!font.isTwoByteCid) {
34982
- const stdName2 = normalizeStandard14FontName(font.baseFont);
34983
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
34984
34984
  const out2 = [];
34985
34985
  for (let i = 0; i < bytes.length; i++) {
34986
34986
  const code = bytes[i];
34987
34987
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
34988
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
34988
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
34989
34989
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
34990
34990
  }
34991
34991
  return out2;
@@ -35017,7 +35017,7 @@ function evaluateContentStreamToDisplayList(params) {
35017
35017
  for (let i = 0; i < bytes.length; i++) {
35018
35018
  const code = bytes[i];
35019
35019
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
35020
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
35020
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
35021
35021
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
35022
35022
  }
35023
35023
  return out;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PdfDocument,
3
3
  renderPdfPageToPng
4
- } from "./chunk-PM63UJE6.js";
4
+ } from "./chunk-3444RZLY.js";
5
5
  import {
6
6
  init_buffer
7
7
  } from "./chunk-HX3SHTCE.js";
@@ -48,11 +48,11 @@ import {
48
48
  trimImage,
49
49
  unflattenImage,
50
50
  unpremultiplyRgbaImage
51
- } from "./chunk-HH5QPKIN.js";
51
+ } from "./chunk-QLYJUVVM.js";
52
52
  import {
53
53
  PdfDocument,
54
54
  encodePng
55
- } from "./chunk-PM63UJE6.js";
55
+ } from "./chunk-3444RZLY.js";
56
56
  import {
57
57
  createLuaFilterCapability
58
58
  } from "./chunk-Y2KHC6TZ.js";