diff --git a/pkg/dcimgui/main.zig b/pkg/dcimgui/main.zig index 00a3c739d..e709158f5 100644 --- a/pkg/dcimgui/main.zig +++ b/pkg/dcimgui/main.zig @@ -1,6 +1,10 @@ pub const build_options = @import("build_options"); pub const c = @cImport({ + // This is set during the build so it also has to be set + // during import time to get the right types. Without this + // you get stack size mismatches on some structs. + @cDefine("IMGUI_USE_WCHAR32", "1"); @cInclude("dcimgui.h"); }); diff --git a/src/inspector/Inspector.zig b/src/inspector/Inspector.zig index 7029b7d3a..156e2cb18 100644 --- a/src/inspector/Inspector.zig +++ b/src/inspector/Inspector.zig @@ -138,24 +138,24 @@ pub fn setup() void { io.IniFilename = null; io.LogFilename = null; - // // Use our own embedded font - // { - // // TODO: This will have to be recalculated for different screen DPIs. - // // This is currently hardcoded to a 2x content scale. - // const font_size = 16 * 2; - // - // var font_config: cimgui.c.ImFontConfig = .{}; - // cimgui.ext.ImFontConfig_ImFontConfig(&font_config); - // font_config.FontDataOwnedByAtlas = false; - // _ = cimgui.c.ImFontAtlas_AddFontFromMemoryTTF( - // io.Fonts, - // @ptrCast(@constCast(font.embedded.regular.ptr)), - // @intCast(font.embedded.regular.len), - // font_size, - // &font_config, - // null, - // ); - // } + // Use our own embedded font + { + // TODO: This will have to be recalculated for different screen DPIs. + // This is currently hardcoded to a 2x content scale. + const font_size = 16 * 2; + + var font_config: cimgui.c.ImFontConfig = undefined; + cimgui.ext.ImFontConfig_ImFontConfig(&font_config); + font_config.FontDataOwnedByAtlas = false; + _ = cimgui.c.ImFontAtlas_AddFontFromMemoryTTF( + io.Fonts, + @ptrCast(@constCast(font.embedded.regular.ptr)), + @intCast(font.embedded.regular.len), + font_size, + &font_config, + null, + ); + } } pub fn init(surface: *Surface) !Inspector {