1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-20 15:18:08 +02:00

[api-major] Remove the enhanceTextSelection functionality (PR 15145 follow-up)

For the `gulp mozcentral` command, this reduces the size of the *built* `pdf.js` file by `> 10` kB.
This commit is contained in:
Jonas Jenwald 2022-01-18 18:09:12 +01:00
parent 3f8b5449e8
commit 571ce13dd6
13 changed files with 34 additions and 559 deletions

View file

@ -244,7 +244,7 @@ class Rasterize {
}
}
static async textLayer(ctx, viewport, textContent, enhanceTextSelection) {
static async textLayer(ctx, viewport, textContent) {
try {
const { svg, foreignObject, style, div } = this.createContainer(viewport);
div.className = "textLayer";
@ -260,11 +260,8 @@ class Rasterize {
textContent,
container: div,
viewport,
enhanceTextSelection,
});
await task.promise;
task.expandTextDivs(true);
svg.append(foreignObject);
await writeSVG(svg, ctx);
@ -674,7 +671,6 @@ class Driver {
textLayerCanvas.height
);
textLayerContext.scale(outputScale, outputScale);
const enhanceText = !!task.enhance;
// The text builder will draw its content on the test canvas
initPromise = page
.getTextContent({
@ -684,8 +680,7 @@ class Driver {
return Rasterize.textLayer(
textLayerContext,
viewport,
textContent,
enhanceText
textContent
);
});
} else {

View file

@ -53,13 +53,6 @@
"rounds": 1,
"type": "text"
},
{ "id": "tracemonkey-text-enhance",
"file": "pdfs/tracemonkey.pdf",
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
"rounds": 1,
"enhance": true,
"type": "text"
},
{ "id": "tracemonkey-forced-colors-eq",
"file": "pdfs/tracemonkey.pdf",
"md5": "9a192d8b1a7dc652a19835f6f08098bd",
@ -596,28 +589,12 @@
"lastPage": 4,
"type": "text"
},
{ "id": "taro-text-enhance",
"file": "pdfs/TaroUTR50SortedList112.pdf",
"md5": "ce63eab622ff473a43f8a8de85ef8a46",
"link":true,
"rounds": 1,
"lastPage": 4,
"enhance": true,
"type": "text"
},
{ "id": "rotated-text",
"file": "pdfs/rotated.pdf",
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
"rounds": 1,
"type": "text"
},
{ "id": "rotated-text-enhance",
"file": "pdfs/rotated.pdf",
"md5": "aed187f53e969ccdcbab0bb4c59f9e46",
"rounds": 1,
"enhance": true,
"type": "text"
},
{
"id": "issue3115",
"file": "pdfs/issue3115r.pdf",