Hi Guys,
If I do something like that
namespace
{
static juce::TextLayout createTextLayout(const juce::String &text, juce::Justification justification, const juce::Colour &colour, const juce::Font &font, int width, int height)
{
juce::TextLayout textLayout;
juce::AttributedString str(text);
str.setJustification(justification);
str.setWordWrap(juce::AttributedString::none);
str.setColour(colour);
str.setFont(font);
textLayout.createLayout(str, width, height);
return textLayout;
}
static void drawWithTextLayout(juce::Graphics &g, const juce::String &text, juce::Justification justification, const juce::Colour &colour, const juce::Font &font, int x, int y, int width, int height)
{
juce::TextLayout textLayout = createTextLayout(text, justification, colour, font, width, height);
textLayout.draw(g, juce::Rectangle<int>(x, y, width, height).toFloat());
}
}
and in my paint function
drawWithTextLayout(g, "This is a very long text", juce::Justification::centredLeft, juce::Colours::black, juce::Font(14), 0, 0, 10, getHeight());
I have this displayed
Although it should truncate the display, it doesn’t
It used to work and I think it works fine on Windows
Thanks !