| @@ -274,7 +274,7 @@ void Graphics::drawSingleLineText (const String& text, const int startX, const i | |||||
| void Graphics::drawMultiLineText (const String& text, const int startX, | void Graphics::drawMultiLineText (const String& text, const int startX, | ||||
| const int baselineY, const int maximumLineWidth, | const int baselineY, const int maximumLineWidth, | ||||
| Justification justification) const | |||||
| Justification justification, const float leading) const | |||||
| { | { | ||||
| if (text.isNotEmpty() | if (text.isNotEmpty() | ||||
| && startX < context.getClipBounds().getRight()) | && startX < context.getClipBounds().getRight()) | ||||
| @@ -282,7 +282,7 @@ void Graphics::drawMultiLineText (const String& text, const int startX, | |||||
| GlyphArrangement arr; | GlyphArrangement arr; | ||||
| arr.addJustifiedText (context.getFont(), text, | arr.addJustifiedText (context.getFont(), text, | ||||
| (float) startX, (float) baselineY, (float) maximumLineWidth, | (float) startX, (float) baselineY, (float) maximumLineWidth, | ||||
| justification); | |||||
| justification, leading); | |||||
| arr.draw (*this); | arr.draw (*this); | ||||
| } | } | ||||
| } | } | ||||
| @@ -139,14 +139,16 @@ public: | |||||
| This will break the text onto a new line where there's a new-line or | This will break the text onto a new line where there's a new-line or | ||||
| carriage-return character, or at a word-boundary when the text becomes wider | carriage-return character, or at a word-boundary when the text becomes wider | ||||
| than the size specified by the maximumLineWidth parameter. | |||||
| than the size specified by the maximumLineWidth parameter. New-lines | |||||
| will be vertically separated by the specified leading. | |||||
| @see setFont, drawSingleLineText, drawFittedText, GlyphArrangement::addJustifiedText | @see setFont, drawSingleLineText, drawFittedText, GlyphArrangement::addJustifiedText | ||||
| */ | */ | ||||
| void drawMultiLineText (const String& text, | void drawMultiLineText (const String& text, | ||||
| int startX, int baselineY, | int startX, int baselineY, | ||||
| int maximumLineWidth, | int maximumLineWidth, | ||||
| Justification justification = Justification::left) const; | |||||
| Justification justification = Justification::left, | |||||
| float leading = 0.0f) const; | |||||
| /** Draws a line of text within a specified rectangle. | /** Draws a line of text within a specified rectangle. | ||||
| @@ -256,7 +256,8 @@ int GlyphArrangement::insertEllipsis (const Font& font, float maxXPos, int start | |||||
| void GlyphArrangement::addJustifiedText (const Font& font, const String& text, | void GlyphArrangement::addJustifiedText (const Font& font, const String& text, | ||||
| float x, float y, float maxLineWidth, | float x, float y, float maxLineWidth, | ||||
| Justification horizontalLayout) | |||||
| Justification horizontalLayout, | |||||
| float leading) | |||||
| { | { | ||||
| auto lineStartIndex = glyphs.size(); | auto lineStartIndex = glyphs.size(); | ||||
| addLineOfText (font, text, x, y); | addLineOfText (font, text, x, y); | ||||
| @@ -331,7 +332,7 @@ void GlyphArrangement::addJustifiedText (const Font& font, const String& text, | |||||
| lineStartIndex = i; | lineStartIndex = i; | ||||
| y += font.getHeight(); | |||||
| y += font.getHeight() + leading; | |||||
| } | } | ||||
| } | } | ||||
| @@ -194,13 +194,14 @@ public: | |||||
| between x and (x + maxLineWidth). | between x and (x + maxLineWidth). | ||||
| The y coordinate is the position of the baseline of the first line of text - subsequent | The y coordinate is the position of the baseline of the first line of text - subsequent | ||||
| lines will be placed below it, separated by a distance of font.getHeight(). | |||||
| lines will be placed below it, separated by a distance of font.getHeight() + leading. | |||||
| */ | */ | ||||
| void addJustifiedText (const Font& font, | void addJustifiedText (const Font& font, | ||||
| const String& text, | const String& text, | ||||
| float x, float y, | float x, float y, | ||||
| float maxLineWidth, | float maxLineWidth, | ||||
| Justification horizontalLayout); | |||||
| Justification horizontalLayout, | |||||
| float leading = 0.0f); | |||||
| /** Tries to fit some text within a given space. | /** Tries to fit some text within a given space. | ||||