Try to improve text-selection for Type3 fonts that utilize a non-default /FontMatrix (bug 1513120)

For Type3 fonts text-selection is often not that great, and there's a couple of heuristics used to try and improve things. This patch simple extends those heuristics a bit, and fixes a pre-existing "naive" array comparison, but this all feels a bit brittle to say the least.

The existing Type3 test-coverage isn't that great in general, and in particular Type3 `text` tests are few and far between, hence why this patch adds *two* different new `text` tests.
This commit is contained in:
Jonas Jenwald 2019-03-08 12:55:44 +01:00
parent d587abbceb
commit 88f9e633dd
5 changed files with 31 additions and 8 deletions

View file

@ -824,6 +824,15 @@ function isArrayBuffer(v) {
return typeof v === 'object' && v !== null && v.byteLength !== undefined;
}
function isArrayEqual(arr1, arr2) {
if (arr1.length !== arr2.length) {
return false;
}
return arr1.every(function(element, index) {
return element === arr2[index];
});
}
// Checks if ch is one of the following characters: SPACE, TAB, CR or LF.
function isSpace(ch) {
return (ch === 0x20 || ch === 0x09 || ch === 0x0D || ch === 0x0A);
@ -927,6 +936,7 @@ export {
getVerbosityLevel,
info,
isArrayBuffer,
isArrayEqual,
isBool,
isEmptyObj,
isNum,