Skip to content

Commit 26dd8ea

Browse files
authored
Fix loading default font at different sizes (#1299)
1 parent 3f9086f commit 26dd8ea

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/REFramework.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,7 @@ void REFramework::update_fonts() {
14901490
0
14911491
};
14921492

1493-
ImFont* fsload = fonts->AddFontFromMemoryCompressedTTF((void*)RobotoCJKSC_Medium_compressed_data, RobotoCJKSC_Medium_compressed_size, (float)m_font_size, &custom_icons, cjk_ranges);
1493+
fonts->AddFontFromMemoryCompressedTTF((void*)RobotoCJKSC_Medium_compressed_data, RobotoCJKSC_Medium_compressed_size, (float)m_font_size, &custom_icons, cjk_ranges);
14941494

14951495
// https://fontawesome.com/
14961496
custom_icons.PixelSnapH = true;
@@ -1509,7 +1509,10 @@ void REFramework::update_fonts() {
15091509
if (fs::exists(font.filepath)) {
15101510
font.font = fonts->AddFontFromFileTTF(font.filepath.string().c_str(), (float)font.size, nullptr, ranges);
15111511
} else {
1512-
font.font = fsload; // fonts->AddFontFromMemoryCompressedTTF(RobotoMedium_compressed_data, RobotoMedium_compressed_size, (float)font.size, nullptr, ranges);
1512+
if (ranges == nullptr) {
1513+
ranges = cjk_ranges;
1514+
}
1515+
font.font = fonts->AddFontFromMemoryCompressedTTF((void*)RobotoCJKSC_Medium_compressed_data, RobotoCJKSC_Medium_compressed_size, (float)font.size, nullptr, ranges);
15131516
}
15141517
}
15151518

0 commit comments

Comments
 (0)