mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Add upper-case I
as a possible space replacement fallback in Font.spaceWidth
to improve text-selection (issue 7180)
In fonts with only upper-case glyphs, that are also missing a space glyph, `get spaceWidth` won't be able to return anything useful. By adding upper-case `I` as a fallback, we can thus improve text-selection in some PDF files. Note that locally, the patch causes slight movement in a few existing `text` tests, but in my opinion this actually looks like slight improvements. Fixes 7180.
This commit is contained in:
parent
c4db4dd4ac
commit
6a0b047bfa
4 changed files with 9 additions and 1 deletions
|
@ -2650,7 +2650,7 @@ var Font = (function FontClosure() {
|
|||
}
|
||||
|
||||
// trying to estimate space character width
|
||||
var possibleSpaceReplacements = ['space', 'minus', 'one', 'i'];
|
||||
var possibleSpaceReplacements = ['space', 'minus', 'one', 'i', 'I'];
|
||||
var width;
|
||||
for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
|
||||
var glyphName = possibleSpaceReplacements[i];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue