@poe-platform/safe-bash 0.1.774 → 0.1.776

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.
@@ -28,8 +28,8 @@ import {
28
28
  thresholdImage,
29
29
  tintImage,
30
30
  trimImage
31
- } from "../safe-bash/command-chunks/chunk-HH5QPKIN.js";
32
- import "../safe-bash/command-chunks/chunk-PM63UJE6.js";
31
+ } from "../safe-bash/command-chunks/chunk-QLYJUVVM.js";
32
+ import "../safe-bash/command-chunks/chunk-3444RZLY.js";
33
33
  import {
34
34
  init_buffer
35
35
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -2,11 +2,11 @@ import {
2
2
  createPandocCommand,
3
3
  createPandocCommands,
4
4
  pandocCommands
5
- } from "../safe-bash/command-chunks/chunk-4ZHDCMQX.js";
5
+ } from "../safe-bash/command-chunks/chunk-ZY6PMCW5.js";
6
6
  import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
7
7
  import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
8
- import "../safe-bash/command-chunks/chunk-HH5QPKIN.js";
9
- import "../safe-bash/command-chunks/chunk-PM63UJE6.js";
8
+ import "../safe-bash/command-chunks/chunk-QLYJUVVM.js";
9
+ import "../safe-bash/command-chunks/chunk-3444RZLY.js";
10
10
  import "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
11
11
  import "../safe-bash/command-chunks/chunk-YGYOVXTO.js";
12
12
  import "../safe-bash/command-chunks/chunk-I5GLTNVH.js";
@@ -21,11 +21,11 @@ import {
21
21
  readDocument,
22
22
  resolveConversionArgs,
23
23
  writeDocument
24
- } from "../safe-bash/command-chunks/chunk-4ZHDCMQX.js";
24
+ } from "../safe-bash/command-chunks/chunk-ZY6PMCW5.js";
25
25
  import "../safe-bash/command-chunks/chunk-MKQVQMXO.js";
26
26
  import "../safe-bash/command-chunks/chunk-RDV7UCYZ.js";
27
- import "../safe-bash/command-chunks/chunk-HH5QPKIN.js";
28
- import "../safe-bash/command-chunks/chunk-PM63UJE6.js";
27
+ import "../safe-bash/command-chunks/chunk-QLYJUVVM.js";
28
+ import "../safe-bash/command-chunks/chunk-3444RZLY.js";
29
29
  import {
30
30
  createLuaFilterCapability
31
31
  } from "../safe-bash/command-chunks/chunk-Y2KHC6TZ.js";
@@ -38043,21 +38043,23 @@ function resolvePageFonts(doc, resourcesDict) {
38043
38043
  }
38044
38044
  }
38045
38045
  } else {
38046
- const stdName = normalizeStandard14FontName(baseFont);
38047
- const stdMetrics = STANDARD_14_FONTS[stdName];
38048
- defaultWidth = stdMetrics.defaultWidth;
38049
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
38050
- widths.set(Number(codeStr), wVal);
38051
- }
38052
38046
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
38053
38047
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
38054
- if (firstCharNode?.kind === "number" && widthsArr) {
38048
+ if (widthsArr) {
38049
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
38050
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
38051
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
38052
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
38055
38053
  for (let k = 0; k < widthsArr.items.length; k++) {
38056
38054
  const wItem = doc.resolve(widthsArr.items[k]);
38057
38055
  if (wItem?.kind === "number") {
38058
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
38056
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
38059
38057
  }
38060
38058
  }
38059
+ } else {
38060
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
38061
+ defaultWidth = stdMetrics.defaultWidth;
38062
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
38061
38063
  }
38062
38064
  }
38063
38065
  let embeddedCff;
@@ -38813,13 +38815,11 @@ function evaluateContentStreamToDisplayList(params) {
38813
38815
  }
