Do the isType3Font
-check *once*, rather than repeating it, in PartialEvaluator.translateFont
*This is a small piece of clean-up that I happened to notice while browsing the code.*
This commit is contained in:
parent
68350378c0
commit
c4429bc3f2
@ -3672,10 +3672,11 @@ class PartialEvaluator {
|
|||||||
toUnicode,
|
toUnicode,
|
||||||
cssFontInfo,
|
cssFontInfo,
|
||||||
}) {
|
}) {
|
||||||
|
const isType3Font = type === "Type3";
|
||||||
let properties;
|
let properties;
|
||||||
|
|
||||||
if (!descriptor) {
|
if (!descriptor) {
|
||||||
if (type === "Type3") {
|
if (isType3Font) {
|
||||||
// FontDescriptor is only required for Type3 fonts when the document
|
// FontDescriptor is only required for Type3 fonts when the document
|
||||||
// is a tagged pdf. Create a barbebones one to get by.
|
// is a tagged pdf. Create a barbebones one to get by.
|
||||||
descriptor = new Dict(null);
|
descriptor = new Dict(null);
|
||||||
@ -3712,6 +3713,7 @@ class PartialEvaluator {
|
|||||||
firstChar,
|
firstChar,
|
||||||
lastChar,
|
lastChar,
|
||||||
toUnicode,
|
toUnicode,
|
||||||
|
isType3Font,
|
||||||
};
|
};
|
||||||
const widths = dict.get("Widths");
|
const widths = dict.get("Widths");
|
||||||
return this.extractDataStructures(dict, dict, properties).then(
|
return this.extractDataStructures(dict, dict, properties).then(
|
||||||
@ -3751,7 +3753,7 @@ class PartialEvaluator {
|
|||||||
baseFont = Name.get(baseFont);
|
baseFont = Name.get(baseFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type !== "Type3") {
|
if (!isType3Font) {
|
||||||
const fontNameStr = fontName && fontName.name;
|
const fontNameStr = fontName && fontName.name;
|
||||||
const baseFontStr = baseFont && baseFont.name;
|
const baseFontStr = baseFont && baseFont.name;
|
||||||
if (fontNameStr !== baseFontStr) {
|
if (fontNameStr !== baseFontStr) {
|
||||||
@ -3816,7 +3818,7 @@ class PartialEvaluator {
|
|||||||
capHeight: descriptor.get("CapHeight"),
|
capHeight: descriptor.get("CapHeight"),
|
||||||
flags: descriptor.get("Flags"),
|
flags: descriptor.get("Flags"),
|
||||||
italicAngle: descriptor.get("ItalicAngle"),
|
italicAngle: descriptor.get("ItalicAngle"),
|
||||||
isType3Font: false,
|
isType3Font,
|
||||||
cssFontInfo,
|
cssFontInfo,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -3838,9 +3840,6 @@ class PartialEvaluator {
|
|||||||
newProperties => {
|
newProperties => {
|
||||||
this.extractWidths(dict, descriptor, newProperties);
|
this.extractWidths(dict, descriptor, newProperties);
|
||||||
|
|
||||||
if (type === "Type3") {
|
|
||||||
newProperties.isType3Font = true;
|
|
||||||
}
|
|
||||||
return new Font(fontName.name, fontFile, newProperties);
|
return new Font(fontName.name, fontFile, newProperties);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user