Merge with upstream
This commit is contained in:
commit
7fa63e68dd
31
fonts.js
31
fonts.js
@ -411,7 +411,7 @@ var Font = (function Font() {
|
|||||||
this.encoding = properties.encoding;
|
this.encoding = properties.encoding;
|
||||||
this.sizes = [];
|
this.sizes = [];
|
||||||
|
|
||||||
var names = name.split("+");
|
var names = name.split('+');
|
||||||
names = names.length > 1 ? names[1] : names[0];
|
names = names.length > 1 ? names[1] : names[0];
|
||||||
names = names.split(/[-,_]/g)[0];
|
names = names.split(/[-,_]/g)[0];
|
||||||
this.serif = serifFonts[names] || (name.search(/serif/gi) != -1);
|
this.serif = serifFonts[names] || (name.search(/serif/gi) != -1);
|
||||||
@ -448,8 +448,8 @@ var Font = (function Font() {
|
|||||||
this.mimetype = 'font/opentype';
|
this.mimetype = 'font/opentype';
|
||||||
|
|
||||||
var subtype = properties.subtype;
|
var subtype = properties.subtype;
|
||||||
var cff = (subtype === 'Type1C') ? new Type2CFF(file, properties)
|
var cff = (subtype === 'Type1C') ?
|
||||||
: new CFF(name, file, properties);
|
new Type2CFF(file, properties) : new CFF(name, file, properties);
|
||||||
|
|
||||||
// Wrap the CFF data inside an OTF font file
|
// Wrap the CFF data inside an OTF font file
|
||||||
data = this.convert(name, cff, properties);
|
data = this.convert(name, cff, properties);
|
||||||
@ -875,7 +875,7 @@ var Font = (function Font() {
|
|||||||
// Check that table are sorted by platformID then encodingID,
|
// Check that table are sorted by platformID then encodingID,
|
||||||
records.sort(function(a, b) {
|
records.sort(function(a, b) {
|
||||||
return ((a.platformID << 16) + a.encodingID) -
|
return ((a.platformID << 16) + a.encodingID) -
|
||||||
((b.platformID << 16) + b.encodingID)
|
((b.platformID << 16) + b.encodingID);
|
||||||
});
|
});
|
||||||
|
|
||||||
var tables = [records[0]];
|
var tables = [records[0]];
|
||||||
@ -907,7 +907,7 @@ var Font = (function Font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < data.length; i++)
|
for (var i = 0; i < data.length; i++)
|
||||||
cmap.data[i] = data.charCodeAt(i);
|
cmap.data[i] = data.charCodeAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var encoding = properties.encoding;
|
var encoding = properties.encoding;
|
||||||
@ -940,7 +940,7 @@ var Font = (function Font() {
|
|||||||
glyphs.push({ unicode: unicode });
|
glyphs.push({ unicode: unicode });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmap.data = createCMapTable(glyphs, deltas);
|
return cmap.data = createCMapTable(glyphs, deltas);
|
||||||
} else if (format == 6) {
|
} else if (format == 6) {
|
||||||
// Format 6 is a 2-bytes dense mapping, which means the font data
|
// Format 6 is a 2-bytes dense mapping, which means the font data
|
||||||
@ -1668,7 +1668,7 @@ var Type1Parser = function() {
|
|||||||
};
|
};
|
||||||
var c = eexecStr[i];
|
var c = eexecStr[i];
|
||||||
|
|
||||||
if ((glyphsSection || subrsSection) &&
|
if ((glyphsSection || subrsSection) &&
|
||||||
(token == 'RD' || token == '-|')) {
|
(token == 'RD' || token == '-|')) {
|
||||||
i++;
|
i++;
|
||||||
var data = eexec.slice(i, i + length);
|
var data = eexec.slice(i, i + length);
|
||||||
@ -1704,7 +1704,7 @@ var Type1Parser = function() {
|
|||||||
getToken(); // read in 'array'
|
getToken(); // read in 'array'
|
||||||
for (var j = 0; j < num; ++j) {
|
for (var j = 0; j < num; ++j) {
|
||||||
var t = getToken(); // read in 'dup'
|
var t = getToken(); // read in 'dup'
|
||||||
if (t == 'ND' || t == '|-' || t == 'noaccess')
|
if (t == 'ND' || t == '|-' || t == 'noaccess')
|
||||||
break;
|
break;
|
||||||
var index = parseInt(getToken(), 10);
|
var index = parseInt(getToken(), 10);
|
||||||
if (index > j)
|
if (index > j)
|
||||||
@ -1823,7 +1823,7 @@ var Type1Parser = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The CFF class takes a Type1 file and wrap it into a
|
* The CFF class takes a Type1 file and wrap it into a
|
||||||
* 'Compact Font Format' which itself embed Type2 charstrings.
|
* 'Compact Font Format' which itself embed Type2 charstrings.
|
||||||
*/
|
*/
|
||||||
var CFFStrings = [
|
var CFFStrings = [
|
||||||
@ -2265,7 +2265,7 @@ var Type2CFF = (function() {
|
|||||||
var charStrings = this.parseIndex(topDict.CharStrings);
|
var charStrings = this.parseIndex(topDict.CharStrings);
|
||||||
var charset = this.parseCharsets(topDict.charset,
|
var charset = this.parseCharsets(topDict.charset,
|
||||||
charStrings.length, strings);
|
charStrings.length, strings);
|
||||||
var hasSupplement = this.parseEncoding(topDict.Encoding, properties,
|
var hasSupplement = this.parseEncoding(topDict.Encoding, properties,
|
||||||
strings, charset);
|
strings, charset);
|
||||||
|
|
||||||
// The font sanitizer does not support CFF encoding with a
|
// The font sanitizer does not support CFF encoding with a
|
||||||
@ -2340,7 +2340,8 @@ var Type2CFF = (function() {
|
|||||||
return charstrings;
|
return charstrings;
|
||||||
},
|
},
|
||||||
|
|
||||||
parseEncoding: function cff_parseencoding(pos, properties, strings, charset) {
|
parseEncoding: function cff_parseencoding(pos, properties, strings,
|
||||||
|
charset) {
|
||||||
var encoding = {};
|
var encoding = {};
|
||||||
var bytes = this.bytes;
|
var bytes = this.bytes;
|
||||||
|
|
||||||
@ -2355,8 +2356,8 @@ var Type2CFF = (function() {
|
|||||||
|
|
||||||
if (pos == 0 || pos == 1) {
|
if (pos == 0 || pos == 1) {
|
||||||
var gid = 1;
|
var gid = 1;
|
||||||
var baseEncoding = pos ? Encodings.ExpertEncoding
|
var baseEncoding =
|
||||||
: Encodings.StandardEncoding;
|
pos ? Encodings.ExpertEncoding : Encodings.StandardEncoding;
|
||||||
for (var i = 0; i < charset.length; i++) {
|
for (var i = 0; i < charset.length; i++) {
|
||||||
var index = baseEncoding.indexOf(charset[i]);
|
var index = baseEncoding.indexOf(charset[i]);
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
@ -2367,7 +2368,7 @@ var Type2CFF = (function() {
|
|||||||
switch (format & 0x7f) {
|
switch (format & 0x7f) {
|
||||||
case 0:
|
case 0:
|
||||||
var glyphsCount = bytes[pos++];
|
var glyphsCount = bytes[pos++];
|
||||||
for (var i = 1; i <= glyphsCount; i++)
|
for (var i = 1; i <= glyphsCount; i++)
|
||||||
encoding[bytes[pos++]] = i;
|
encoding[bytes[pos++]] = i;
|
||||||
|
|
||||||
if (format & 0x80) {
|
if (format & 0x80) {
|
||||||
@ -2393,7 +2394,7 @@ var Type2CFF = (function() {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
error('Unknow encoding format: ' + format + " in CFF");
|
error('Unknow encoding format: ' + format + ' in CFF');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
pdf.js
11
pdf.js
@ -825,7 +825,7 @@ var PredictorStream = (function() {
|
|||||||
currentRow[i] = rawBytes[i];
|
currentRow[i] = rawBytes[i];
|
||||||
for (; i < rowBytes; ++i) {
|
for (; i < rowBytes; ++i) {
|
||||||
var up = prevRow[i];
|
var up = prevRow[i];
|
||||||
var upLeft = lastRow[i - pixBytes];
|
var upLeft = prevRow[i - pixBytes];
|
||||||
var left = currentRow[i - pixBytes];
|
var left = currentRow[i - pixBytes];
|
||||||
var p = left + up - upLeft;
|
var p = left + up - upLeft;
|
||||||
|
|
||||||
@ -1553,7 +1553,7 @@ var CCITTFaxStream = (function() {
|
|||||||
this.row = 0;
|
this.row = 0;
|
||||||
this.nextLine2D = this.encoding < 0;
|
this.nextLine2D = this.encoding < 0;
|
||||||
this.inputBits = 0;
|
this.inputBits = 0;
|
||||||
this.inputBuf;
|
this.inputBuf = 0;
|
||||||
this.outputBits = 0;
|
this.outputBits = 0;
|
||||||
this.buf = EOF;
|
this.buf = EOF;
|
||||||
|
|
||||||
@ -3676,8 +3676,7 @@ var PDFDoc = (function() {
|
|||||||
if (find(stream, 'startxref', 1024, true)) {
|
if (find(stream, 'startxref', 1024, true)) {
|
||||||
stream.skip(9);
|
stream.skip(9);
|
||||||
var ch;
|
var ch;
|
||||||
while (Lexer.isSpace(ch = stream.getChar()))
|
while (Lexer.isSpace(ch = stream.getChar())) {}
|
||||||
;
|
|
||||||
var str = '';
|
var str = '';
|
||||||
while ((ch - '0') <= 9) {
|
while ((ch - '0') <= 9) {
|
||||||
str += ch;
|
str += ch;
|
||||||
@ -4430,7 +4429,7 @@ var PartialEvaluator = (function() {
|
|||||||
var type = dict.get('Subtype');
|
var type = dict.get('Subtype');
|
||||||
assertWellFormed(IsName(type), 'invalid font Subtype');
|
assertWellFormed(IsName(type), 'invalid font Subtype');
|
||||||
|
|
||||||
var composite = false
|
var composite = false;
|
||||||
if (type.name == 'Type0') {
|
if (type.name == 'Type0') {
|
||||||
// If font is a composite
|
// If font is a composite
|
||||||
// - get the descendant font
|
// - get the descendant font
|
||||||
@ -4499,7 +4498,7 @@ var PartialEvaluator = (function() {
|
|||||||
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',
|
// According to the spec if 'FontDescriptor' is declared, 'FirstChar',
|
||||||
// 'LastChar' and 'Widths' should exists too, but some PDF encoders seems
|
// 'LastChar' and 'Widths' should exists too, but some PDF encoders seems
|
||||||
// to ignore this rule when a variant of a standart font is used.
|
// to ignore this rule when a variant of a standart font is used.
|
||||||
// TODO Fill the width array depending on which of the base font this is
|
// TODO Fill the width array depending on which of the base font this is
|
||||||
// a variant.
|
// a variant.
|
||||||
var firstChar = xref.fetchIfRef(dict.get('FirstChar')) || 0;
|
var firstChar = xref.fetchIfRef(dict.get('FirstChar')) || 0;
|
||||||
var lastChar = xref.fetchIfRef(dict.get('LastChar')) || 256;
|
var lastChar = xref.fetchIfRef(dict.get('LastChar')) || 256;
|
||||||
|
@ -593,7 +593,7 @@ window.addEventListener('pagechange', function pagechange(evt) {
|
|||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
window.addEventListener('keydown', function keydown(evt) {
|
window.addEventListener('keydown', function keydown(evt) {
|
||||||
switch(evt.keyCode) {
|
switch (evt.keyCode) {
|
||||||
case 61: // FF/Mac '='
|
case 61: // FF/Mac '='
|
||||||
case 107: // FF '+' and '='
|
case 107: // FF '+' and '='
|
||||||
case 187: // Chrome '+'
|
case 187: // Chrome '+'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user