Skip to content

Commit 6a3d5fe

Browse files
committed
Replace a few cases of "manual" font name normalization with the normalizeFontName helper function
1 parent e9c509a commit 6a3d5fe

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/core/evaluator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4463,7 +4463,7 @@ class PartialEvaluator {
44634463
}
44644464

44654465
// Using base font name as a font name.
4466-
baseFontName = baseFontName.name.replaceAll(/[,_]/g, "-");
4466+
baseFontName = normalizeFontName(baseFontName.name);
44674467
const metrics = this.getBaseFontMetrics(baseFontName);
44684468

44694469
// Simulating descriptor flags attribute

src/core/fonts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -992,7 +992,7 @@ class Font {
992992
nonStdFontMap = getNonStdFontMap(),
993993
serifFonts = getSerifFonts();
994994
for (const namePart of name.split("+")) {
995-
let fontName = namePart.replaceAll(/[,_]/g, "-");
995+
let fontName = normalizeFontName(namePart);
996996
fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
997997
fontName = fontName.split("-", 1)[0];
998998
if (serifFonts[fontName]) {

0 commit comments

Comments
 (0)