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();
|
const std::string kBundlePath = GetBundleResourcePath();
|
||||||
actual_font_path = kBundlePath + font_path;
|
actual_font_path = kBundlePath + font_path;
|
||||||
#else
|
#else
|
||||||
actual_font_path = std::filesystem::absolute(font_path).string();
|
actual_font_path = absl::StrCat(GetBundleResourcePath(),
|
||||||
|
"Contents/Resources/font/", font_path);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
actual_font_path = font_path;
|
actual_font_path = std::filesystem::absolute(font_path).string();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!io.Fonts->AddFontFromFileTTF(actual_font_path.data(), font_size)) {
|
if (!io.Fonts->AddFontFromFileTTF(actual_font_path.data(), font_size)) {
|
||||||
@@ -480,9 +481,12 @@ absl::Status Controller::LoadFontFamilies() const {
|
|||||||
const std::string kIconBundlePath = GetBundleResourcePath();
|
const std::string kIconBundlePath = GetBundleResourcePath();
|
||||||
actual_icon_font_path = kIconBundlePath + "MaterialIcons-Regular.ttf";
|
actual_icon_font_path = kIconBundlePath + "MaterialIcons-Regular.ttf";
|
||||||
#else
|
#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
|
#endif
|
||||||
#else
|
#else
|
||||||
|
actual_icon_font_path = std::filesystem::absolute(icon_font_path).string();
|
||||||
#endif
|
#endif
|
||||||
io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(), ICON_FONT_SIZE,
|
io.Fonts->AddFontFromFileTTF(actual_icon_font_path.data(), ICON_FONT_SIZE,
|
||||||
&icons_config, icons_ranges);
|
&icons_config, icons_ranges);
|
||||||
@@ -496,9 +500,12 @@ absl::Status Controller::LoadFontFamilies() const {
|
|||||||
actual_japanese_font_path = kJapaneseBundlePath + japanese_font_path;
|
actual_japanese_font_path = kJapaneseBundlePath + japanese_font_path;
|
||||||
#else
|
#else
|
||||||
actual_japanese_font_path =
|
actual_japanese_font_path =
|
||||||
std::filesystem::absolute(japanese_font_path).string();
|
absl::StrCat(GetBundleResourcePath(), "Contents/Resources/font/",
|
||||||
|
japanese_font_path);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
actual_japanese_font_path =
|
||||||
|
std::filesystem::absolute(japanese_font_path).string();
|
||||||
#endif
|
#endif
|
||||||
io.Fonts->AddFontFromFileTTF(actual_japanese_font_path.data(), 18.0f,
|
io.Fonts->AddFontFromFileTTF(actual_japanese_font_path.data(), 18.0f,
|
||||||
&japanese_font_config,
|
&japanese_font_config,
|
||||||
|
|||||||
Reference in New Issue
Block a user