update font loading for macOS bundle resources
This commit is contained in:
@@ -461,10 +461,11 @@ absl::Status Controller::LoadFontFamilies() const {
|
||||
const std::string kBundlePath = GetBundleResourcePath();
|
||||
actual_font_path = kBundlePath + font_path;
|
||||
#else
|
||||
actual_font_path = std::filesystem::absolute(font_path).string();
|
||||
actual_font_path = absl::StrCat(GetBundleResourcePath(),
|
||||
"Contents/Resources/font/", font_path);
|
||||
#endif
|
||||
#else
|
||||
actual_font_path = font_path;
|
||||
actual_font_path = std::filesystem::absolute(font_path).string();
|
||||
#endif
|
||||
|
||||
if (!io.Fonts->AddFontFromFileTTF(actual_font_path.data(), font_size)) {
|
||||
@@ -480,9 +481,12 @@ absl::Status Controller::LoadFontFamilies() const {
|
||||
const std::string kIconBundlePath = GetBundleResourcePath();
|
||||
actual_icon_font_path = kIconBundlePath + "MaterialIcons-Regular.ttf";
|
||||
#else
|
||||
actual_icon_font_path = std::filesystem::absolute(icon_font_path).string();
|
||||
actual_icon_font_path =
|
||||
absl::StrCat(GetBundleResourcePath(),
|
||||
"Contents/Resources/font/MaterialIcons-Regular.ttf");
|
||||
#endif
|
||||
#else
|
||||
actual_icon_font_path = std::filesystem::absolute(icon_font_path).string();
|
||||
#endif
|
||||
io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(), ICON_FONT_SIZE,
|
||||
&icons_config, icons_ranges);
|
||||
@@ -496,9 +500,12 @@ absl::Status Controller::LoadFontFamilies() const {
|
||||
actual_japanese_font_path = kJapaneseBundlePath + japanese_font_path;
|
||||
#else
|
||||
actual_japanese_font_path =
|
||||
std::filesystem::absolute(japanese_font_path).string();
|
||||
absl::StrCat(GetBundleResourcePath(), "Contents/Resources/font/",
|
||||
japanese_font_path);
|
||||
#endif
|
||||
#else
|
||||
actual_japanese_font_path =
|
||||
std::filesystem::absolute(japanese_font_path).string();
|
||||
#endif
|
||||
io.Fonts->AddFontFromFileTTF(actual_japanese_font_path.data(), 18.0f,
|
||||
&japanese_font_config,
|
||||
|
||||
Reference in New Issue
Block a user