finish win32 gui support for double-wide characters

This commit is contained in:
Jonathan Marler 2025-09-23 13:32:13 -06:00 committed by CJ van den Berg
parent 8278a080af
commit 05b87b1406
3 changed files with 25 additions and 7 deletions

View file

@ -75,6 +75,7 @@ pub fn render(
self: *const DwriteRenderer,
font: Font,
utf8: []const u8,
double_width: bool,
) void {
var utf16_buf: [10]u16 = undefined;
const utf16_len = std.unicode.utf8ToUtf16Le(&utf16_buf, utf8) catch unreachable;
@ -85,7 +86,10 @@ pub fn render(
const rect: win32.D2D_RECT_F = .{
.left = 0,
.top = 0,
.right = @floatFromInt(font.cell_size.x),
.right = if (double_width)
@as(f32, @floatFromInt(font.cell_size.x)) * @as(f32, @floatFromInt(font.cell_size.x))
else
@as(f32, @floatFromInt(font.cell_size.x)),
.bottom = @floatFromInt(font.cell_size.y),
};
self.render_target.BeginDraw();