@@ -2254,6 +2254,7 @@ void Achievements::DrawPauseMenuOverlays()
22542254{
22552255 using ImGuiFullscreen::g_large_font;
22562256 using ImGuiFullscreen::g_medium_font;
2257+ using ImGuiFullscreen::GetLineHeight;
22572258 using ImGuiFullscreen::LayoutScale;
22582259
22592260 if (!HasActiveGame ())
@@ -2269,14 +2270,14 @@ void Achievements::DrawPauseMenuOverlays()
22692270
22702271 const ImVec2 image_size (
22712272 LayoutScale (ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY));
2272- const float start_y = LayoutScale (10 .0f + 4 .0f + 4 .0f ) + g_large_font. second + (g_medium_font. second * 2 .0f );
2273+ const float start_y = LayoutScale (10 .0f + 4 .0f + 4 .0f ) + GetLineHeight ( g_large_font) + (GetLineHeight ( g_medium_font) * 2 .0f );
22732274 const float margin = LayoutScale (10 .0f );
22742275 const float spacing = LayoutScale (10 .0f );
22752276 const float padding = LayoutScale (10 .0f );
22762277
22772278 const float max_text_width = ImGuiFullscreen::LayoutScale (300 .0f );
22782279 const float row_width = max_text_width + padding + padding + image_size.x + spacing;
2279- const float title_height = padding + font. second + padding;
2280+ const float title_height = padding + GetLineHeight ( font) + padding;
22802281
22812282 if (!s_active_challenge_indicators.empty ())
22822283 {
@@ -2290,7 +2291,7 @@ void Achievements::DrawPauseMenuOverlays()
22902291 TRANSLATE (" Achievements" , " Active Challenge Achievements" ));
22912292
22922293 const float y_advance = image_size.y + spacing;
2293- const float acheivement_name_offset = (image_size.y - font. second ) / 2 .0f ;
2294+ const float acheivement_name_offset = (image_size.y - GetLineHeight ( font) ) / 2 .0f ;
22942295 const float max_non_ellipised_text_width = max_text_width - LayoutScale (10 .0f );
22952296 ImVec2 position (box_min.x + padding, box_min.y + title_height);
22962297
@@ -2350,6 +2351,7 @@ void Achievements::DrawAchievementsWindow()
23502351{
23512352 using ImGuiFullscreen::g_large_font;
23522353 using ImGuiFullscreen::g_medium_font;
2354+ using ImGuiFullscreen::GetLineHeight;
23532355 using ImGuiFullscreen::LayoutScale;
23542356
23552357 if (!s_achievement_list)
@@ -2408,19 +2410,19 @@ void Achievements::DrawAchievementsWindow()
24082410 FullscreenUI::ReturnToPreviousWindow ();
24092411 }
24102412
2411- const ImRect title_bb (ImVec2 (left, top), ImVec2 (right, top + g_large_font. second ));
2413+ const ImRect title_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_large_font) ));
24122414 text.assign (s_game_title);
24132415
24142416 if (s_hardcore_mode)
24152417 text.append (TRANSLATE_SV (" Achievements" , " (Hardcore Mode)" ));
24162418
2417- top += g_large_font. second + spacing;
2419+ top += GetLineHeight ( g_large_font) + spacing;
24182420
24192421 ImGui::PushFont (g_large_font.first , g_large_font.second );
24202422 ImGui::RenderTextClipped (title_bb.Min , title_bb.Max , text.c_str (), text.end_ptr (), nullptr , ImVec2 (0 .0f , 0 .0f ), &title_bb);
24212423 ImGui::PopFont ();
24222424
2423- const ImRect summary_bb (ImVec2 (left, top), ImVec2 (right, top + g_medium_font. second ));
2425+ const ImRect summary_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_medium_font) ));
24242426 if (s_game_summary.num_core_achievements > 0 )
24252427 {
24262428 if (s_game_summary.num_unlocked_achievements == s_game_summary.num_core_achievements )
@@ -2440,7 +2442,7 @@ void Achievements::DrawAchievementsWindow()
24402442 text.assign (TRANSLATE_SV (" Achievements" , " This game has no achievements." ));
24412443 }
24422444
2443- top += g_medium_font. second + spacing;
2445+ top += GetLineHeight ( g_medium_font) + spacing;
24442446
24452447 ImGui::PushFont (g_medium_font.first , g_medium_font.second );
24462448 ImGui::RenderTextClipped (
@@ -2541,6 +2543,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
25412543{
25422544 using ImGuiFullscreen::g_large_font;
25432545 using ImGuiFullscreen::g_medium_font;
2546+ using ImGuiFullscreen::GetLineHeight;
25442547 using ImGuiFullscreen::LayoutScale;
25452548 using ImGuiFullscreen::LayoutUnscale;
25462549
@@ -2564,7 +2567,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
25642567 cheevo->description + summary_length));
25652568
25662569 // Messy, but need to undo LayoutScale in MenuButtonFrame()...
2567- const float extra_summary_height = LayoutUnscale (std::max (summary_text_size.y - g_medium_font. second , 0 .0f ));
2570+ const float extra_summary_height = LayoutUnscale (std::max (summary_text_size.y - GetLineHeight ( g_medium_font) , 0 .0f ));
25682571
25692572 ImRect bb;
25702573 bool visible, hovered;
@@ -2602,7 +2605,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
26022605
26032606 SmallString text;
26042607
2605- const float midpoint = bb.Min .y + g_large_font. second + spacing;
2608+ const float midpoint = bb.Min .y + GetLineHeight ( g_large_font) + spacing;
26062609 text.format ((cheevo->points != 1 ) ? TRANSLATE_FS (" Achievements" , " {} points" ) : TRANSLATE_FS (" Achievements" , " {} point" ), cheevo->points );
26072610
26082611 const ImVec2 points_size (g_medium_font.first ->CalcTextSizeA (g_medium_font.second , FLT_MAX, 0 .0f , text.c_str (), text.end_ptr ()));
@@ -2635,7 +2638,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
26352638
26362639 const float text_start_x = bb.Min .x + image_size.x + LayoutScale (15 .0f );
26372640 const ImRect title_bb (ImVec2 (text_start_x, bb.Min .y ), ImVec2 (points_start, midpoint));
2638- const ImRect summary_bb (ImVec2 (text_start_x, midpoint), ImVec2 (points_start, midpoint + g_medium_font. second + extra_summary_height));
2641+ const ImRect summary_bb (ImVec2 (text_start_x, midpoint), ImVec2 (points_start, midpoint + GetLineHeight ( g_medium_font) + extra_summary_height));
26392642 const ImRect points_bb (ImVec2 (points_start, midpoint), bb.Max );
26402643 const ImRect lock_bb (
26412644 ImVec2 (points_template_start + ((points_template_size.x - right_icon_size.x ) * 0 .5f ), bb.Min .y ), ImVec2 (bb.Max .x , midpoint));
@@ -2664,7 +2667,7 @@ void Achievements::DrawAchievement(const rc_client_achievement_t* cheevo)
26642667 ImDrawList* dl = ImGui::GetWindowDrawList ();
26652668 const float progress_height = LayoutScale (progress_height_unscaled);
26662669 const float progress_spacing = LayoutScale (progress_spacing_unscaled);
2667- const float top = midpoint + g_medium_font. second + progress_spacing;
2670+ const float top = midpoint + GetLineHeight ( g_medium_font) + progress_spacing;
26682671 const ImRect progress_bb (ImVec2 (text_start_x, top), ImVec2 (bb.Max .x , top + progress_height));
26692672 const float fraction = cheevo->measured_percent * 0 .01f ;
26702673 dl->AddRectFilled (progress_bb.Min , progress_bb.Max , ImGui::GetColorU32 (ImGuiFullscreen::UIPrimaryDarkColor));
@@ -2710,6 +2713,7 @@ void Achievements::DrawLeaderboardsWindow()
27102713{
27112714 using ImGuiFullscreen::g_large_font;
27122715 using ImGuiFullscreen::g_medium_font;
2716+ using ImGuiFullscreen::GetLineHeight;
27132717 using ImGuiFullscreen::LayoutScale;
27142718
27152719 static constexpr float alpha = 0 .8f ;
@@ -2809,21 +2813,21 @@ void Achievements::DrawLeaderboardsWindow()
28092813 }
28102814 }
28112815
2812- const ImRect title_bb (ImVec2 (left, top), ImVec2 (right, top + g_large_font. second ));
2816+ const ImRect title_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_large_font) ));
28132817 text.assign (Achievements::GetGameTitle ());
28142818
2815- top += g_large_font. second + spacing;
2819+ top += GetLineHeight ( g_large_font) + spacing;
28162820
28172821 ImGui::PushFont (g_large_font.first , g_large_font.second );
28182822 ImGui::RenderTextClipped (title_bb.Min , title_bb.Max , text.c_str (), text.end_ptr (), nullptr , ImVec2 (0 .0f , 0 .0f ), &title_bb);
28192823 ImGui::PopFont ();
28202824
28212825 if (is_leaderboard_open)
28222826 {
2823- const ImRect subtitle_bb (ImVec2 (left, top), ImVec2 (right, top + g_large_font. second ));
2827+ const ImRect subtitle_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_large_font) ));
28242828 text.assign (s_open_leaderboard->title );
28252829
2826- top += g_large_font. second + spacing_small;
2830+ top += GetLineHeight ( g_large_font) + spacing_small;
28272831
28282832 ImGui::PushFont (g_large_font.first , g_large_font.second );
28292833 ImGui::RenderTextClipped (
@@ -2840,17 +2844,17 @@ void Achievements::DrawLeaderboardsWindow()
28402844 text.format (TRANSLATE_FS (" Achievements" , " This game has {} leaderboards." ), count);
28412845 }
28422846
2843- const ImRect summary_bb (ImVec2 (left, top), ImVec2 (right, top + g_medium_font. second ));
2844- top += g_medium_font. second + spacing_small;
2847+ const ImRect summary_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_medium_font) ));
2848+ top += GetLineHeight ( g_medium_font) + spacing_small;
28452849
28462850 ImGui::PushFont (g_medium_font.first , g_medium_font.second );
28472851 ImGui::RenderTextClipped (
28482852 summary_bb.Min , summary_bb.Max , text.c_str (), text.end_ptr (), nullptr , ImVec2 (0 .0f , 0 .0f ), &summary_bb);
28492853
28502854 if (!is_leaderboard_open && !Achievements::IsHardcoreModeActive ())
28512855 {
2852- const ImRect hardcore_warning_bb (ImVec2 (left, top), ImVec2 (right, top + g_medium_font. second ));
2853- top += g_medium_font. second + spacing_small;
2856+ const ImRect hardcore_warning_bb (ImVec2 (left, top), ImVec2 (right, top + GetLineHeight ( g_medium_font) ));
2857+ top += GetLineHeight ( g_medium_font) + spacing_small;
28542858
28552859 ImGui::RenderTextClipped (hardcore_warning_bb.Min , hardcore_warning_bb.Max ,
28562860 TRANSLATE (" Achievements" , " Submitting scores is disabled because hardcore mode is off. Leaderboards are read-only." ),
@@ -2895,7 +2899,7 @@ void Achievements::DrawLeaderboardsWindow()
28952899 ImGuiFullscreen::MenuButtonFrame (
28962900 " legend" , false , ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, &visible, &hovered, &bb.Min , &bb.Max , 0 , alpha);
28972901
2898- const float midpoint = bb.Min .y + g_large_font. second + LayoutScale (4 .0f );
2902+ const float midpoint = bb.Min .y + GetLineHeight ( g_large_font) + LayoutScale (4 .0f );
28992903 const float icon_column_width = bb.Max .y - bb.Min .y ;
29002904 float column_left = bb.Min .x + LayoutScale (15 .0f ) + padding;
29012905
@@ -2937,7 +2941,7 @@ void Achievements::DrawLeaderboardsWindow()
29372941
29382942 const float line_thickness = LayoutScale (1 .0f );
29392943 const float line_padding = LayoutScale (5 .0f );
2940- const ImVec2 line_start (bb.Min .x , bb.Min .y + g_large_font. second + line_padding);
2944+ const ImVec2 line_start (bb.Min .x , bb.Min .y + GetLineHeight ( g_large_font) + line_padding);
29412945 const ImVec2 line_end (bb.Max .x , line_start.y );
29422946 ImGui::GetWindowDrawList ()->AddLine (line_start, line_end, ImGui::GetColorU32 (ImGuiCol_TextDisabled), line_thickness);
29432947 }
@@ -3027,7 +3031,7 @@ void Achievements::DrawLeaderboardsWindow()
30273031 ImGuiFullscreen::LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY, &visible, &hovered, &bb.Min , &bb.Max );
30283032 if (visible)
30293033 {
3030- const float midpoint = bb.Min .y + g_large_font. second + LayoutScale (4 .0f );
3034+ const float midpoint = bb.Min .y + GetLineHeight ( g_large_font) + LayoutScale (4 .0f );
30313035 const ImRect title_bb (bb.Min , ImVec2 (bb.Max .x , midpoint));
30323036
30333037 ImGui::PushFont (g_large_font.first , g_large_font.second );
@@ -3071,6 +3075,7 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
30713075 float name_column_width, float time_column_width, float column_spacing)
30723076{
30733077 using ImGuiFullscreen::g_large_font;
3078+ using ImGuiFullscreen::GetLineHeight;
30743079 using ImGuiFullscreen::LayoutScale;
30753080
30763081 static constexpr float alpha = 0 .8f ;
@@ -3082,7 +3087,7 @@ void Achievements::DrawLeaderboardEntry(const rc_client_leaderboard_entry_t& ent
30823087 if (!visible)
30833088 return ;
30843089
3085- const float midpoint = bb.Min .y + g_large_font. second + LayoutScale (4 .0f );
3090+ const float midpoint = bb.Min .y + GetLineHeight ( g_large_font) + LayoutScale (4 .0f );
30863091 const float column_padding = LayoutScale (15 .0f );
30873092 const float icon_column_width = bb.Max .y - bb.Min .y ;
30883093 float column_left = bb.Min .x + column_padding;
@@ -3151,6 +3156,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
31513156{
31523157 using ImGuiFullscreen::g_large_font;
31533158 using ImGuiFullscreen::g_medium_font;
3159+ using ImGuiFullscreen::GetLineHeight;
31543160 using ImGuiFullscreen::LayoutScale;
31553161
31563162 static constexpr float alpha = 0 .8f ;
@@ -3172,7 +3178,7 @@ void Achievements::DrawLeaderboardListEntry(const rc_client_leaderboard_t* lboar
31723178 s_restore_leaderboard_focus = false ;
31733179 }
31743180
3175- const float midpoint = bb.Min .y + g_large_font. second + LayoutScale (4 .0f );
3181+ const float midpoint = bb.Min .y + GetLineHeight ( g_large_font) + LayoutScale (4 .0f );
31763182 const float text_start_x = bb.Min .x + LayoutScale (15 .0f );
31773183 const ImRect title_bb (ImVec2 (text_start_x, bb.Min .y ), ImVec2 (bb.Max .x , midpoint));
31783184 const ImRect summary_bb (ImVec2 (text_start_x, midpoint), bb.Max );
0 commit comments