1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

TextLayout: made the fallback layout algorithm make use of AttributedString::getLineSpacing()

This commit is contained in:
jules 2015-11-25 09:58:16 +00:00
parent 5507ad4df7
commit eb99390413

View file

@ -331,9 +331,8 @@ namespace TextLayoutHelpers
Token& operator= (const Token&);
};
class TokenList
struct TokenList
{
public:
TokenList() noexcept : totalLines (0) {}
void createLayout (const AttributedString& text, TextLayout& layout)
@ -342,7 +341,7 @@ namespace TextLayoutHelpers
layout.ensureStorageAllocated (totalLines);
addTextRuns (text);
layoutRuns (layout.getWidth());
layoutRuns (layout.getWidth(), text.getLineSpacing());
int charPosition = 0;
int lineStartPosition = 0;
@ -505,7 +504,7 @@ namespace TextLayoutHelpers
tokens.add (new Token (currentString, font, colour, lastCharType == 2));
}
void layoutRuns (const float maxWidth)
void layoutRuns (const float maxWidth, const float extraLineSpacing)
{
float x = 0, y = 0, h = 0;
int i;
@ -516,7 +515,7 @@ namespace TextLayoutHelpers
t.area.setPosition (x, y);
t.line = totalLines;
x += t.area.getWidth();
h = jmax (h, t.area.getHeight());
h = jmax (h, t.area.getHeight() + extraLineSpacing);
const Token* const nextTok = tokens[i + 1];