@chialab/pdfjs-lib 1.0.0-alpha.45 → 1.0.0-alpha.46
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.
- package/dist/browser/index.js +6 -32
- package/dist/node/index.js +6 -32
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -29849,42 +29849,16 @@ async function createTextLayer(page, {
|
|
|
29849
29849
|
}
|
|
29850
29850
|
if (oldTextItem?.glyphs.length) {
|
|
29851
29851
|
if (newTextItem) {
|
|
29852
|
-
const text = oldTextItem.glyphs.map((g) => g[0].unicode).join("") || "";
|
|
29853
|
-
const dir = bidi(text).dir;
|
|
29854
|
-
const firstGlyph = oldTextItem.glyphs[0];
|
|
29855
|
-
const lastGlyph = oldTextItem.glyphs.at(-1);
|
|
29856
|
-
const scale = oldTextItem.scaleX * oldTextItem.fontSize;
|
|
29857
29852
|
const top = oldTextItem.top;
|
|
29858
29853
|
const bottom = oldTextItem.top + oldTextItem.fontSize;
|
|
29859
|
-
const left = oldTextItem.left;
|
|
29860
|
-
const right = oldTextItem.left + (lastGlyph[1] + lastGlyph[2]) * scale;
|
|
29861
29854
|
const nextTop = newTextItem.top;
|
|
29862
29855
|
const nextBottom = newTextItem.top + newTextItem.fontSize;
|
|
29863
|
-
|
|
29864
|
-
|
|
29865
|
-
|
|
29866
|
-
|
|
29867
|
-
|
|
29868
|
-
|
|
29869
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29870
|
-
appendNewLineAsNeeded();
|
|
29871
|
-
return;
|
|
29872
|
-
}
|
|
29873
|
-
}
|
|
29874
|
-
break;
|
|
29875
|
-
}
|
|
29876
|
-
case "rtl": {
|
|
29877
|
-
if (left - newTextItem.left < firstGlyph[2] * scale) {
|
|
29878
|
-
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom) {
|
|
29879
|
-
return;
|
|
29880
|
-
}
|
|
29881
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29882
|
-
appendNewLineAsNeeded();
|
|
29883
|
-
return;
|
|
29884
|
-
}
|
|
29885
|
-
}
|
|
29886
|
-
break;
|
|
29887
|
-
}
|
|
29856
|
+
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom || nextTop <= top && nextBottom >= bottom) {
|
|
29857
|
+
return;
|
|
29858
|
+
}
|
|
29859
|
+
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
29860
|
+
appendNewLineAsNeeded();
|
|
29861
|
+
return;
|
|
29888
29862
|
}
|
|
29889
29863
|
}
|
|
29890
29864
|
closeMarkedContent();
|
package/dist/node/index.js
CHANGED
|
@@ -28450,42 +28450,16 @@ async function createTextLayer(page, {
|
|
|
28450
28450
|
}
|
|
28451
28451
|
if (oldTextItem?.glyphs.length) {
|
|
28452
28452
|
if (newTextItem) {
|
|
28453
|
-
const text = oldTextItem.glyphs.map((g) => g[0].unicode).join("") || "";
|
|
28454
|
-
const dir = bidi(text).dir;
|
|
28455
|
-
const firstGlyph = oldTextItem.glyphs[0];
|
|
28456
|
-
const lastGlyph = oldTextItem.glyphs.at(-1);
|
|
28457
|
-
const scale = oldTextItem.scaleX * oldTextItem.fontSize;
|
|
28458
28453
|
const top = oldTextItem.top;
|
|
28459
28454
|
const bottom = oldTextItem.top + oldTextItem.fontSize;
|
|
28460
|
-
const left = oldTextItem.left;
|
|
28461
|
-
const right = oldTextItem.left + (lastGlyph[1] + lastGlyph[2]) * scale;
|
|
28462
28455
|
const nextTop = newTextItem.top;
|
|
28463
28456
|
const nextBottom = newTextItem.top + newTextItem.fontSize;
|
|
28464
|
-
|
|
28465
|
-
|
|
28466
|
-
|
|
28467
|
-
|
|
28468
|
-
|
|
28469
|
-
|
|
28470
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28471
|
-
appendNewLineAsNeeded();
|
|
28472
|
-
return;
|
|
28473
|
-
}
|
|
28474
|
-
}
|
|
28475
|
-
break;
|
|
28476
|
-
}
|
|
28477
|
-
case "rtl": {
|
|
28478
|
-
if (left - newTextItem.left < firstGlyph[2] * scale) {
|
|
28479
|
-
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom) {
|
|
28480
|
-
return;
|
|
28481
|
-
}
|
|
28482
|
-
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28483
|
-
appendNewLineAsNeeded();
|
|
28484
|
-
return;
|
|
28485
|
-
}
|
|
28486
|
-
}
|
|
28487
|
-
break;
|
|
28488
|
-
}
|
|
28457
|
+
if (nextTop > top && nextTop < bottom || nextBottom > top && nextBottom < bottom || nextTop <= top && nextBottom >= bottom) {
|
|
28458
|
+
return;
|
|
28459
|
+
}
|
|
28460
|
+
if (checkNewLine(oldTextItem, newTextItem, true)) {
|
|
28461
|
+
appendNewLineAsNeeded();
|
|
28462
|
+
return;
|
|
28489
28463
|
}
|
|
28490
28464
|
}
|
|
28491
28465
|
closeMarkedContent();
|
package/package.json
CHANGED