From 6bdbb5c5ca928ecd38a72dc4c72c0879cea49a3b Mon Sep 17 00:00:00 2001 From: Jonas Jenwald Date: Mon, 2 Jan 2023 16:21:48 +0100 Subject: [PATCH] Update the `type`/`subtype` at the end of font parsing This fixes a warning reported by CodeQL, and should also make general sense given that we parse the font-data to determine the *actual* `type`/`subtype` rather than trusting the PDF document. --- src/core/fonts.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/fonts.js b/src/core/fonts.js index 4d09e7234..b0c35cd98 100644 --- a/src/core/fonts.js +++ b/src/core/fonts.js @@ -945,8 +945,7 @@ class Font { this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic); this.isMonospace = !!(properties.flags & FontFlags.FixedPitch); - let type = properties.type; - let subtype = properties.subtype; + let { type, subtype } = properties; this.type = type; this.subtype = subtype; @@ -1064,6 +1063,8 @@ class Font { this.data = data; // Transfer some properties again that could change during font conversion + this.type = type; + this.subtype = subtype; this.fontMatrix = properties.fontMatrix; this.widths = properties.widths; this.defaultWidth = properties.defaultWidth;