font: autoitalic should only apply to text presentation

Fixes #1256
This commit is contained in:
Mitchell Hashimoto
2024-01-08 07:57:42 -08:00
parent 4498bb77f3
commit ab606c6cfd

View File

@ -265,11 +265,16 @@ pub fn italicize(self: *Group) !void {
const list = self.faces.get(.regular);
if (list.items.len == 0) return;
// The font must be loaded.
break :regular try self.faceFromIndex(.{
// Find our first font that is text.
for (0..list.items.len) |i| {
const face = try self.faceFromIndex(.{
.style = .regular,
.idx = 0,
.idx = @intCast(i),
});
if (face.presentation == .text) break :regular face;
}
return;
};
// Try to italicize it.