|
|
@ -1132,27 +1132,41 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); |
|
|
|
properties.cidToGidMap = this.readCidToGidMap(cidToGidMap); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Based on 9.6.6 of the spec the encoding can come from multiple places
|
|
|
|
|
|
|
|
// but should be prioritized in the following order:
|
|
|
|
|
|
|
|
// 1. Encoding dictionary
|
|
|
|
|
|
|
|
// 2. Encoding within font file (Type1 or Type1C)
|
|
|
|
|
|
|
|
// 3. Default (depends on font type)
|
|
|
|
|
|
|
|
// Differences applied to the above.
|
|
|
|
|
|
|
|
// Note: we don't fill in the encoding from the font file(2) here but use
|
|
|
|
|
|
|
|
// the flag overridableEncoding to signal that the font can override the
|
|
|
|
|
|
|
|
// encoding if it has one built in.
|
|
|
|
|
|
|
|
var overridableEncoding = true; |
|
|
|
|
|
|
|
var hasEncoding = false; |
|
|
|
var flags = properties.flags; |
|
|
|
var flags = properties.flags; |
|
|
|
var differences = []; |
|
|
|
var differences = []; |
|
|
|
var baseEncoding = Encodings.StandardEncoding; |
|
|
|
var baseEncoding = properties.type === 'TrueType' ? |
|
|
|
|
|
|
|
Encodings.WinAnsiEncoding : |
|
|
|
|
|
|
|
Encodings.StandardEncoding; |
|
|
|
// The Symbolic attribute can be misused for regular fonts
|
|
|
|
// The Symbolic attribute can be misused for regular fonts
|
|
|
|
// Heuristic: we have to check if the font is a standard one also
|
|
|
|
// Heuristic: we have to check if the font is a standard one also
|
|
|
|
if (!!(flags & FontFlags.Symbolic)) { |
|
|
|
if (!!(flags & FontFlags.Symbolic)) { |
|
|
|
baseEncoding = !properties.file ? Encodings.symbolsEncoding : |
|
|
|
baseEncoding = !properties.file ? Encodings.symbolsEncoding : |
|
|
|
Encodings.MacRomanEncoding; |
|
|
|
Encodings.MacRomanEncoding; |
|
|
|
} |
|
|
|
} |
|
|
|
var hasEncoding = dict.has('Encoding'); |
|
|
|
if (dict.has('Encoding')) { |
|
|
|
if (hasEncoding) { |
|
|
|
|
|
|
|
var encoding = dict.get('Encoding'); |
|
|
|
var encoding = dict.get('Encoding'); |
|
|
|
if (isDict(encoding)) { |
|
|
|
if (isDict(encoding)) { |
|
|
|
var baseName = encoding.get('BaseEncoding'); |
|
|
|
var baseName = encoding.get('BaseEncoding'); |
|
|
|
if (baseName) |
|
|
|
if (baseName) { |
|
|
|
|
|
|
|
overridableEncoding = false; |
|
|
|
|
|
|
|
hasEncoding = true; |
|
|
|
baseEncoding = Encodings[baseName.name]; |
|
|
|
baseEncoding = Encodings[baseName.name]; |
|
|
|
else |
|
|
|
} |
|
|
|
hasEncoding = false; // base encoding was not provided
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Load the differences between the base and original
|
|
|
|
// Load the differences between the base and original
|
|
|
|
if (encoding.has('Differences')) { |
|
|
|
if (encoding.has('Differences')) { |
|
|
|
|
|
|
|
hasEncoding = true; |
|
|
|
var diffEncoding = encoding.get('Differences'); |
|
|
|
var diffEncoding = encoding.get('Differences'); |
|
|
|
var index = 0; |
|
|
|
var index = 0; |
|
|
|
for (var j = 0, jj = diffEncoding.length; j < jj; j++) { |
|
|
|
for (var j = 0, jj = diffEncoding.length; j < jj; j++) { |
|
|
@ -1164,6 +1178,8 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (isName(encoding)) { |
|
|
|
} else if (isName(encoding)) { |
|
|
|
|
|
|
|
overridableEncoding = false; |
|
|
|
|
|
|
|
hasEncoding = true; |
|
|
|
baseEncoding = Encodings[encoding.name]; |
|
|
|
baseEncoding = Encodings[encoding.name]; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
error('Encoding is not a Name nor a Dict'); |
|
|
|
error('Encoding is not a Name nor a Dict'); |
|
|
@ -1173,6 +1189,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() { |
|
|
|
properties.differences = differences; |
|
|
|
properties.differences = differences; |
|
|
|
properties.baseEncoding = baseEncoding; |
|
|
|
properties.baseEncoding = baseEncoding; |
|
|
|
properties.hasEncoding = hasEncoding; |
|
|
|
properties.hasEncoding = hasEncoding; |
|
|
|
|
|
|
|
properties.overridableEncoding = overridableEncoding; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode, xref, |
|
|
|
readToUnicode: function PartialEvaluator_readToUnicode(toUnicode, xref, |
|
|
|