JUCE icon indicating copy to clipboard operation
JUCE copied to clipboard

[Bug]: juce::GlyphArrangement::getBoundingBox() with includeWhitespace = true still ignores \n

Open stijnfrishert opened this issue 1 year ago • 0 comments

Detailed steps on how to reproduce the bug

juce::GlyphArrangement::getBoundingBox() takes a bool parameter called includeWhitespace, but in practice whitespaces that result in bounds of a width of 0 (such as '\n') are ignored anyway. This should all be reproducible by throwing in ``"a\n"` and stepping through with the debugger.

Inside juce::GlyphArrangement::getBoundingBox(), a union of the bounds for every glyph is taken. When includeWhitespace is true, '\n' is indeed not skipped, but its bounds consist of a rectangle with a width of 0. juce::Rectangle<float>::getUnion() discards input that is "empty", and so the newline isn't taken into account.

What is the expected behaviour?

Newlines are taken into account when computing glyph arrangement bounds too.

Operating systems

macOS

What versions of the operating systems?

macOS Ventura (13.3.1)

Architectures

64-bit

Stacktrace

No response

Plug-in formats (if applicable)

No response

Plug-in host applications (DAWs) (if applicable)

No response

Testing on the develop branch

I have not tested against the develop branch

Code of Conduct

  • [X] I agree to follow the Code of Conduct

stijnfrishert avatar May 25 '23 14:05 stijnfrishert