allow user to use custom font in UI
This commit is contained in:
9
main.cc
9
main.cc
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user