Update utils.js
This commit is contained in:
parent
62a3212629
commit
5de617dfe2
1 changed files with 3 additions and 6 deletions
|
@ -223,10 +223,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!/^\d+-\d+$/.test(sRange)) {
|
if (!/^\d+-\d+$/.test(sRange)) {
|
||||||
console.error(
|
console.error('ERROR: Invalid range: %s', sRange);
|
||||||
'ERROR: Invalid range: %s',
|
|
||||||
sanitizedRange.replace(/\n|\r/g, ''),
|
|
||||||
);
|
|
||||||
throw new Error('Invalid range');
|
throw new Error('Invalid range');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +239,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(
|
console.error(
|
||||||
'ERROR: Font not found: %s, Error: %s',
|
'ERROR: Font not found: %s, Error: %s',
|
||||||
filename.replace(/\n|\r/g, ''),
|
filename,
|
||||||
String(err),
|
String(err),
|
||||||
);
|
);
|
||||||
if (fallbacks && Object.keys(fallbacks).length) {
|
if (fallbacks && Object.keys(fallbacks).length) {
|
||||||
|
@ -262,7 +259,7 @@ async function getFontPbf(allowedFonts, fontPath, name, range, fallbacks) {
|
||||||
console.error(
|
console.error(
|
||||||
`ERROR: Trying to use %s as a fallback for: %s`,
|
`ERROR: Trying to use %s as a fallback for: %s`,
|
||||||
fallbackName,
|
fallbackName,
|
||||||
sanitizedName,
|
sFontStack,
|
||||||
);
|
);
|
||||||
delete fallbacks[fallbackName];
|
delete fallbacks[fallbackName];
|
||||||
return getFontPbf(null, fontPath, fallbackName, range, fallbacks);
|
return getFontPbf(null, fontPath, fallbackName, range, fallbacks);
|
||||||
|
|
Loading…
Reference in a new issue