refactor(font): move ownership of Metrics to Collection

This sets the stage for dynamically adjusting the sizes of fallback
fonts based on the primary font's face metrics. It also removes a lot of
unnecessary work when loading fallback fonts, since we only actually use
the metrics based on the parimary font.
This commit is contained in:
Qwerasd
2025-01-06 19:00:13 -05:00
parent 540fcc0b69
commit 298aeb7536
8 changed files with 206 additions and 207 deletions

View File

@@ -167,13 +167,13 @@ fn collection(
const load_options: Collection.LoadOptions = .{
.library = self.font_lib,
.size = size,
.metric_modifiers = key.metric_modifiers,
.freetype_load_flags = key.freetype_load_flags,
};
var c = Collection.init();
errdefer c.deinit(self.alloc);
c.load_options = load_options;
c.metric_modifiers = key.metric_modifiers;
// Search for fonts
if (Discover != void) discover: {