Skip to content

Commit 5a87b69

Browse files
ggtlvkma356thestinger
authored andcommitted
Bump pdfjs-dist from 5.4.149 to 5.6.205
1 parent 10eb5b2 commit 5a87b69

File tree

6 files changed

+157
-50
lines changed

6 files changed

+157
-50
lines changed

package-lock.json

Lines changed: 124 additions & 49 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"@stylistic/eslint-plugin": "^5.10.0",
55
"esbuild": "^0.28.0",
66
"eslint": "^9.39.2",
7-
"pdfjs-dist": "^5.4.149"
7+
"pdfjs-dist": "^5.6.205"
88
}
99
}

viewer/css/text_layer.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
forced-color-adjust: none;
1313
caret-color: CanvasText;
1414
z-index: 0;
15+
--min-font-size: 1;
16+
--text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
17+
--min-font-size-inv: calc(1 / var(--min-font-size));
1518
}
1619

1720
.textLayer.highlighting {
@@ -28,6 +31,12 @@
2831

2932
.textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent) {
3033
z-index: 1;
34+
--font-height: 0;
35+
font-size: calc(var(--text-scale-factor) * var(--font-height));
36+
--scale-x: 1;
37+
--rotate: 0deg;
38+
transform: rotate(var(--rotate)) scaleX(var(--scale-x))
39+
scale(var(--min-font-size-inv));
3140
}
3241

3342
.textLayer span.markedContent {

viewer/js/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import "./polyfill.js";
12
import {
23
GlobalWorkerOptions,
34
PasswordResponses,

viewer/js/polyfill.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Uint8Array.prototype.toHex
2+
// Shipped in Chromium v140 (https://chromestatus.com/feature/6281131254874112)
3+
if (!Uint8Array.prototype.toHex) {
4+
const hexNumbers = Array.from({ length: 256 }, (_, i) =>
5+
i.toString(16).padStart(2, "0")
6+
);
7+
Uint8Array.prototype.toHex = function () {
8+
return Array.from(this, num => hexNumbers[num]).join("");
9+
};
10+
}
11+
12+
// Map.prototype.getOrInsertComputed
13+
// Shipped in Chromium v145 (https://chromestatus.com/feature/5201653661827072)
14+
if (!Map.prototype.getOrInsertComputed) {
15+
Map.prototype.getOrInsertComputed = function (key, callbackFunction) {
16+
if (!this.has(key)) {
17+
this.set(key, callbackFunction(key));
18+
}
19+
return this.get(key);
20+
};
21+
}

viewer/js/worker.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
import "./polyfill.js";
12
import "pdfjs-dist/build/pdf.worker.mjs";

0 commit comments

Comments
 (0)