From 12144b752746c87eaef4f7bda738cde38c7400f7 Mon Sep 17 00:00:00 2001 From: be5invis Date: Wed, 21 Aug 2024 03:16:27 -0700 Subject: [PATCH] Fixups for linkDeps --- packages/font-otl/src/gsub-cv-ss.ptl | 21 +++++++++++++++------ packages/glyph/src/store.mjs | 5 +++++ 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/packages/font-otl/src/gsub-cv-ss.ptl b/packages/font-otl/src/gsub-cv-ss.ptl index c10c5218ee..b4fa2c7958 100644 --- a/packages/font-otl/src/gsub-cv-ss.ptl +++ b/packages/font-otl/src/gsub-cv-ss.ptl @@ -58,15 +58,23 @@ class CvLookupManager return lookup public [linkDeps] : begin - if (this.decompositionLookup && this.altrenatesLookup) : begin - this.table.setDependency this.decompositionLookup this.altrenatesLookup + if this.decompositionLookup : begin + if this.altrenatesLookup : begin + this.table.setDependency this.decompositionLookup this.altrenatesLookup + foreach lookupSS [items-of this.singleSubstLookups] : if lookupSS : begin + this.table.setDependency this.decompositionLookup lookupSS + foreach lookupCP [items-of this.cherryPickingLookups] : if lookupCP : begin + this.table.setDependency this.decompositionLookup lookupCP + if this.altrenatesLookup : begin foreach lookupSS [items-of this.singleSubstLookups] : if lookupSS : begin this.table.setDependency this.altrenatesLookup lookupSS foreach lookupCP [items-of this.cherryPickingLookups] : if lookupCP : begin this.table.setDependency lookupCP this.altrenatesLookup - foreach lookupSS [items-of this.singleSubstLookups] : if lookupSS : begin - this.table.setDependency lookupCP lookupSS + + foreach lookupCP [items-of this.cherryPickingLookups] : if lookupCP : begin + foreach lookupSS [items-of this.singleSubstLookups] : if lookupSS : begin + this.table.setDependency lookupCP lookupSS public [linkCrossDeps other] : begin if (this.altrenatesLookup && other.altrenatesLookup) : begin @@ -119,7 +127,7 @@ export : define [buildCVSS gsub para glyphStore] : begin feature.addLookup cvSingle grSetUsedBySs.add gr - foreach {gn glyph} [glyphStore.namedEntries] : if [not : CvDecompose.get glyph] : begin + foreach {gn glyph} [glyphStore.namedEntriesWithFilter nonDecomposable] : begin foreach gr [items-of : AnyCv.query glyph] : begin local subst : gr.get glyph if (subst && subst != gn) : begin @@ -141,7 +149,7 @@ export : define [buildCVSS gsub para glyphStore] : begin if cv.decompositionLookup : feature.addLookup cv.decompositionLookup feature.addLookup lookup - foreach {gn glyph} [glyphStore.namedEntries] : if [not : CvDecompose.get glyph] : begin + foreach {gn glyph} [glyphStore.namedEntriesWithFilter nonDecomposable] : begin local subst : gr.get glyph if (subst && subst != gn) : begin set lookup.substitutions.(gn) : glyphStore.ensureExists subst @@ -166,3 +174,4 @@ export : define [buildCVSS gsub para glyphStore] : begin return cvs define [objectIsNotEmpty obj] : obj && [Object.keys obj].length +define [nonDecomposable gn g] : not : CvDecompose.get g diff --git a/packages/glyph/src/store.mjs b/packages/glyph/src/store.mjs index 80209f6ed5..68e135cff2 100644 --- a/packages/glyph/src/store.mjs +++ b/packages/glyph/src/store.mjs @@ -14,6 +14,11 @@ export class GlyphStore { namedEntries() { return this.nameForward.entries(); } + *namedEntriesWithFilter(fn) { + for (const [name, g] of this.nameForward.entries()) { + if (fn(name, g)) yield [name, g]; + } + } glyphNames() { return this.nameForward.keys(); }