Add ReloadPackageFonts
This commit is contained in:
@@ -134,6 +134,18 @@ absl::Status LoadPackageFonts() {
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
absl::Status ReloadPackageFont(const FontConfig& config) {
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
std::string actual_font_path = SetFontPath(config.font_path);
|
||||
if (!io.Fonts->AddFontFromFileTTF(actual_font_path.data(), config.font_size)) {
|
||||
return absl::InternalError(
|
||||
absl::StrFormat("Failed to load font from %s", actual_font_path));
|
||||
}
|
||||
RETURN_IF_ERROR(AddIconFont());
|
||||
RETURN_IF_ERROR(AddJapaneseFont());
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ struct FontConfig {
|
||||
|
||||
absl::Status LoadPackageFonts();
|
||||
|
||||
absl::Status ReloadPackageFont(const FontConfig& config);
|
||||
|
||||
void LoadSystemFonts();
|
||||
|
||||
} // namespace core
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// for use with https://github.com/google/material-design-icons/blob/master/font/MaterialIcons-Regular.ttf
|
||||
#pragma once
|
||||
|
||||
#define FONT_ICON_FILE_NAME_MD "assets/font/MaterialIcons-Regular.ttf"
|
||||
#define FONT_ICON_FILE_NAME_MD "MaterialIcons-Regular.ttf"
|
||||
|
||||
#define ICON_MIN_MD 0xe000
|
||||
#define ICON_MAX_MD 0x10fffd
|
||||
|
||||
Reference in New Issue
Block a user