font: unify metrics calculations & separate sprite metrics

Unify grid metrics calculations by relying on shared logic mostly based
on values directly from the font tables, this deduplicates a lot of code
and gives us more control over how we interpret various metrics.

Also separate metrics for underlined, strikethrough, and overline
thickness and position, and box drawing thickness, so that they can
individually be adjusted as the user desires.
This commit is contained in:
Qwerasd
2024-12-11 16:30:40 -05:00
parent 7e5a164be8
commit bd18452310
8 changed files with 691 additions and 508 deletions

View File

@@ -122,13 +122,7 @@ fn reloadMetrics(self: *SharedGrid) !void {
self.metrics = face.metrics;
// Setup our sprite font.
self.resolver.sprite = .{
.width = self.metrics.cell_width,
.height = self.metrics.cell_height,
.thickness = self.metrics.underline_thickness,
.underline_position = self.metrics.underline_position,
.strikethrough_position = self.metrics.strikethrough_position,
};
self.resolver.sprite = .{ .metrics = self.metrics };
}
/// Returns the grid cell size.