1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Warn when a non-embedded font has an invalid name

It can be helpful to find out some heuristics when trying
to find a substitution font.
This commit is contained in:
Calixte Denizet 2024-04-12 13:57:37 +02:00
parent e005e6ecdd
commit acc56491c9

View file

@ -15,6 +15,7 @@
import { normalizeFontName } from "./fonts_utils.js";
import { validateFontName } from "./core_utils.js";
import { warn } from "../shared/util.js";
const NORMAL = {
style: "normal",
@ -513,6 +514,7 @@ function getFontSubstitution(
const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
if (!substitution) {
if (!validateFontName(baseFontName)) {
warn(`Cannot substitute the font because of its name: ${baseFontName}`);
systemFontCache.set(key, null);
// If the baseFontName is not valid we don't want to use it.
return null;