@@ -36,7 +36,7 @@ The algorithm is based on the following assertions:
3636 union of all segments except for those in the condition. If the glyph does not appear in this closure, then the
3737 condition satisfies the closure requirement for that glyph and is a superset of the true condition. This is called
3838 the “additional conditions” check.
39-
39+
40402 . The glyph closure of all segments includes the glyph that we are analyzing.
4141
42423 . We have a glyph which has some true activation condition. If we compute a glyph closure of some combination of
@@ -106,22 +106,22 @@ only segments from the true condition, when the glyph is not already in the init
106106 non-excluded segments will contain glyph. Thus testing a segment which is not part of the true condition will never
107107 result in glyph missing from the closure, and won't be added to ` sub_condition ` . Therefore ` Finding a Sub Condition `
108108 will only ever return segments that are part of the true condition.
109-
109+
110110* ` Finding a Sub Condition ` will always return at least one segment: if when the last segment is tested ` sub_condition `
111111 is still the empty set, then the closure will be on no segments and will not have glyph in it. This is a result of
112112 assertion (4) and the premise that glyph is not already in the initial font. As a consequence the returned
113113 ` sub_condition ` will always have at least one segment in it.
114-
114+
115115* Since all returned segments from ` Finding a Sub Condition ` are excluded from future calls, there will be a finite
116116 number of ` Finding a Sub Condition ` executions which return only segments part of the true condition.
117-
117+
118118* Lastly, the algorithm terminates only once the additional conditions check finds no additional conditions,
119119 guaranteeing we have found a superset disjunctive condition (assertion (1)).
120-
120+
121121## Making it More Performant
122122
123123As described above this approach can be slow since it processes glyphs one at a time. Improvements to performance
124- can be made by processing glyphs in a batch. This can be done with a recursive approach where after each segment test
124+ can be made by processing glyphs in a batch. This can be done with a recursive approach where after each segment test
125125the set of input glyphs gets split into those that require the tested segment and those that don't. Each of the splits spawns
126126a new recursion (if there is at least one glyph in the split).
127127
@@ -143,13 +143,12 @@ could come in two forms:
143143
144144## Integrating into the Segmentation Algorithm
145145
146- Initially the complex condition analysis has been added as a final step after merging. If after merging unmapped glyphs
147- are present, then the complex condition analysis is run on those glyphs and the fallback patch is replaced with one or
148- more patches based on the results of complex condition analysis.
149-
150- However, ideally complex condition analysis would be run before merging so that the patches it generates can participate
151- in the merging process. This will require incremental updates to the complex condition analysis results, but that should
152- be straightforward. Implementing this is planned for the near future.
146+ The complex condition analysis has been added as a post processing step during the glyph grouping phase. After the
147+ grouping phase finds the initial condition set, complex condition finding is run to find conditions for any remaining
148+ unmapped glyphs. The found complex conditions are added to the condition set and thus are able to participate
149+ in both initial font analysis and patch merging. To make this performant complex conditions are only recomputed for
150+ glyphs/segments that are modified after a merge is performed. The glyph grouping phase has an existing invalidation
151+ mechanism which is utilized to determine which glyphs need to be re-analyzed.
153152
154153
155154
0 commit comments