Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 124 additions & 49 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"@stylistic/eslint-plugin": "^5.10.0",
"esbuild": "^0.27.4",
"eslint": "^9.39.2",
"pdfjs-dist": "^5.4.149"
"pdfjs-dist": "^5.6.205"
}
}
9 changes: 9 additions & 0 deletions viewer/css/text_layer.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
forced-color-adjust: none;
caret-color: CanvasText;
z-index: 0;
--min-font-size: 1;
--text-scale-factor: calc(var(--total-scale-factor) * var(--min-font-size));
--min-font-size-inv: calc(1 / var(--min-font-size));
}

.textLayer.highlighting {
Expand All @@ -28,6 +31,12 @@

.textLayer > :not(.markedContent),.textLayer .markedContent span:not(.markedContent) {
z-index: 1;
--font-height: 0;
font-size: calc(var(--text-scale-factor) * var(--font-height));
--scale-x: 1;
--rotate: 0deg;
transform: rotate(var(--rotate)) scaleX(var(--scale-x))
scale(var(--min-font-size-inv));
}

.textLayer span.markedContent {
Expand Down
1 change: 1 addition & 0 deletions viewer/js/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "./polyfill.js";
import {
GlobalWorkerOptions,
PasswordResponses,
Expand Down
21 changes: 21 additions & 0 deletions viewer/js/polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Uint8Array.prototype.toHex
// Shipped in Chromium v140 (https://chromestatus.com/feature/6281131254874112)
if (!Uint8Array.prototype.toHex) {
const hexNumbers = Array.from({ length: 256 }, (_, i) =>
i.toString(16).padStart(2, "0")
);
Uint8Array.prototype.toHex = function () {
return Array.from(this, num => hexNumbers[num]).join("");
};
}

// Map.prototype.getOrInsertComputed
// Shipped in Chromium v145 (https://chromestatus.com/feature/5201653661827072)
if (!Map.prototype.getOrInsertComputed) {
Map.prototype.getOrInsertComputed = function (key, callbackFunction) {
if (!this.has(key)) {
this.set(key, callbackFunction(key));
}
return this.get(key);
};
}
1 change: 1 addition & 0 deletions viewer/js/worker.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
import "./polyfill.js";
import "pdfjs-dist/build/pdf.worker.mjs";