allow user to use custom font in UI

This commit is contained in:
2022-11-06 23:21:45 +09:00
parent 5894acda8c
commit 173edff4a3

View File

@@ -32,7 +32,8 @@ using namespace std::literals;
namespace {
constexpr size_t kSubTaskUnit = 64;
constexpr size_t kSubTaskUnit = 64;
constexpr const char* kFontPath = "./nf7.ttf";
std::atomic<bool> alive_ = true;
@@ -391,6 +392,12 @@ int main(int, char**) {
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 130");
// load GUI font
if (std::filesystem::exists(kFontPath)) {
io.Fonts->AddFontFromFileTTF(
kFontPath, 16.f, nullptr, io.Fonts->GetGlyphRangesJapanese());
}
// main loop
::Env env;
glfwShowWindow(window);