Skip to content

Commit 1adb8c4

Browse files
authored
Merge branch 'praydog:master' into master
2 parents d0f6511 + 502322e commit 1adb8c4

2 files changed

Lines changed: 35 additions & 3 deletions

File tree

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

src/mods/Graphics.cpp

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,36 @@ void Graphics::do_ultrawide_fix() {
758758
// This disables any kind of pillarboxing and letterboxing.
759759
// This cannot be directly restored once applied.
760760
if (set_display_type_method != nullptr) {
761-
set_display_type_method->call(sdk::get_thread_context(), main_view, via::DisplayType::Fit);
761+
auto display_type = via::DisplayType::Fit;
762+
auto graphics = Graphics::get();
763+
764+
if (graphics->m_backbuffer_size.has_value()) {
765+
const auto& size = graphics->m_backbuffer_size.value();
766+
const double ratio = static_cast<double>(size[0]) / static_cast<double>(size[1]);
767+
constexpr double epsilon = 0.01;
768+
constexpr double _4_3 = 4.0 / 3.0;
769+
constexpr double _16_9 = 16.0 / 9.0;
770+
constexpr double _16_10 = 16.0 / 10.0;
771+
constexpr double _21_9 = 21.0 / 9.0;
772+
constexpr double _32_9 = 32.0 / 9.0;
773+
constexpr double _48_9 = 48.0 / 9.0;
774+
775+
if (glm::abs(ratio - _4_3) < epsilon) {
776+
display_type = via::DisplayType::Uniform4x3;
777+
} else if (glm::abs(ratio - _16_9) < epsilon) {
778+
display_type = via::DisplayType::Uniform16x9;
779+
} else if (glm::abs(ratio - _16_10) < epsilon) {
780+
display_type = via::DisplayType::Uniform16x10;
781+
} else if (glm::abs(ratio - _21_9) < epsilon) {
782+
display_type = via::DisplayType::Uniform21x9;
783+
} else if (glm::abs(ratio - _32_9) < epsilon) {
784+
display_type = via::DisplayType::Uniform32x9;
785+
} else if (glm::abs(ratio - _48_9) < epsilon) {
786+
display_type = via::DisplayType::Uniform48x9;
787+
}
788+
}
789+
790+
set_display_type_method->call(sdk::get_thread_context(), main_view, display_type);
762791
}
763792
}
764793

0 commit comments

Comments
 (0)