From acc56491c90a21d16255cc9176e48d7edb3d833d Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 12 Apr 2024 13:57:37 +0200 Subject: [PATCH] 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. --- src/core/font_substitutions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/core/font_substitutions.js b/src/core/font_substitutions.js index 426e6b47e3034..41bc5cc75fbb1 100644 --- a/src/core/font_substitutions.js +++ b/src/core/font_substitutions.js @@ -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;