Fix GR page display
This commit is contained in:
parent
394f461265
commit
245b2a3948
1 changed files with 13 additions and 9 deletions
|
@ -287,12 +287,10 @@ function createGrDisplaySheet(glyphStore, gid) {
|
||||||
for (const componentGn of decomposition) {
|
for (const componentGn of decomposition) {
|
||||||
const component = glyphStore.queryByName(componentGn);
|
const component = glyphStore.queryByName(componentGn);
|
||||||
if (!component) continue;
|
if (!component) continue;
|
||||||
const cvRow = queryCvFeatureTagsOf(componentGn, component, variantAssignmentSet);
|
queryCvFeatureTagsOf(charVariantFeatures, componentGn, component, variantAssignmentSet);
|
||||||
if (cvRow.length) charVariantFeatures.push(cvRow);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const cvRow = queryCvFeatureTagsOf(gid, glyph, null);
|
queryCvFeatureTagsOf(charVariantFeatures, gid, glyph, null);
|
||||||
if (cvRow.length) charVariantFeatures.push(cvRow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return [typographicFeatures, charVariantFeatures];
|
return [typographicFeatures, charVariantFeatures];
|
||||||
|
@ -314,10 +312,10 @@ function byTagPreference(a, b) {
|
||||||
if (ua > ub) return 1;
|
if (ua > ub) return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
function queryCvFeatureTagsOf(gid, glyph, variantAssignmentSet) {
|
function queryCvFeatureTagsOf(sink, gid, glyph, variantAssignmentSet) {
|
||||||
const cvs = AnyCv.query(glyph).sort(byTagPreference);
|
const cvs = AnyCv.query(glyph).sort(byTagPreference);
|
||||||
let results = [];
|
|
||||||
let existingGlyphs = new Set();
|
let existingGlyphs = new Set();
|
||||||
|
let m = new Map();
|
||||||
for (const gr of cvs) {
|
for (const gr of cvs) {
|
||||||
const tag = gr.tag;
|
const tag = gr.tag;
|
||||||
const target = gr.get(glyph);
|
const target = gr.get(glyph);
|
||||||
|
@ -325,15 +323,21 @@ function queryCvFeatureTagsOf(gid, glyph, variantAssignmentSet) {
|
||||||
if (existingGlyphs.has(target)) continue;
|
if (existingGlyphs.has(target)) continue;
|
||||||
existingGlyphs.add(target);
|
existingGlyphs.add(target);
|
||||||
|
|
||||||
|
let g = m.get(tag);
|
||||||
|
if (!g) {
|
||||||
|
g = [];
|
||||||
|
m.set(tag, g);
|
||||||
|
}
|
||||||
|
|
||||||
const assignCss = `'${tag}' ${gr.rank}`;
|
const assignCss = `'${tag}' ${gr.rank}`;
|
||||||
if (!variantAssignmentSet) {
|
if (!variantAssignmentSet) {
|
||||||
results.push(assignCss);
|
g.push(assignCss);
|
||||||
} else if (!variantAssignmentSet.has(assignCss)) {
|
} else if (!variantAssignmentSet.has(assignCss)) {
|
||||||
results.push(assignCss);
|
g.push(assignCss);
|
||||||
variantAssignmentSet.add(assignCss);
|
variantAssignmentSet.add(assignCss);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return results;
|
for (const g of m.values()) sink.push(g.sort());
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Dotless = Dotless;
|
exports.Dotless = Dotless;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue