1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-09 23:34:20 +00:00

Fix addFittedText overflowing the bounds when line spacing and height multiple is non-default

This commit is contained in:
attila 2025-05-12 18:14:51 +02:00 committed by Attila Szarvas
parent b9458fb240
commit 283ea12958
2 changed files with 6 additions and 1 deletions

View file

@ -336,7 +336,10 @@ static auto createFittedText (const Font& f,
while (numLines < maximumLines)
{
++numLines;
auto newFontHeight = height / (float) numLines;
const auto a = baseOptions.getAdditiveLineSpacing();
auto newFontHeight = ((height + a) / (float) numLines - a)
/ baseOptions.getLeading();
if (newFontHeight < font.getHeight())
font.setHeight (jmax (8.0f, newFontHeight));

View file

@ -125,6 +125,8 @@ private:
class JUCE_API GlyphArrangement final
{
public:
using Options = GlyphArrangementOptions;
//==============================================================================
/** Creates an empty arrangement. */
GlyphArrangement();