Don't accidentally use an empty hash
value when comparing preEvaluatedFonts
in PartialEvaluator.loadFont
Note that `PartialEvaluator.preEvaluateFont` will return an empty string when no hash was computed. This will complete short-circuit the `fontAlias` comparison in `PartialEvaluator.loadFont`, since fonts which are totally different will then match if their `hash`es are empty.
This commit is contained in:
parent
cf1acd3eaf
commit
a2a824ed01
@ -695,20 +695,19 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
var fontCapability = createPromiseCapability();
|
||||
|
||||
var preEvaluatedFont = this.preEvaluateFont(font);
|
||||
var descriptor = preEvaluatedFont.descriptor;
|
||||
const { descriptor, hash, } = preEvaluatedFont;
|
||||
|
||||
var fontRefIsRef = isRef(fontRef), fontID;
|
||||
if (fontRefIsRef) {
|
||||
fontID = fontRef.toString();
|
||||
}
|
||||
|
||||
if (isDict(descriptor)) {
|
||||
if (hash && isDict(descriptor)) {
|
||||
if (!descriptor.fontAliases) {
|
||||
descriptor.fontAliases = Object.create(null);
|
||||
}
|
||||
|
||||
var fontAliases = descriptor.fontAliases;
|
||||
var hash = preEvaluatedFont.hash;
|
||||
|
||||
if (fontAliases[hash]) {
|
||||
var aliasFontRef = fontAliases[hash].aliasRef;
|
||||
if (fontRefIsRef && aliasFontRef &&
|
||||
@ -785,7 +784,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
|
||||
|
||||
try {
|
||||
// error, but it's still nice to have font type reported
|
||||
var descriptor = preEvaluatedFont.descriptor;
|
||||
var fontFile3 = descriptor && descriptor.get('FontFile3');
|
||||
var subtype = fontFile3 && fontFile3.get('Subtype');
|
||||
var fontType = getFontType(preEvaluatedFont.type,
|
||||
|
Loading…
Reference in New Issue
Block a user