1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-02-08 04:20:09 +00:00

TextLayout RTL fix.

This commit is contained in:
jules 2012-06-08 16:00:54 +01:00
parent add0cf77e1
commit 4536fce9ab
3 changed files with 7 additions and 8 deletions

View file

@ -232,7 +232,7 @@ void TextLayout::createLayout (const AttributedString& text, float maxWidth)
if (! createNativeLayout (text))
createStandardLayout (text);
recalculateWidth();
recalculateWidth (text);
}
//==============================================================================
@ -600,17 +600,16 @@ void TextLayout::createStandardLayout (const AttributedString& text)
l.createLayout (text, *this);
}
void TextLayout::recalculateWidth()
void TextLayout::recalculateWidth (const AttributedString& text)
{
if (lines.size() > 0)
if (lines.size() > 0 && text.getReadingDirection() != AttributedString::rightToLeft)
{
Range<float> range (lines.getFirst()->getLineBoundsX());
int i;
for (i = lines.size(); --i > 0;)
for (int i = lines.size(); --i > 0;)
range = range.getUnionWith (lines.getUnchecked(i)->getLineBoundsX());
for (i = lines.size(); --i >= 0;)
for (int i = lines.size(); --i >= 0;)
lines.getUnchecked(i)->lineOrigin.x -= range.getStart();
width = range.getLength();