Add font weight to font instance.

This commit is contained in:
Edoardo Cavazza 2025-10-01 19:35:15 +02:00 committed by GitHub
parent 7fa50712c9
commit 3fcb77a1a2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 0 deletions

View File

@ -4599,6 +4599,10 @@ class PartialEvaluator {
if (typeof italicAngle !== "number") {
italicAngle = 0;
}
let fontWeight = descriptor.get("FontWeight");
if (typeof fontWeight !== "number") {
fontWeight = 400;
}
const properties = {
type,
@ -4623,6 +4627,7 @@ class PartialEvaluator {
capHeight,
flags,
italicAngle,
fontWeight,
isType3Font,
cssFontInfo,
scaleFactors: glyphScaleFactors,

View File

@ -91,6 +91,7 @@ const EXPORT_DATA_PROPERTIES = [
"fallbackName",
"fontExtraProperties",
"fontMatrix",
"fontWeight",
"isInvalidPDFjsFont",
"isType3Font",
"italic",
@ -1036,6 +1037,7 @@ class Font {
this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
this.lineHeight = this.ascent - this.descent;
this.fontMatrix = properties.fontMatrix;
this.fontWeight = properties.fontWeight;
this.bbox = properties.bbox;
this.defaultEncoding = properties.defaultEncoding;