mirror of
https://github.com/servo/servo
synced 2026-04-25 17:15:48 +02:00
This change reworks the logic for finding font fallbacks to make it simpler. I was involved with writing the code for `FontGroupFamily` and `FontGroupFamilyMember` and I still struggle a bit with understanding it, so I've chosen to do this. In addition, the change is in preparation for more flexible font fallback (#41426). The main changes here are: 1. Move the logic for creating a new descriptor with variations into the Font constructor. 2. Add some more general methods to `FontGroupFamily` such as a template iterator. 3. Use `OnceLock` to avoid a convoluted code structure because of mutability and also having boolean "loaded" members. This is what `OnceLock` and `OnceCell` are for! 4. Rename `FontGroupFamilyMember` to `FontGroupFamilyTemplate` to stress that it is one template of a particular `FontGroupFamily`. Testing: This should not change behavior so is covered by existing WPT tests. --------- Signed-off-by: Martin Robinson <mrobinson@igalia.com>