void updateLayout (const int width) { AttributedString s; s.setJustification (Justification::topLeft); s.append (getText(), getFont()); TextLayout text; text.createLayoutWithBalancedLineLengths (s, width - 8.0f); setSize (width, jmin (width, (int) (text.getHeight() + getFont().getHeight()))); }
static TextLayout layoutTooltipText (const String& text, const Colour& colour) noexcept { const float tooltipFontSize = 13.0f; const int maxToolTipWidth = 400; AttributedString s; s.setJustification (Justification::centred); s.append (text, Font (tooltipFontSize, Font::bold), colour); TextLayout tl; tl.createLayoutWithBalancedLineLengths (s, (float) maxToolTipWidth); return tl; }