[Debugger] Add some info about substitution font

When pdfBug is true, the substitution font is used in the text layer in order
to be able to know what is the font really used thanks to the devtools.
And to be sure that fonts are loaded, the font cache isn't cleaned up when
the debugger is active.
This commit is contained in:
Calixte Denizet 2023-10-05 10:19:07 +02:00
parent b4cd8ad215
commit 7851c0da8d
5 changed files with 41 additions and 18 deletions

View file

@ -2427,13 +2427,17 @@ class PartialEvaluator {
const { font, loadedName } = textState;
if (!seenStyles.has(loadedName)) {
seenStyles.add(loadedName);
textContent.styles[loadedName] = {
fontFamily: font.fallbackName,
ascent: font.ascent,
descent: font.descent,
vertical: font.vertical,
};
if (self.options.fontExtraProperties && font.systemFontInfo) {
const style = textContent.styles[loadedName];
style.fontSubstitution = font.systemFontInfo.css;
style.fontSubstitutionLoadedName = font.systemFontInfo.loadedName;
}
}
textContentItem.fontName = loadedName;