Skip to content

Commit ea9cb8a

Browse files
committed
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.*
1 parent 318d665 commit ea9cb8a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/core/evaluator.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -3672,10 +3672,11 @@ class PartialEvaluator {
36723672
toUnicode,
36733673
cssFontInfo,
36743674
}) {
3675+
const isType3Font = type === "Type3";
36753676
let properties;
36763677

36773678
if (!descriptor) {
3678-
if (type === "Type3") {
3679+
if (isType3Font) {
36793680
// FontDescriptor is only required for Type3 fonts when the document
36803681
// is a tagged pdf. Create a barbebones one to get by.
36813682
descriptor = new Dict(null);
@@ -3712,6 +3713,7 @@ class PartialEvaluator {
37123713
firstChar,
37133714
lastChar,
37143715
toUnicode,
3716+
isType3Font,
37153717
};
37163718
const widths = dict.get("Widths");
37173719
return this.extractDataStructures(dict, dict, properties).then(
@@ -3751,7 +3753,7 @@ class PartialEvaluator {
37513753
baseFont = Name.get(baseFont);
37523754
}
37533755

3754-
if (type !== "Type3") {
3756+
if (!isType3Font) {
37553757
const fontNameStr = fontName && fontName.name;
37563758
const baseFontStr = baseFont && baseFont.name;
37573759
if (fontNameStr !== baseFontStr) {
@@ -3816,7 +3818,7 @@ class PartialEvaluator {
38163818
capHeight: descriptor.get("CapHeight"),
38173819
flags: descriptor.get("Flags"),
38183820
italicAngle: descriptor.get("ItalicAngle"),
3819-
isType3Font: false,
3821+
isType3Font,
38203822
cssFontInfo,
38213823
};
38223824

@@ -3838,9 +3840,6 @@ class PartialEvaluator {
38383840
newProperties => {
38393841
this.extractWidths(dict, descriptor, newProperties);
38403842

3841-
if (type === "Type3") {
3842-
newProperties.isType3Font = true;
3843-
}
38443843
return new Font(fontName.name, fontFile, newProperties);
38453844
}
38463845
);

0 commit comments

Comments
 (0)