1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-26 10:08:06 +02:00

more robust fontMatrix parsing, error checking

This commit is contained in:
Artur Adib 2012-01-20 14:55:52 -05:00
parent 38d28ecb2e
commit 66eff7a5cb
2 changed files with 19 additions and 1 deletions

View file

@ -2594,7 +2594,15 @@ var Type1Parser = function type1Parser() {
while (str[index++] != ']')
count++;
var array = str.substr(start, count).split(' ');
str = str.substr(start, count);
// Trim
str = str.replace(/^\s+/, '');
str = str.replace(/\s+$/, '');
// Remove adjacent spaces
str = str.replace(/\s+/g, ' ');
var array = str.split(' ');
for (var i = 0, ii = array.length; i < ii; i++)
array[i] = parseFloat(array[i] || 0);
return array;