From d30eb7b1d74c6b5548c620fa52d94b017db4c6ae Mon Sep 17 00:00:00 2001 From: Christian Brunschen <6741909+cbrunschen@users.noreply.github.com> Date: Sun, 30 Nov 2025 20:40:44 +0000 Subject: [PATCH 1/3] Fix text clipping introduced by https://github.com/mamedev/mame/pull/14550 --- src/emu/rendlay.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 5c0a93a85f848..4abe11a02e8b3 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3221,6 +3221,7 @@ class layout_element::reel_component : public component // get the width of the string s32 width = font->string_width(ourheight / num_shown, 1.0f, m_stopnames[fruit]); float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f; + width *= aspect; float curx = bounds.left() + (bounds.width() - width) / 2.0f; @@ -3362,6 +3363,7 @@ class layout_element::reel_component : public component // get the width of the string s32 width = font->string_width(dest.height(), 1.0f, m_stopnames[fruit]); float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f; + width *= aspect; float curx = bounds.left(); @@ -3703,6 +3705,7 @@ void layout_element::component::draw_text( // get the width of the string s32 width = font.string_width(bounds.height(), 1.0f, str); float aspect = (align == 3 || width > bounds.width()) ? (float) bounds.width() / (float) width : 1.0f; + width *= aspect; // get alignment float curx; From 37b2cb32e64399feb47a1e179c5676c12a3c9f5c Mon Sep 17 00:00:00 2001 From: Christian Brunschen <6741909+cbrunschen@users.noreply.github.com> Date: Sun, 30 Nov 2025 20:52:53 +0000 Subject: [PATCH 2/3] Simpler fix: instead of multiplying an int anf a float, whdn stretching or compressing text, assign the width from the width of the bounds. --- src/emu/rendlay.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 4abe11a02e8b3..980ed940bbdaa 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3220,8 +3220,12 @@ class layout_element::reel_component : public component // get the width of the string s32 width = font->string_width(ourheight / num_shown, 1.0f, m_stopnames[fruit]); - float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f; - width *= aspect; + float aspect = 1.0; + if (width > bounds.width()) + { + aspect = (float) bounds.width() / (float) width; + width = bounds.width(); + } float curx = bounds.left() + (bounds.width() - width) / 2.0f; @@ -3362,8 +3366,12 @@ class layout_element::reel_component : public component { // get the width of the string s32 width = font->string_width(dest.height(), 1.0f, m_stopnames[fruit]); - float aspect = width > bounds.width() ? (float) bounds.width() / (float) width : 1.0f; - width *= aspect; + float aspect = 1.0; + if (width > bounds.width()) + { + aspect = (float) bounds.width() / (float) width; + width = bounds.width(); + } float curx = bounds.left(); @@ -3704,8 +3712,12 @@ void layout_element::component::draw_text( { // get the width of the string s32 width = font.string_width(bounds.height(), 1.0f, str); - float aspect = (align == 3 || width > bounds.width()) ? (float) bounds.width() / (float) width : 1.0f; - width *= aspect; + float aspect = 1.0; + if (align == 3 || width > bounds.width()) + { + aspect = (float) bounds.width() / (float) width; + width = bounds.width(); + } // get alignment float curx; From 4f6e93ccd73213d91e4380fa328e84870302fb95 Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 30 Nov 2025 22:02:44 +0100 Subject: [PATCH 3/3] c++ style typecast, and unrelated correction for right-aligned txt --- src/emu/rendlay.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/emu/rendlay.cpp b/src/emu/rendlay.cpp index 980ed940bbdaa..46d07514f1672 100644 --- a/src/emu/rendlay.cpp +++ b/src/emu/rendlay.cpp @@ -3223,7 +3223,7 @@ class layout_element::reel_component : public component float aspect = 1.0; if (width > bounds.width()) { - aspect = (float) bounds.width() / (float) width; + aspect = float(bounds.width()) / float(width); width = bounds.width(); } @@ -3369,7 +3369,7 @@ class layout_element::reel_component : public component float aspect = 1.0; if (width > bounds.width()) { - aspect = (float) bounds.width() / (float) width; + aspect = float(bounds.width()) / float(width); width = bounds.width(); } @@ -3715,7 +3715,7 @@ void layout_element::component::draw_text( float aspect = 1.0; if (align == 3 || width > bounds.width()) { - aspect = (float) bounds.width() / (float) width; + aspect = float(bounds.width()) / float(width); width = bounds.width(); } @@ -3730,7 +3730,7 @@ void layout_element::component::draw_text( // right case 2: - curx = bounds.right() - width; + curx = bounds.left() + bounds.width() - width; break; // stretch