38814
38816
  if (font?.cmap) {
38815
38817
  if (!font.isTwoByteCid) {
38816
- const stdName2 = normalizeStandard14FontName(font.baseFont);
38817
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
38818
38818
  const out2 = [];
38819
38819
  for (let i = 0; i < bytes.length; i++) {
38820
38820
  const code = bytes[i];
38821
38821
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
38822
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
38822
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
38823
38823
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38824
38824
  }
38825
38825
  return out2;
@@ -38851,7 +38851,7 @@ function evaluateContentStreamToDisplayList(params) {
38851
38851
  for (let i = 0; i < bytes.length; i++) {
38852
38852
  const code = bytes[i];
38853
38853
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
38854
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38854
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38855
38855
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38856
38856
  }
38857
38857
  return out;
@@ -38237,21 +38237,23 @@ function resolvePageFonts(doc, resourcesDict) {
38237
38237
  }
38238
38238
  }
38239
38239
  } else {
38240
- const stdName = normalizeStandard14FontName(baseFont);
38241
- const stdMetrics = STANDARD_14_FONTS[stdName];
38242
- defaultWidth = stdMetrics.defaultWidth;
38243
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
38244
- widths.set(Number(codeStr), wVal);
38245
- }
38246
38240
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
38247
38241
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
38248
- if (firstCharNode?.kind === "number" && widthsArr) {
38242
+ if (widthsArr) {
38243
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
38244
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
38245
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
38246
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
38249
38247
  for (let k = 0; k < widthsArr.items.length; k++) {
38250
38248
  const wItem = doc.resolve(widthsArr.items[k]);
38251
38249
  if (wItem?.kind === "number") {
38252
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
38250
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
38253
38251
  }
38254
38252
  }
38253
+ } else {
38254
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
38255
+ defaultWidth = stdMetrics.defaultWidth;
38256
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
38255
38257
  }
38256
38258
  }
38257
38259
  let embeddedCff;
@@ -39007,13 +39009,11 @@ function evaluateContentStreamToDisplayList(params) {
39007
39009
  }
39008
39010
  if (font?.cmap) {
39009
39011
  if (!font.isTwoByteCid) {
39010
- const stdName2 = normalizeStandard14FontName(font.baseFont);
39011
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
39012
39012
  const out2 = [];
39013
39013
  for (let i = 0; i < bytes.length; i++) {
39014
39014
  const code = bytes[i];
39015
39015
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
39016
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
39016
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
39017
39017
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
39018
39018
  }
39019
39019
  return out2;
@@ -39045,7 +39045,7 @@ function evaluateContentStreamToDisplayList(params) {
39045
39045
  for (let i = 0; i < bytes.length; i++) {
39046
39046
  const code = bytes[i];
39047
39047
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
39048
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
39048
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
39049
39049
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
39050
39050
  }
39051
39051
  return out;
@@ -37698,21 +37698,23 @@ function resolvePageFonts(doc, resourcesDict) {
37698
37698
  }
37699
37699
  }
37700
37700
  } else {
37701
- const stdName = normalizeStandard14FontName(baseFont);
37702
- const stdMetrics = STANDARD_14_FONTS[stdName];
37703
- defaultWidth = stdMetrics.defaultWidth;
37704
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
37705
- widths.set(Number(codeStr), wVal);
37706
- }
37707
37701
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
37708
37702
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
37709
- if (firstCharNode?.kind === "number" && widthsArr) {
37703
+ if (widthsArr) {
37704
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
37705
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
37706
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
37707
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
37710
37708
  for (let k = 0; k < widthsArr.items.length; k++) {
37711
37709
  const wItem = doc.resolve(widthsArr.items[k]);
37712
37710
  if (wItem?.kind === "number") {
37713
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
37711
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
37714
37712
  }
37715
37713
  }
37714
+ } else {
37715
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
37716
+ defaultWidth = stdMetrics.defaultWidth;
37717
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
37716
37718
  }
37717
37719
  }
37718
37720
  let embeddedCff;
@@ -38468,13 +38470,11 @@ function evaluateContentStreamToDisplayList(params) {
38468
38470
  }
38469
38471
  if (font?.cmap) {
38470
38472
  if (!font.isTwoByteCid) {
38471
- const stdName2 = normalizeStandard14FontName(font.baseFont);
38472
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
38473
38473
  const out2 = [];
38474
38474
  for (let i = 0; i < bytes.length; i++) {
38475
38475
  const code = bytes[i];
38476
38476
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
38477
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
38477
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
38478
38478
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38479
38479
  }
38480
38480
  return out2;
@@ -38506,7 +38506,7 @@ function evaluateContentStreamToDisplayList(params) {
38506
38506
  for (let i = 0; i < bytes.length; i++) {
38507
38507
  const code = bytes[i];
38508
38508
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
38509
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38509
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38510
38510
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38511
38511
  }
38512
38512
  return out;
@@ -37892,21 +37892,23 @@ function resolvePageFonts(doc, resourcesDict) {
37892
37892
  }
37893
37893
  }
37894
37894
  } else {
37895
- const stdName = normalizeStandard14FontName(baseFont);
37896
- const stdMetrics = STANDARD_14_FONTS[stdName];
37897
- defaultWidth = stdMetrics.defaultWidth;
37898
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
37899
- widths.set(Number(codeStr), wVal);
37900
- }
37901
37895
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
37902
37896
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
37903
- if (firstCharNode?.kind === "number" && widthsArr) {
37897
+ if (widthsArr) {
37898
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
37899
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
37900
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
37901
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
37904
37902
  for (let k = 0; k < widthsArr.items.length; k++) {
37905
37903
  const wItem = doc.resolve(widthsArr.items[k]);
37906
37904
  if (wItem?.kind === "number") {
37907
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
37905
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
37908
37906
  }
37909
37907
  }
37908
+ } else {
37909
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
37910
+ defaultWidth = stdMetrics.defaultWidth;
37911
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
37910
37912
  }
37911
37913
  }
37912
37914
  let embeddedCff;
@@ -38662,13 +38664,11 @@ function evaluateContentStreamToDisplayList(params) {
38662
38664
  }
38663
38665
  if (font?.cmap) {
38664
38666
  if (!font.isTwoByteCid) {
38665
- const stdName2 = normalizeStandard14FontName(font.baseFont);
38666
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
38667
38667
  const out2 = [];
38668
38668
  for (let i = 0; i < bytes.length; i++) {
38669
38669
  const code = bytes[i];
38670
38670
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
38671
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
38671
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
38672
38672
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38673
38673
  }
38674
38674
  return out2;
@@ -38700,7 +38700,7 @@ function evaluateContentStreamToDisplayList(params) {
38700
38700
  for (let i = 0; i < bytes.length; i++) {
38701
38701
  const code = bytes[i];
38702
38702
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
38703
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38703
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38704
38704
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38705
38705
  }
38706
38706
  return out;
@@ -38043,21 +38043,23 @@ function resolvePageFonts(doc, resourcesDict) {
38043
38043
  }
38044
38044
  }
38045
38045
  } else {
38046
- const stdName = normalizeStandard14FontName(baseFont);
38047
- const stdMetrics = STANDARD_14_FONTS[stdName];
38048
- defaultWidth = stdMetrics.defaultWidth;
38049
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
38050
- widths.set(Number(codeStr), wVal);
38051
- }
38052
38046
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
38053
38047
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
38054
- if (firstCharNode?.kind === "number" && widthsArr) {
38048
+ if (widthsArr) {
38049
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
38050
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
38051
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
38052
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
38055
38053
  for (let k = 0; k < widthsArr.items.length; k++) {
38056
38054
  const wItem = doc.resolve(widthsArr.items[k]);
38057
38055
  if (wItem?.kind === "number") {
38058
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
38056
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
38059
38057
  }
38060
38058
  }
38059
+ } else {
38060
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
38061
+ defaultWidth = stdMetrics.defaultWidth;
38062
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
38061
38063
  }
38062
38064
  }
38063
38065
  let embeddedCff;
@@ -38813,13 +38815,11 @@ function evaluateContentStreamToDisplayList(params) {
38813
38815
  }
38814
38816
  if (font?.cmap) {
38815
38817
  if (!font.isTwoByteCid) {
38816
- const stdName2 = normalizeStandard14FontName(font.baseFont);
38817
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
38818
38818
  const out2 = [];
38819
38819
  for (let i = 0; i < bytes.length; i++) {
38820
38820
  const code = bytes[i];
38821
38821
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
38822
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
38822
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
38823
38823
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38824
38824
  }
38825
38825
  return out2;
@@ -38851,7 +38851,7 @@ function evaluateContentStreamToDisplayList(params) {
38851
38851
  for (let i = 0; i < bytes.length; i++) {
38852
38852
  const code = bytes[i];
38853
38853
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
38854
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38854
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38855
38855
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38856
38856
  }
38857
38857
  return out;
@@ -37698,21 +37698,23 @@ function resolvePageFonts(doc, resourcesDict) {
37698
37698
  }
37699
37699
  }
37700
37700
  } else {
37701
- const stdName = normalizeStandard14FontName(baseFont);
37702
- const stdMetrics = STANDARD_14_FONTS[stdName];
37703
- defaultWidth = stdMetrics.defaultWidth;
37704
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
37705
- widths.set(Number(codeStr), wVal);
37706
- }
37707
37701
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
37708
37702
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
37709
- if (firstCharNode?.kind === "number" && widthsArr) {
37703
+ if (widthsArr) {
37704
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
37705
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
37706
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
37707
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
37710
37708
  for (let k = 0; k < widthsArr.items.length; k++) {
37711
37709
  const wItem = doc.resolve(widthsArr.items[k]);
37712
37710
  if (wItem?.kind === "number") {
37713
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
37711
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
37714
37712
  }
37715
37713
  }
37714
+ } else {
37715
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
37716
+ defaultWidth = stdMetrics.defaultWidth;
37717
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
37716
37718
  }
37717
37719
  }
37718
37720
  let embeddedCff;
@@ -38468,13 +38470,11 @@ function evaluateContentStreamToDisplayList(params) {
38468
38470
  }
38469
38471
  if (font?.cmap) {
38470
38472
  if (!font.isTwoByteCid) {
38471
- const stdName2 = normalizeStandard14FontName(font.baseFont);
38472
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
38473
38473
  const out2 = [];
38474
38474
  for (let i = 0; i < bytes.length; i++) {
38475
38475
  const code = bytes[i];
38476
38476
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
38477
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
38477
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
38478
38478
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38479
38479
  }
38480
38480
  return out2;
@@ -38506,7 +38506,7 @@ function evaluateContentStreamToDisplayList(params) {
38506
38506
  for (let i = 0; i < bytes.length; i++) {
38507
38507
  const code = bytes[i];
38508
38508
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
38509
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38509
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
38510
38510
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
38511
38511
  }
38512
38512
  return out;
@@ -11,8 +11,8 @@ import {
11
11
  readImageMetadata,
12
12
  resizeImage,
13
13
  rotateImage
14
- } from "../safe-bash/command-chunks/chunk-HH5QPKIN.js";
15
- import "../safe-bash/command-chunks/chunk-PM63UJE6.js";
14
+ } from "../safe-bash/command-chunks/chunk-QLYJUVVM.js";
15
+ import "../safe-bash/command-chunks/chunk-3444RZLY.js";
16
16
  import {
17
17
  init_buffer
18
18
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -31,7 +31,7 @@ import {
31
31
  PdfDocument,
32
32
  decodeFlate,
33
33
  rgb
34
- } from "../safe-bash/command-chunks/chunk-PM63UJE6.js";
34
+ } from "../safe-bash/command-chunks/chunk-3444RZLY.js";
35
35
  import {
36
36
  init_buffer
37
37
  } from "../safe-bash/command-chunks/chunk-HX3SHTCE.js";
@@ -211202,21 +211202,23 @@ function resolvePageFonts(doc, resourcesDict) {
211202
211202
  }
211203
211203
  }
211204
211204
  } else {
211205
- const stdName = normalizeStandard14FontName(baseFont);
211206
- const stdMetrics = STANDARD_14_FONTS[stdName];
211207
- defaultWidth = stdMetrics.defaultWidth;
211208
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
211209
- widths.set(Number(codeStr), wVal);
211210
- }
211211
211205
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
211212
211206
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
211213
- if (firstCharNode?.kind === "number" && widthsArr) {
211207
+ if (widthsArr) {
211208
+ const descriptor3 = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
211209
+ const missingWidth = descriptor3 ? doc.resolve(dictGet(descriptor3, "MissingWidth")) : void 0;
211210
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
211211
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
211214
211212
  for (let k = 0; k < widthsArr.items.length; k++) {
211215
211213
  const wItem = doc.resolve(widthsArr.items[k]);
211216
211214
  if (wItem?.kind === "number") {
211217
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
211215
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
211218
211216
  }
211219
211217
  }
211218
+ } else {
211219
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
211220
+ defaultWidth = stdMetrics.defaultWidth;
211221
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
211220
211222
  }
211221
211223
  }
211222
211224
  let embeddedCff;
@@ -211972,13 +211974,11 @@ function evaluateContentStreamToDisplayList(params) {
211972
211974
  }
211973
211975
  if (font2?.cmap) {
211974
211976
  if (!font2.isTwoByteCid) {
211975
- const stdName2 = normalizeStandard14FontName(font2.baseFont);
211976
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
211977
211977
  const out2 = [];
211978
211978
  for (let i = 0; i < bytes.length; i++) {
211979
211979
  const code = bytes[i];
211980
211980
  const unicode = font2.cmap.map.get(code) ?? (font2.differences.has(code) ? font2.differences.get(code) : decodeWinAnsiByte(code));
211981
- const advance1000 = font2.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
211981
+ const advance1000 = font2.widths.get(code) ?? font2.defaultWidth;
211982
211982
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
211983
211983
  }
211984
211984
  return out2;
@@ -212010,7 +212010,7 @@ function evaluateContentStreamToDisplayList(params) {
212010
212010
  for (let i = 0; i < bytes.length; i++) {
212011
212011
  const code = bytes[i];
212012
212012
  const unicode = font2?.differences.get(code) ?? decodeWinAnsiByte(code);
212013
- const advance1000 = font2?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
212013
+ const advance1000 = font2 ? font2.widths.get(code) ?? font2.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
212014
212014
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
212015
212015
  }
212016
212016
  return out;
@@ -10716,21 +10716,23 @@ function resolvePageFonts(doc, resourcesDict) {
10716
10716
  }
10717
10717
  }
10718
10718
  } else {
10719
- const stdName = normalizeStandard14FontName(baseFont);
10720
- const stdMetrics = STANDARD_14_FONTS[stdName];
10721
- defaultWidth = stdMetrics.defaultWidth;
10722
- for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) {
10723
- widths.set(Number(codeStr), wVal);
10724
- }
10725
10719
  const firstCharNode = doc.resolve(dictGet(fObj, "FirstChar"));
10726
10720
  const widthsArr = doc.resolveArray(dictGet(fObj, "Widths"));
10727
- if (firstCharNode?.kind === "number" && widthsArr) {
10721
+ if (widthsArr) {
10722
+ const descriptor = doc.resolveDict(dictGet(fObj, "FontDescriptor"));
10723
+ const missingWidth = descriptor ? doc.resolve(dictGet(descriptor, "MissingWidth")) : void 0;
10724
+ defaultWidth = (missingWidth?.kind === "number" ? missingWidth.value : 0) * type3Scale1000;
10725
+ const firstChar = firstCharNode?.kind === "number" ? firstCharNode.value : 0;
10728
10726
  for (let k = 0; k < widthsArr.items.length; k++) {
10729
10727
  const wItem = doc.resolve(widthsArr.items[k]);
10730
10728
  if (wItem?.kind === "number") {
10731
- widths.set(firstCharNode.value + k, wItem.value * type3Scale1000);
10729
+ widths.set(firstChar + k, wItem.value * type3Scale1000);
10732
10730
  }
10733
10731
  }
10732
+ } else {
10733
+ const stdMetrics = STANDARD_14_FONTS[normalizeStandard14FontName(baseFont)];
10734
+ defaultWidth = stdMetrics.defaultWidth;
10735
+ for (const [codeStr, wVal] of Object.entries(stdMetrics.widthsByCode)) widths.set(Number(codeStr), wVal);
10734
10736
  }
10735
10737
  }
10736
10738
  let embeddedCff;
@@ -11485,13 +11487,11 @@ function evaluateContentStreamToDisplayList(params) {
11485
11487
  }
11486
11488
  if (font?.cmap) {
11487
11489
  if (!font.isTwoByteCid) {
11488
- const stdName2 = normalizeStandard14FontName(font.baseFont);
11489
- const stdMetrics2 = STANDARD_14_FONTS[stdName2];
11490
11490
  const out2 = [];
11491
11491
  for (let i = 0; i < bytes.length; i++) {
11492
11492
  const code = bytes[i];
11493
11493
  const unicode = font.cmap.map.get(code) ?? (font.differences.has(code) ? font.differences.get(code) : decodeWinAnsiByte(code));
11494
- const advance1000 = font.widths.get(code) ?? stdMetrics2.widthsByCode[code] ?? stdMetrics2.defaultWidth;
11494
+ const advance1000 = font.widths.get(code) ?? font.defaultWidth;
11495
11495
  out2.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
11496
11496
  }
11497
11497
  return out2;
@@ -11523,7 +11523,7 @@ function evaluateContentStreamToDisplayList(params) {
11523
11523
  for (let i = 0; i < bytes.length; i++) {
11524
11524
  const code = bytes[i];
11525
11525
  const unicode = font?.differences.get(code) ?? decodeWinAnsiByte(code);
11526
- const advance1000 = font?.widths.get(code) ?? stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
11526
+ const advance1000 = font ? font.widths.get(code) ?? font.defaultWidth : stdMetrics.widthsByCode[code] ?? stdMetrics.defaultWidth;
11527
11527
  out.push({ charCode: code, isSpace: code === 32, unicode, advance1000 });
11528
11528
  }
11529
11529
  return out;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@poe-platform/safe-bash",
3
- "version": "0.1.774",
3
+ "version": "0.1.776",
4
4
  "description": "Extensible virtual shell with pluggable filesystems and streaming commands",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -841,7 +841,7 @@
841
841
  "access": "public"
842
842
  },
843
843
  "dependencies": {
844
- "@poe-platform/safe-fs": "0.1.774",
844
+ "@poe-platform/safe-fs": "0.1.776",
845
845
  "pdf-lib": "1.17.1",
846
846
  "@noble/hashes": "2.4.0",
847
847
  "pako": "3.0.1",
@@ -497,3 +497,10 @@ Declared stream lengths follow PDF.js `Parser.makeStream`/`tryShift` in
497
497
  the actual terminator. `src/cos/stream-length.test.ts` covers direct/indirect
498
498
  lengths, malformed tokens at the claimed end, delimiter text inside accurate
499
499
  streams, and PDF.js's unchanged `xobject-image.pdf` through load/save/render.
500
+
501
+ Explicit simple-font width tables follow PDF.js `PartialEvaluator.extractWidths`
502
+ in `src/core/evaluator.js`: undeclared codes use `FontDescriptor.MissingWidth`,
503
+ or zero when absent. Standard-font widths apply only without an explicit
504
+ Widths table. `src/fonts/explicit-widths.test.ts` covers Type1, TrueType and
505
+ Type3 widths with and without ToUnicode, plus the unchanged upstream
506
+ `Type3WordSpacing.pdf` fixture.