Fix tests failure by cloning the GlyphsUnicode object
This commit is contained in:
parent
fcf0c69abd
commit
da6acb200a
17
fonts.js
17
fonts.js
@ -447,13 +447,14 @@ var Font = (function Font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var data;
|
var data;
|
||||||
switch (properties.type) {
|
var type = properties.type;
|
||||||
|
switch (type) {
|
||||||
case 'Type1':
|
case 'Type1':
|
||||||
case 'CIDFontType0':
|
case 'CIDFontType0':
|
||||||
this.mimetype = 'font/opentype';
|
this.mimetype = 'font/opentype';
|
||||||
|
|
||||||
var subtype = properties.subtype;
|
var subtype = properties.subtype;
|
||||||
var cff = (subtype == 'Type1C' || properties.type == 'CIDFontType0') ?
|
var cff = (subtype == 'Type1C' || subtype == 'CIDFontType0C') ?
|
||||||
new Type2CFF(file, properties) : 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
|
||||||
@ -475,7 +476,7 @@ var Font = (function Font() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.data = data;
|
this.data = data;
|
||||||
this.type = properties.type;
|
this.type = type;
|
||||||
this.textMatrix = properties.textMatrix;
|
this.textMatrix = properties.textMatrix;
|
||||||
this.defaultWidth = properties.defaultWidth;
|
this.defaultWidth = properties.defaultWidth;
|
||||||
this.loadedName = getUniqueName();
|
this.loadedName = getUniqueName();
|
||||||
@ -2522,8 +2523,8 @@ var Type2CFF = (function() {
|
|||||||
|
|
||||||
if (pos == 0 || pos == 1) {
|
if (pos == 0 || pos == 1) {
|
||||||
var gid = 1;
|
var gid = 1;
|
||||||
var baseEncoding =
|
var baseEncoding = pos ? Encodings.ExpertEncoding.slice() :
|
||||||
pos ? Encodings.ExpertEncoding : Encodings.StandardEncoding;
|
Encodings.StandardEncoding.slice();
|
||||||
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)
|
||||||
@ -2569,11 +2570,11 @@ var Type2CFF = (function() {
|
|||||||
|
|
||||||
parseCharsets: function cff_parsecharsets(pos, length, strings) {
|
parseCharsets: function cff_parsecharsets(pos, length, strings) {
|
||||||
if (pos == 0) {
|
if (pos == 0) {
|
||||||
return ISOAdobeCharset;
|
return ISOAdobeCharset.slice();
|
||||||
} else if (pos == 1) {
|
} else if (pos == 1) {
|
||||||
return ExpertCharset;
|
return ExpertCharset.slice();
|
||||||
} else if (pos == 2) {
|
} else if (pos == 2) {
|
||||||
return ExpertSubsetCharset;
|
return ExpertSubsetCharset.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
var bytes = this.bytes;
|
var bytes = this.bytes;
|
||||||
|
9
pdf.js
9
pdf.js
@ -4280,8 +4280,9 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
properties.widths = glyphsWidths;
|
properties.widths = glyphsWidths;
|
||||||
|
|
||||||
var cidToGidMap = dict.get('CIDToGIDMap');
|
var cidToGidMap = dict.get('CIDToGIDMap');
|
||||||
if (!cidToGidMap || !IsRef(cidToGidMap))
|
if (!cidToGidMap || !IsRef(cidToGidMap)) {
|
||||||
return GlyphsUnicode;
|
return Object.create(GlyphsUnicode);
|
||||||
|
}
|
||||||
|
|
||||||
// Extract the encoding from the CIDToGIDMap
|
// Extract the encoding from the CIDToGIDMap
|
||||||
var glyphsStream = xref.fetchIfRef(cidToGidMap);
|
var glyphsStream = xref.fetchIfRef(cidToGidMap);
|
||||||
@ -4318,7 +4319,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
'9.7.5.3');
|
'9.7.5.3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return GlyphsUnicode;
|
return Object.create(GlyphsUnicode);
|
||||||
}
|
}
|
||||||
|
|
||||||
var differences = properties.differences;
|
var differences = properties.differences;
|
||||||
@ -4494,7 +4495,7 @@ var PartialEvaluator = (function partialEvaluator() {
|
|||||||
var map = {};
|
var map = {};
|
||||||
if (/^Symbol(-?(Bold|Italic))*$/.test(name)) {
|
if (/^Symbol(-?(Bold|Italic))*$/.test(name)) {
|
||||||
// special case for symbols
|
// special case for symbols
|
||||||
var encoding = Encodings.symbolsEncoding;
|
var encoding = Encodings.symbolsEncoding.slice();
|
||||||
for (var i = 0, n = encoding.length, j; i < n; i++) {
|
for (var i = 0, n = encoding.length, j; i < n; i++) {
|
||||||
if (!(j = encoding[i]))
|
if (!(j = encoding[i]))
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user