mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-22 16:18:08 +02:00
Warn when pdf.js can't load an OS font
This commit is contained in:
parent
95ab2b8b17
commit
385f275ad9
3 changed files with 18 additions and 11 deletions
|
@ -451,6 +451,7 @@ function getFontSubstitution(
|
|||
css: loadedName,
|
||||
guessFallback: true,
|
||||
loadedName,
|
||||
baseFontName,
|
||||
src: `local(${baseFontName})`,
|
||||
style,
|
||||
};
|
||||
|
@ -470,6 +471,7 @@ function getFontSubstitution(
|
|||
css: `${loadedName},${ultimate}`,
|
||||
guessFallback: false,
|
||||
loadedName,
|
||||
baseFontName,
|
||||
src: src.join(","),
|
||||
style,
|
||||
};
|
||||
|
|
|
@ -97,17 +97,10 @@ class FontLoader {
|
|||
await fontFace.load();
|
||||
this.#systemFonts.add(loadedName);
|
||||
} catch {
|
||||
if (info.guessFallback) {
|
||||
// We're trying to load only one system font.
|
||||
const match = src.match(/^local\((.*)\)$/);
|
||||
warn(
|
||||
`Cannot load system font: ${match?.[1]}, installing it could help to improve PDF rendering.`
|
||||
);
|
||||
} else {
|
||||
warn(
|
||||
`Cannot load system font: ${loadedName} for style ${style.style} and weight ${style.weight}.`
|
||||
);
|
||||
}
|
||||
warn(
|
||||
`Cannot load system font: ${info.baseFontName}, installing it could help to improve PDF rendering.`
|
||||
);
|
||||
|
||||
this.removeNativeFontFace(fontFace);
|
||||
}
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue