TextLayout::justification is private


#1

Hi !
TextLayout::justification is private
can you considere to add an accessor in juce_TextLayout.h like

Justification getJustification() const noexcept    { return justification; }

Or a tool like

Point<float> getOriginForArea(const Rectangle<float>& area) const noexcept
 { return justification.appliedToRectangle (Rectangle<float> (width, getHeight()), area).getPosition(); }

and use it in TextLayout::draw

My client code need this to compute hit testing.

Thanks in advance for this !
Best regards.


#2

Hi,
TextLayout used an AttributedString so you can get the justification of the AttributedString and that’s it…


#3

Thanks for your answer !
The AttributedString was used at TextLayout construction, but its life time can be shorter.
I will try to sort that out.
Thanks for the head up.

Best regards