More cleanup
This commit is contained in:
parent
e2ff6698d1
commit
0031b3362e
1 changed files with 6 additions and 4 deletions
|
@ -10,13 +10,15 @@ module.exports = function finalizeFont(para, glyphStore, excludedCodePoints, res
|
||||||
return glyphStore;
|
return glyphStore;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// In FontConfig, a font is considered "monospace" if and only if all non-combining characters
|
||||||
|
// (AW > 0) have the same width. We use this method to validate whether our "Fixed" subfamilies
|
||||||
|
// are properly built.
|
||||||
function validateMonospace(para, glyphStore) {
|
function validateMonospace(para, glyphStore) {
|
||||||
if (!para.forceMonospace) return;
|
if (!para.forceMonospace) return;
|
||||||
let awSet = new Set();
|
let awSet = new Set();
|
||||||
for (const g of glyphStore.glyphs()) {
|
for (const g of glyphStore.glyphs()) {
|
||||||
awSet.add(Math.round(g.advanceWidth || 0));
|
const aw = Math.round(g.advanceWidth || 0);
|
||||||
}
|
if (aw > 0) awSet.add(aw);
|
||||||
if (awSet.size > 2) {
|
|
||||||
throw new Error("Unreachable! Fixed variant has wide characters");
|
|
||||||
}
|
}
|
||||||
|
if (awSet.size > 1) throw new Error("Unreachable! Fixed variant has wide characters");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue