win32 gui: center double-wide characters

This commit is contained in:
Jonathan Marler 2025-09-23 14:05:24 -06:00 committed by CJ van den Berg
parent 921f094509
commit 5cc6724a07
2 changed files with 42 additions and 9 deletions

View file

@ -87,7 +87,7 @@ pub fn render(
.left = 0,
.top = 0,
.right = if (double_width)
@as(f32, @floatFromInt(font.cell_size.x)) * @as(f32, @floatFromInt(font.cell_size.x))
@as(f32, @floatFromInt(font.cell_size.x)) * 2
else
@as(f32, @floatFromInt(font.cell_size.x)),
.bottom = @floatFromInt(font.cell_size.y),
@ -100,7 +100,7 @@ pub fn render(
self.render_target.DrawText(
@ptrCast(utf16.ptr),
@intCast(utf16.len),
font.text_format,
if (double_width) font.text_format_double else font.text_format_single,
&rect,
&self.white_brush.ID2D1Brush,
.{},