Fix the metrics of wide characters, making Extended families compatible with FontConfig’s “dual” width (#1247).
This commit is contained in:
parent
8270d53730
commit
81827f16ba
15 changed files with 14 additions and 8 deletions
|
@ -31,11 +31,16 @@ function assignSubRank(glyphStore) {
|
|||
// (AW > 0) have the same width. We use this method to validate whether our "Fixed" subfamilies
|
||||
// are properly built.
|
||||
function validateMonospace(para, glyphStore) {
|
||||
if (!para.forceMonospace) return;
|
||||
let awSet = new Set();
|
||||
for (const [u, g] of glyphStore.encodedEntries()) {
|
||||
const aw = Math.round(g.advanceWidth || 0);
|
||||
if (aw > 0) awSet.add(aw);
|
||||
}
|
||||
if (awSet.size > 1) throw new Error("Unreachable! Fixed variant has wide characters");
|
||||
if (para.forceMonospace && awSet.size > 1) {
|
||||
throw new Error("Unreachable! Fixed variant has wide characters");
|
||||
}
|
||||
if (!para.isQuasiProportional && awSet.size > 2) {
|
||||
console.log(awSet);
|
||||
throw new Error("Unreachable! Fixed variant has wide characters");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue