fix: Loading of custom fonts not working anymore
This commit is contained in:
parent
a032bfa0f5
commit
bca73ef01e
@ -636,8 +636,10 @@ bool ImFontAtlasBuildWithFreeTypeEx(FT_Library ft_library, ImFontAtlas* atlas, u
|
||||
for (int src_i = 0; src_i < src_tmp_array.Size; src_i++)
|
||||
{
|
||||
ImFontBuildSrcDataFT& src_tmp = src_tmp_array[src_i];
|
||||
if (src_tmp.GlyphsCount == 0)
|
||||
continue;
|
||||
// IMHEX PATCH BEGIN
|
||||
// if (src_tmp.GlyphsCount == 0)
|
||||
// continue;
|
||||
// IMHEX PATCH END
|
||||
|
||||
// When merging fonts with MergeMode=true:
|
||||
// - We can have multiple input fonts writing into a same destination font.
|
||||
|
@ -198,8 +198,10 @@ namespace hex::init {
|
||||
// Load font related settings
|
||||
{
|
||||
std::fs::path fontFile = ContentRegistry::Settings::read("hex.builtin.setting.font", "hex.builtin.setting.font.font_path", "");
|
||||
if (!wolv::io::fs::exists(fontFile) || !wolv::io::fs::isRegularFile(fontFile))
|
||||
if (!wolv::io::fs::exists(fontFile) || !wolv::io::fs::isRegularFile(fontFile)) {
|
||||
log::warn("Custom font file {} not found! Falling back to default font.", wolv::util::toUTF8String(fontFile));
|
||||
fontFile.clear();
|
||||
}
|
||||
|
||||
// If no custom font has been specified, search for a file called "font.ttf" in one of the resource folders
|
||||
if (fontFile.empty()) {
|
||||
@ -284,7 +286,9 @@ namespace hex::init {
|
||||
fonts->AddFontDefault(&cfg);
|
||||
} else {
|
||||
auto font = fonts->AddFontFromFileTTF(wolv::util::toUTF8String(fontFile).c_str(), 0, &cfg, ranges.Data);
|
||||
if (font == nullptr || font->ContainerAtlas == nullptr) {
|
||||
if (font == nullptr) {
|
||||
log::warn("Failed to load custom font! Falling back to default font.");
|
||||
|
||||
ImHexApi::System::impl::setFontSize(defaultFontSize);
|
||||
cfg.SizePixels = defaultFontSize;
|
||||
fonts->Clear();
|
||||
|
Loading…
Reference in New Issue
Block a user