Reduce the duplication slightly when detecting an OpenType font (in the Font constructor)

This commit is contained in:
Jonas Jenwald 2017-06-09 18:26:57 +02:00
parent e6f5b3e37e
commit 999e30723d

View File

@ -628,26 +628,26 @@ var Font = (function FontClosure() {
} }
} else if (isOpenTypeFile(file)) { } else if (isOpenTypeFile(file)) {
// Sometimes the type/subtype can be a complete lie (see issue7598.pdf). // Sometimes the type/subtype can be a complete lie (see issue7598.pdf).
type = subtype = 'OpenType'; subtype = 'OpenType';
} }
} }
if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') { if (subtype === 'CIDFontType0C' && type !== 'CIDFontType0') {
type = 'CIDFontType0'; type = 'CIDFontType0';
} }
if (subtype === 'OpenType') {
type = 'OpenType';
}
// Some CIDFontType0C fonts by mistake claim CIDFontType0. // Some CIDFontType0C fonts by mistake claim CIDFontType0.
if (type === 'CIDFontType0') { if (type === 'CIDFontType0') {
if (isType1File(file)) { if (isType1File(file)) {
subtype = 'CIDFontType0'; subtype = 'CIDFontType0';
} else if (isOpenTypeFile(file)) { } else if (isOpenTypeFile(file)) {
// Sometimes the type/subtype can be a complete lie (see issue6782.pdf). // Sometimes the type/subtype can be a complete lie (see issue6782.pdf).
type = subtype = 'OpenType'; subtype = 'OpenType';
} else { } else {
subtype = 'CIDFontType0C'; subtype = 'CIDFontType0C';
} }
} }
if (subtype === 'OpenType' && type !== 'OpenType') {
type = 'OpenType';
}
var data; var data;
switch (type) { switch (type) {