Skip to content

Commit

Permalink
Merge pull request #19262 from Snuffleupagus/CompiledFont-assert-font…
Browse files Browse the repository at this point in the history
…Matrix

Assert that the `fontMatrix` is always valid in `compileGlyph`
  • Loading branch information
timvandermeij authored Dec 29, 2024
2 parents 5b94c86 + 2ae5aa0 commit 91d8017
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/core/font_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/

import {
assert,
bytesToString,
FONT_IDENTITY_MATRIX,
FormatError,
Expand All @@ -23,6 +24,7 @@ import {
} from "../shared/util.js";
import { CFFParser } from "./cff_parser.js";
import { getGlyphsUnicode } from "./glyphlist.js";
import { isNumberArray } from "./core_utils.js";
import { StandardEncoding } from "./encodings.js";
import { Stream } from "./stream.js";

Expand Down Expand Up @@ -834,6 +836,7 @@ class CompiledFont {
warn("Invalid fd index for glyph index.");
}
}
assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix.");

const cmds = new Commands();
cmds.transform(fontMatrix.slice());
Expand Down

0 comments on commit 91d8017

Please sign in to comment.