Hide ImGui compat factories behind legacy XCUI interop

This commit is contained in:
2026-04-05 16:26:29 +08:00
parent f03a8f63ec
commit 9bad86eccf
11 changed files with 127 additions and 35 deletions

View File

@@ -12,8 +12,6 @@ constexpr float kUiFontSize = 18.0f;
constexpr const char* kPrimaryUiFontPath = "C:/Windows/Fonts/segoeui.ttf";
constexpr const char* kChineseFallbackFontPath = "C:/Windows/Fonts/msyh.ttc";
} // namespace
bool BuildDefaultXCUIEditorFontAtlas(::ImFontAtlas& atlas, ::ImFont*& outDefaultFont) {
outDefaultFont = nullptr;
atlas.Clear();
@@ -55,6 +53,19 @@ bool BuildDefaultXCUIEditorFontAtlas(::ImFontAtlas& atlas, ::ImFont*& outDefault
return outDefaultFont != nullptr;
}
} // namespace
bool ConfigureDefaultXCUIEditorFontsForCurrentContext() {
ImGuiIO& io = ImGui::GetIO();
ImFont* uiFont = nullptr;
if (!BuildDefaultXCUIEditorFontAtlas(*io.Fonts, uiFont)) {
return false;
}
io.FontDefault = uiFont;
return io.FontDefault != nullptr;
}
} // namespace XCUIBackend
} // namespace Editor
} // namespace XCEngine