Japanese/Chinese words in TextLayout won't wrap within bounds on Windows

I’m displaying a block of text in a small component. The text is long enough that it has to be broken up into multiple lines. We’re using TextLayout.

Several languages are available including Japanese and Chinese. On Mac the multiline text appears correctly in all languages.

On Windows the text appears fine in all languages except Japanese/Chinese, in which it stays on a single line and goes out of bounds.

Here are some screenshots and our code

Mac
Mac

Windows
Windows Japanese

    Rectangle<float> rect(zX(offset[3]), zY(offset[0]), getWidth() - zW(offset[1] + offset[3]), getHeight() - zH(offset[0] + offset[2]));
    g.setColour(colour);
    g.fillRoundedRectangle(rect, zW(3.0));
    
    AttributedString s(text);
    s.setFont(*font);
    s.setLineSpacing(1.0);
    s.setJustification((int)minimalHeight == singleLineHeight ? Justification::centred : Justification::centredLeft);
    
    TextLayout t;
    Rectangle<float> textRect = rect.withSizeKeepingCentre(rect.proportionOfWidth(0.9), rect.proportionOfHeight(0.9));
    t.createLayout(s, textRect.getWidth());
    t.draw(g, textRect);

Any idea why the Japanese/Chinese is behaving this way on Windows?

Any thoughts on this?

I have noticed this too. A lot of things do not work as expected. Full Unicode support is in work:

1 Like