Loading font to vsgImGui #106
-
Hey, it's been a while since I've not checked last updates. Many things have changed and that absolutely lovely. But I have a problem with loading font to ImGui. Before some commit (I don't know really which it was) I loaded fonts like that: ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
ImFont* regularFont = io.Fonts->AddFontFromFileTTF("C:\\Windows\\Fonts\\segoeui.ttf", FONT_SIZE);
ImFontConfig config;
config.MergeMode = true;
static const ImWchar iconRanges[] = { ICON_MIN_WEB, ICON_MAX_WEB, 0 };
ImFont* iconsFont = io.Fonts->AddFontFromFileTTF((native_dir + "data\\fonts\\fontawesome-webfont.ttf").c_str(), FONT_SIZE, &config, iconRanges); For now I tried different ways and I couldn't get them loaded properly. Is it the right way? Because for now it's not working :( auto ImGuiGroup = rocky::ImGuiIntegration::addContextGroup(app.displayManager, window);
auto ImGuiContext = ImGuiGroup->imguiContext();
ImGui::SetCurrentContext(ImGuiContext);
ImGuiIO& io = ImGui::GetIO();
io.Fonts->AddFontFromFileTTF(
"C:/Windows/Fonts/segoeui.ttf",
FONT_SIZE
);
static const ImWchar icon_ranges[] = { ICON_MIN_WEB, ICON_MAX_WEB, 0 };
ImFontConfig cfg;
cfg.MergeMode = true;
cfg.PixelSnapH = true;
cfg.GlyphMinAdvanceX = FONT_SIZE;
io.Fonts->AddFontFromFileTTF(
(native_dir + "data/fonts/fontawesome-webfont.ttf").c_str(),
FONT_SIZE,
&cfg,
icon_ranges
);
io.Fonts->Build();
ImGuiGroup->add(MainGUI::create(app), app); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I don't know, but in |
Beta Was this translation helpful? Give feedback.
I don't know, but in
RenderImGui
there is a call toImGui_ImplVulkan_CreateFontsTexture
.Perhaps you need to call this method again after changing fonts.
Just a wild guess though.