From 5c1c090f393de8d5709cefa96ea7ec1434cadad8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 24 Sep 2023 15:53:39 -0700 Subject: [PATCH] font: change FontIndex to a u16 since we can expect more fonts with maps --- src/font/Group.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/font/Group.zig b/src/font/Group.zig index 118668bf7..11792603c 100644 --- a/src/font/Group.zig +++ b/src/font/Group.zig @@ -213,7 +213,7 @@ pub fn setSize(self: *Group, size: font.face.DesiredSize) !void { /// This represents a specific font in the group. pub const FontIndex = packed struct(FontIndex.Backing) { - const Backing = u8; + const Backing = u16; const backing_bits = @typeInfo(Backing).Int.bits; /// The number of bits we use for the index. @@ -255,6 +255,10 @@ pub const FontIndex = packed struct(FontIndex.Backing) { // everywhere so if we increase the size of this we'll dramatically // increase our memory usage. try std.testing.expectEqual(@sizeOf(Backing), @sizeOf(FontIndex)); + + // Just so we're aware when this changes. The current maximum number + // of fonts for a style is 13 bits or 8192 fonts. + try std.testing.expectEqual(13, idx_bits); } };