@chialab/pdfjs-lib 1.0.0-alpha.37 → 1.0.0-alpha.39

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.
@@ -42322,7 +42322,7 @@ var loadTextLayerFontsMap = /* @__PURE__ */ (() => {
42322
42322
  return promise;
42323
42323
  };
42324
42324
  })();
42325
- var HYPHEN_REGEX2 = /-\n+$/;
42325
+ var HYPHEN_REGEX2 = /-\n*$/;
42326
42326
  var isNameObject = (obj) => {
42327
42327
  return obj !== null && typeof obj === "object" && "name" in obj;
42328
42328
  };
@@ -42405,16 +42405,18 @@ async function createTextLayerV2(page, {
42405
42405
  angle
42406
42406
  } = currentTextItem;
42407
42407
  const textFont = fonts[font.bold || font.black ? font.italic ? 3 : 2 : font.italic ? 1 : 0];
42408
+ const computedText = glyphsList.map((g) => g[0].unicode).join("");
42409
+ const isHyphen = HYPHEN_REGEX2.test(computedText);
42408
42410
  const glyphsBlocks = glyphsList.reduce(
42409
42411
  (acc, glyph) => {
42410
42412
  if (!glyph[0]) {
42411
42413
  return acc;
42412
42414
  }
42413
- if (glyph[0].unicode.trim()) {
42414
- acc[acc.length - 1].push(glyph);
42415
- } else {
42415
+ if (!glyph[0].unicode.trim() || glyph[0].unicode === "-") {
42416
42416
  acc.push([glyph]);
42417
42417
  acc.push([]);
42418
+ } else {
42419
+ acc[acc.length - 1].push(glyph);
42418
42420
  }
42419
42421
  return acc;
42420
42422
  },
@@ -42422,14 +42424,12 @@ async function createTextLayerV2(page, {
42422
42424
  );
42423
42425
  const chunks = [];
42424
42426
  let currentLeft = 0;
42425
- let computedText = "";
42426
42427
  for (let i = 0; i < glyphsBlocks.length; i++) {
42427
42428
  const glyphs = glyphsBlocks[i];
42428
42429
  if (glyphs.length === 0) {
42429
42430
  continue;
42430
42431
  }
42431
42432
  const text = glyphs.map((g) => g[0].unicode).join("");
42432
- computedText += text;
42433
42433
  const textWidth = textFont.getAdvanceWidth(text, fontSize);
42434
42434
  if (!textWidth) {
42435
42435
  continue;
@@ -42475,7 +42475,7 @@ async function createTextLayerV2(page, {
42475
42475
  text: dir === "ltr" ? chunks : chunks.reverse(),
42476
42476
  fontFamily: font.loadedName,
42477
42477
  fontFallback: "sans-serif",
42478
- hyphen: HYPHEN_REGEX2.test(computedText),
42478
+ hyphen: isHyphen,
42479
42479
  top,
42480
42480
  left,
42481
42481
  fontSize: finalFontSize,
@@ -6,8 +6,8 @@ import {
6
6
  NodeWasmFactory,
7
7
  fetchData2 as fetchData,
8
8
  filtersRegistry
9
- } from "./chunk-YYN3HV7W.js";
10
- import "./chunk-7NGJYFOM.js";
9
+ } from "./chunk-XAT2FF6L.js";
10
+ import "./chunk-T2JWSGAF.js";
11
11
  import "./chunk-ZFIGV5OT.js";
12
12
  export {
13
13
  NodeCMapReaderFactory,