Browse Source

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

tags/2021-05-28
jules 10 years ago
parent
commit
eb99390413
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      modules/juce_graphics/fonts/juce_TextLayout.cpp

+ 4
- 5
modules/juce_graphics/fonts/juce_TextLayout.cpp 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];


Loading…
Cancel
Save