Merge pull request #19262 from Snuffleupagus/CompiledFont-assert-fontMatrix

Assert that the `fontMatrix` is always valid in `compileGlyph`
This commit is contained in:
Tim van der Meij 2024-12-29 15:41:04 +01:00 committed by GitHub
commit 91d801728d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,6 +14,7 @@
*/ */
import { import {
assert,
bytesToString, bytesToString,
FONT_IDENTITY_MATRIX, FONT_IDENTITY_MATRIX,
FormatError, FormatError,
@ -23,6 +24,7 @@ import {
} from "../shared/util.js"; } from "../shared/util.js";
import { CFFParser } from "./cff_parser.js"; import { CFFParser } from "./cff_parser.js";
import { getGlyphsUnicode } from "./glyphlist.js"; import { getGlyphsUnicode } from "./glyphlist.js";
import { isNumberArray } from "./core_utils.js";
import { StandardEncoding } from "./encodings.js"; import { StandardEncoding } from "./encodings.js";
import { Stream } from "./stream.js"; import { Stream } from "./stream.js";
@ -834,6 +836,7 @@ class CompiledFont {
warn("Invalid fd index for glyph index."); warn("Invalid fd index for glyph index.");
} }
} }
assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix.");
const cmds = new Commands(); const cmds = new Commands();
cmds.transform(fontMatrix.slice()); cmds.transform(fontMatrix.slice());