Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix: Load default font for UI text rendering

esenginead0b9aaa9333
diff --git a/src/esengine/editor/EditorApplication.cpp b/src/esengine/editor/EditorApplication.cpp
index 421201430..205e84e3e 100644
--- a/src/esengine/editor/EditorApplication.cpp
+++ b/src/esengine/editor/EditorApplication.cpp
@@ -58,6 +58,21 @@ void EditorApplication::onInit() {
uiContext_->init();
uiContext_->setViewport(getWidth(), getHeight());
+ // Load default font (try Windows system fonts)
+ const char* fontPaths[] = {
+ "C:/Windows/Fonts/segoeui.ttf",
+ "C:/Windows/Fonts/arial.ttf",
+ "C:/Windows/Fonts/tahoma.ttf",
+ nullptr
+ };
+
+ for (const char** path = fontPaths; *path != nullptr; ++path) {
+ if (uiContext_->loadFont("default", *path, 16.0f)) {
+ ES_LOG_INFO("Loaded font: {}", *path);
+ break;
+ }
+ }
+
// Wire up scroll events to UI system
getPlatform().setScrollCallback([this](f32 deltaX, f32 deltaY, f32 x, f32 y) {
if (uiContext_) {