mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Validate additional font-dictionary properties
This commit is contained in:
parent
85e64b5c16
commit
08eb0566f7
4 changed files with 72 additions and 26 deletions
|
@ -218,6 +218,21 @@ function isWhiteSpace(ch) {
|
|||
return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if something is an Array containing only numbers,
|
||||
* and (optionally) checks its length.
|
||||
* @param {any} arr
|
||||
* @param {number | null} len
|
||||
* @returns {boolean}
|
||||
*/
|
||||
function isNumberArray(arr, len) {
|
||||
return (
|
||||
Array.isArray(arr) &&
|
||||
(len === null || arr.length === len) &&
|
||||
arr.every(x => typeof x === "number")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* AcroForm field names use an array like notation to refer to
|
||||
* repeated XFA elements e.g. foo.bar[nnn].
|
||||
|
@ -637,6 +652,7 @@ export {
|
|||
getRotationMatrix,
|
||||
getSizeInBytes,
|
||||
isAscii,
|
||||
isNumberArray,
|
||||
isWhiteSpace,
|
||||
log2,
|
||||
MissingDataException,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue