Merge pull request #11727 from Snuffleupagus/issue-11713
Add a heuristic to scale even single-char text, when the horizontal/vertical scaling differs significantly (issue 11713)
This commit is contained in:
commit
4fe92605b7
@ -113,7 +113,22 @@ var renderTextLayer = (function renderTextLayerClosure() {
|
|||||||
// We don't bother scaling single-char text divs, because it has very
|
// We don't bother scaling single-char text divs, because it has very
|
||||||
// little effect on text highlighting. This makes scrolling on docs with
|
// little effect on text highlighting. This makes scrolling on docs with
|
||||||
// lots of such divs a lot faster.
|
// lots of such divs a lot faster.
|
||||||
|
let shouldScaleText = false;
|
||||||
if (geom.str.length > 1) {
|
if (geom.str.length > 1) {
|
||||||
|
shouldScaleText = true;
|
||||||
|
} else if (geom.transform[0] !== geom.transform[3]) {
|
||||||
|
const absScaleX = Math.abs(geom.transform[0]),
|
||||||
|
absScaleY = Math.abs(geom.transform[3]);
|
||||||
|
// When the horizontal/vertical scaling differs significantly, also scale
|
||||||
|
// even single-char text to improve highlighting (fixes issue11713.pdf).
|
||||||
|
if (
|
||||||
|
absScaleX !== absScaleY &&
|
||||||
|
Math.max(absScaleX, absScaleY) / Math.min(absScaleX, absScaleY) > 1.5
|
||||||
|
) {
|
||||||
|
shouldScaleText = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (shouldScaleText) {
|
||||||
if (style.vertical) {
|
if (style.vertical) {
|
||||||
textDivProperties.canvasWidth = geom.height * task._viewport.scale;
|
textDivProperties.canvasWidth = geom.height * task._viewport.scale;
|
||||||
} else {
|
} else {
|
||||||
|
1
test/pdfs/.gitignore
vendored
1
test/pdfs/.gitignore
vendored
@ -143,6 +143,7 @@
|
|||||||
!issue6621.pdf
|
!issue6621.pdf
|
||||||
!issue6286.pdf
|
!issue6286.pdf
|
||||||
!issue1055r.pdf
|
!issue1055r.pdf
|
||||||
|
!issue11713.pdf
|
||||||
!issue1293r.pdf
|
!issue1293r.pdf
|
||||||
!issue1655r.pdf
|
!issue1655r.pdf
|
||||||
!issue6541.pdf
|
!issue6541.pdf
|
||||||
|
BIN
test/pdfs/issue11713.pdf
Normal file
BIN
test/pdfs/issue11713.pdf
Normal file
Binary file not shown.
@ -1107,6 +1107,12 @@
|
|||||||
"link": false,
|
"link": false,
|
||||||
"type": "text"
|
"type": "text"
|
||||||
},
|
},
|
||||||
|
{ "id": "issue11713",
|
||||||
|
"file": "pdfs/issue11713.pdf",
|
||||||
|
"md5": "bafe5801234feeb95969da106f2ce6d8",
|
||||||
|
"rounds": 1,
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
{ "id": "bug1250079",
|
{ "id": "bug1250079",
|
||||||
"file": "pdfs/bug1250079.pdf",
|
"file": "pdfs/bug1250079.pdf",
|
||||||
"md5": "a1dd21a70ae7097d96273e85a80b26ef",
|
"md5": "a1dd21a70ae7097d96273e85a80b26ef",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user