googlefonts / fontations

Reading and writing font files
Apache License 2.0
395 stars 26 forks source link

[IFT] major rework to the IFT API around patch intersection and application. #1239

Closed garretrieger closed 1 week ago

garretrieger commented 1 week ago

Adds a new patch_group module which generates a candidate set of URIs to be applied next based on the list of intersecting patches. The candidate URI group is structured to enforce compatibility constraints between patches. PatchGroup's can then be used to trigger the next iteration of patch application.

Example usage:

loop {
  let g = PatchGroup::select_next_patches(font, &subset_definition).unwrap();
  if !g.has_uris() {
    break;
  }

  // g.uris() lists patches to be downloaded, 
  // patch_data is populated with downloaded data.
  let patch_data = ...;

  font = g.apply_next_patches(&mut patch_data).unwrap();
}