diff --git a/src/core/evaluator.js b/src/core/evaluator.js index 3e836ce16..ecef46302 100644 --- a/src/core/evaluator.js +++ b/src/core/evaluator.js @@ -4606,6 +4606,10 @@ class PartialEvaluator { if (typeof italicAngle !== "number") { italicAngle = 0; } + let fontWeight = descriptor.get("FontWeight"); + if (typeof fontWeight !== "number") { + fontWeight = 400; + } const properties = { type, @@ -4630,6 +4634,7 @@ class PartialEvaluator { capHeight, flags, italicAngle, + fontWeight, isType3Font, cssFontInfo, scaleFactors: glyphScaleFactors, diff --git a/src/core/fonts.js b/src/core/fonts.js index 97ea14c70..19f2c795e 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -1042,6 +1042,16 @@ class Font { this.fontMatrix = properties.fontMatrix; this.bbox = properties.bbox; this.defaultEncoding = properties.defaultEncoding; + if (typeof properties.fontWeight === "number") { + if (properties.fontWeight === 900) { + this.black = true; + } else if (properties.fontWeight >= 700) { + this.bold = true; + } + } + if (typeof properties.italicAngle === "number" && properties.italicAngle) { + this.italic = true; + } this.toUnicode = properties.toUnicode; this.toFontChar = [];