Skip to content

设置字体问题 #47

@JieRanLeo

Description

@JieRanLeo

貌似设置字体有点问题
#include "Global.h"
#include "AImGui.h"
#include "font_data.h"

#include

int main() {
android::AImGui imgui(android::AImGui::Options {
.renderType = android::AImGui::RenderType::RenderNative, .autoUpdateOrientation = true
});

ImGuiIO& io = ImGui::GetIO();
ImFont *font = io.Fonts->AddFontFromMemoryTTF(
   (void*) _binary_font_ttf_start,
   _binary_font_ttf_end - _binary_font_ttf_start,
   24.0f,
   nullptr,
   io.Fonts->GetGlyphRangesChineseSimplifiedCommon()
);
IM_ASSERT(font != nullptr);

if (!imgui) {
   LogInfo("[-] ImGui initialization failed");
   return -1;
}

bool state = true;

std::thread processInputEventThread(
   [&] {
      while (state) {
         imgui.ProcessInputEvent();
      }
   }
);

while (state) {
   imgui.BeginFrame();
   {
      ImGui::Begin("Hello, world!", &state);

      ImGui::Text("你好");

      ImGui::End();
   }
   imgui.EndFrame();
}

if (processInputEventThread.joinable()) {
   processInputEventThread.join();
}

return 0;

}
这是代码
用的是内存字体 内存字体测试过是没有问题的 在原版imgui是可以正常设置的

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions