mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
TextLayout RTL fix.
This commit is contained in:
parent
add0cf77e1
commit
4536fce9ab
3 changed files with 7 additions and 8 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ private:
|
|||
|
||||
void createStandardLayout (const AttributedString&);
|
||||
bool createNativeLayout (const AttributedString&);
|
||||
void recalculateWidth();
|
||||
void recalculateWidth (const AttributedString&);
|
||||
|
||||
JUCE_LEAK_DETECTOR (TextLayout);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace DirectWriteTypeLayout
|
|||
jassert (currentLine == layout->getNumLines());
|
||||
TextLayout::Line* const newLine = new TextLayout::Line();
|
||||
layout->addLine (newLine);
|
||||
newLine->lineOrigin = Point<float> (baselineOriginX, baselineOriginY); // The x value is only correct when dealing with LTR text
|
||||
newLine->lineOrigin = Point<float> (baselineOriginX, baselineOriginY);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue