Enhance font loading error handling in LoadPackageFonts function

This commit is contained in:
scawful
2024-12-08 21:22:26 -05:00
parent e515396f11
commit 4507bd6b7a

View File

@@ -1,9 +1,9 @@
#include "app/core/platform/font_loader.h" #include "app/core/platform/font_loader.h"
#include <filesystem>
#include <string> #include <string>
#include <unordered_set> #include <unordered_set>
#include <vector> #include <vector>
#include <filesystem>
#include "absl/status/status.h" #include "absl/status/status.h"
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
@@ -86,8 +86,11 @@ absl::Status LoadPackageFonts() {
#else #else
actual_icon_font_path = std::filesystem::absolute(icon_font_path).string(); actual_icon_font_path = std::filesystem::absolute(icon_font_path).string();
#endif #endif
io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(), ICON_FONT_SIZE, if (!io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(),
&icons_config, icons_ranges); ICON_FONT_SIZE, &icons_config,
icons_ranges)) {
return absl::InternalError("Failed to load icon fonts");
}
// Merge Japanese font // Merge Japanese font
std::string actual_japanese_font_path = ""; std::string actual_japanese_font_path = "";