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

Remove the tag for missing font subset when trying to find a substitution

Fixes #17929.
This commit is contained in:
Calixte Denizet 2024-04-11 17:55:11 +02:00
parent f3b03e5c4b
commit 52ea2333b3
6 changed files with 71 additions and 15 deletions

View file

@ -4261,7 +4261,8 @@ class PartialEvaluator {
this.idFactory,
this.options.standardFontDataUrl,
baseFontName,
standardFontName
standardFontName,
type
);
}
@ -4381,7 +4382,8 @@ class PartialEvaluator {
this.idFactory,
this.options.standardFontDataUrl,
fontName.name,
standardFontName
standardFontName,
type
);
}
}

View file

@ -456,6 +456,7 @@ function generateFont(
* @param {String} baseFontName The font name to be substituted.
* @param {String|undefined} standardFontName The standard font name to use
* if the base font is not available.
* @param {String} type The font type.
* @returns an Object with the CSS, the loaded name, the src and the style.
*/
function getFontSubstitution(
@ -463,12 +464,21 @@ function getFontSubstitution(
idFactory,
localFontPath,
baseFontName,
standardFontName
standardFontName,
type
) {
if (baseFontName.startsWith("InvalidPDFjsFont_")) {
return null;
}
if (
(type === "TrueType" || type === "Type1") &&
/^[A-Z]{6}\+/.test(baseFontName)
) {
// When the font is a subset, we need to remove the prefix (see 9.6.4).
baseFontName = baseFontName.slice(7);
}
// It's possible to have a font name with spaces, commas or dashes, hence we
// just replace them by a dash.
baseFontName = normalizeFontName(baseFontName);