Skip to content

Commit

Permalink
Fixups for linkDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
be5invis committed Aug 21, 2024
1 parent 77476b2 commit 12144b7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
21 changes: 15 additions & 6 deletions packages/font-otl/src/gsub-cv-ss.ptl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
5 changes: 5 additions & 0 deletions packages/glyph/src/store.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit 12144b7

Please sign in to comment.