Add ligation configurability
This commit is contained in:
parent
c1c3ce79ee
commit
2e601b641c
14 changed files with 770 additions and 659 deletions
|
@ -253,11 +253,11 @@ function createGrDisplaySheet(glyphStore, gid) {
|
|||
let charVariantFeatures = [];
|
||||
const decomposition = CvDecompose.get(glyph);
|
||||
if (decomposition) {
|
||||
const variantFeatureSet = new Set();
|
||||
const variantAssignmentSet = new Set();
|
||||
for (const componentGn of decomposition) {
|
||||
const component = glyphStore.queryByName(componentGn);
|
||||
if (!component) continue;
|
||||
const cvRow = queryCvFeatureTagsOf(componentGn, component, variantFeatureSet);
|
||||
const cvRow = queryCvFeatureTagsOf(componentGn, component, variantAssignmentSet);
|
||||
if (cvRow.length) charVariantFeatures.push(cvRow);
|
||||
}
|
||||
} else {
|
||||
|
@ -273,7 +273,7 @@ function queryPairFeatureTags(gid, f1, f2, sink) {
|
|||
const re1 = new RegExp(`\\.${f1}$`),
|
||||
re2 = new RegExp(`\\.${f2}$`);
|
||||
if (re1.test(gid) || re2.test(gid)) {
|
||||
sink.push(f1, f2);
|
||||
sink.push(`'${f1}' 1`, `'${f2}' 1`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -284,7 +284,7 @@ function byTagPreference(a, b) {
|
|||
if (ua > ub) return 1;
|
||||
return 0;
|
||||
}
|
||||
function queryCvFeatureTagsOf(gid, glyph, vfs) {
|
||||
function queryCvFeatureTagsOf(gid, glyph, variantAssignmentSet) {
|
||||
const cvs = AnyCv.query(glyph).sort(byTagPreference);
|
||||
let results = [];
|
||||
let existingGlyphs = new Set();
|
||||
|
@ -294,10 +294,13 @@ function queryCvFeatureTagsOf(gid, glyph, vfs) {
|
|||
if (target === gid) continue;
|
||||
if (existingGlyphs.has(target)) continue;
|
||||
existingGlyphs.add(target);
|
||||
if (!vfs) results.push(tag);
|
||||
else if (!vfs.has(tag)) {
|
||||
results.push(tag);
|
||||
vfs.add(tag);
|
||||
|
||||
const assignCss = `'${tag}' ${gr.rank}`;
|
||||
if (!variantAssignmentSet) {
|
||||
results.push(assignCss);
|
||||
} else if (!variantAssignmentSet.has(assignCss)) {
|
||||
results.push(assignCss);
|
||||
variantAssignmentSet.add(assignCss);
|
||||
}
|
||||
}
|
||||
return results;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue