font: render sprites with a configurable grid cell width

Fixes #666
This commit is contained in:
Mitchell Hashimoto
2023-10-13 14:31:55 -07:00
parent d66d2c8827
commit 7995d44cfb
6 changed files with 20 additions and 7 deletions

View File

@@ -41,6 +41,7 @@ const CodepointKey = struct {
const GlyphKey = struct {
index: Group.FontIndex,
glyph: u32,
opts: font.face.RenderOptions,
};
/// The GroupCache takes ownership of Group and will free it.
@@ -124,7 +125,7 @@ pub fn renderGlyph(
glyph_index: u32,
opts: font.face.RenderOptions,
) !Glyph {
const key: GlyphKey = .{ .index = index, .glyph = glyph_index };
const key: GlyphKey = .{ .index = index, .glyph = glyph_index, .opts = opts };
const gop = try self.glyphs.getOrPut(alloc, key);
// If it is in the cache, use it.