-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[read-fonts] Only inspect reachable lookups for closure
Previously we just looked at every lookup in the lookup list when computing the closure. This sounds okay at first glance, but it overlooks the fact that the lookup list can include lookups that are only reachable via other contextual lookups. This introduces a much more rigorous approach, where on each run we recalculate the set of reachable lookups, by checking to see if the current set of glyphs matches any (chain) contextual rules, and then adding the appropriate lookups from those rules.
- Loading branch information
Showing
8 changed files
with
379 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
feature SUB6 { | ||
lookup GSUB6f1 { | ||
sub one two three' four' five six seven by X; | ||
sub two one three' four' six five seven by Y; | ||
} GSUB6f1; | ||
|
||
# format 2 is generally less efficient than format 3 and hard to generate | ||
# (as in, I'm not aware of any input that will compile to format 2) | ||
lookup GSUB6f3 { | ||
sub [space comma semicolon] e' by e.2; | ||
} GSUB6f3; | ||
} SUB6; | ||
|
||
# can't declare in a feature or it gets added to the feature | ||
lookup MY_RULES { | ||
sub f by f.2; | ||
} MY_RULES; | ||
|
||
feature SUB5 { | ||
lookup GSUB5f1 { | ||
sub a' b' by a_b; | ||
sub c' d' by c_d; | ||
} GSUB5f1; | ||
|
||
lookup GSUB5f3 { | ||
sub f' lookup MY_RULES g'; | ||
} GSUB5f3; | ||
} SUB5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
.notdef | ||
space | ||
comma | ||
semicolon | ||
one | ||
two | ||
three | ||
four | ||
five | ||
six | ||
seven | ||
X | ||
Y | ||
a | ||
b | ||
c | ||
d | ||
e | ||
f | ||
g | ||
e.2 | ||
f.2 | ||
a_b | ||
c_d |
12 changes: 12 additions & 0 deletions
12
font-test-data/test_data/fea/recursive_context_closure.fea
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
feature test { | ||
|
||
lookup first { | ||
sub a b' c by B; | ||
sub a B.2' by B.3; | ||
} first; | ||
|
||
lookup second { | ||
sub a B' c by B.2; | ||
} second; | ||
|
||
} test; |
6 changes: 6 additions & 0 deletions
6
font-test-data/test_data/fea/recursive_context_closure_glyphs.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
a | ||
b | ||
c | ||
B | ||
B.2 | ||
B.3 |
Binary file not shown.
Binary file not shown.
Oops, something went wrong.