From a784d5776be6daef574cc5b6fe79b182c0e4dc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=84=A1=E5=B8=B8?= <3142324836@qq.com> Date: Thu, 24 Oct 2024 22:57:06 +0800 Subject: [PATCH] TextLayout: Fix getStringBounds of empty strings --- modules/juce_graphics/fonts/juce_TextLayout.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modules/juce_graphics/fonts/juce_TextLayout.h b/modules/juce_graphics/fonts/juce_TextLayout.h index aa27ec6f79..0b853b3cb7 100644 --- a/modules/juce_graphics/fonts/juce_TextLayout.h +++ b/modules/juce_graphics/fonts/juce_TextLayout.h @@ -275,6 +275,10 @@ public: { TextLayout layout; layout.createLayout (string, std::numeric_limits::max()); + + if (layout.getNumLines() == 0) + return {}; + return layout.getLine (0).getLineBounds(); }