JUCE
|
A Pre-formatted piece of text, which may contain multiple fonts and colours. More...
Classes | |
class | Glyph |
A positioned glyph. More... | |
class | Line |
A line containing a sequence of glyph-runs. More... | |
class | Run |
A sequence of glyphs with a common font and colour. More... | |
Public Member Functions | |
TextLayout () | |
Creates an empty layout. More... | |
TextLayout (const TextLayout &) | |
TextLayout & | operator= (const TextLayout &) |
TextLayout (TextLayout &&) noexcept | |
TextLayout & | operator= (TextLayout &&) noexcept |
~TextLayout () | |
Destructor. More... | |
void | createLayout (const AttributedString &, float maxWidth) |
Creates a layout from the given attributed string. More... | |
void | createLayout (const AttributedString &, float maxWidth, float maxHeight) |
Creates a layout from the given attributed string, given some size constraints. More... | |
void | createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth) |
Creates a layout, attempting to choose a width which results in lines of a similar length. More... | |
void | createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth, float maxHeight) |
Creates a layout, attempting to choose a width which results in lines of a similar length. More... | |
void | draw (Graphics &, const Rectangle< float > &area) const |
Draws the layout within the specified area. More... | |
float | getWidth () const noexcept |
Returns the maximum width of the content. More... | |
float | getHeight () const noexcept |
Returns the maximum height of the content. More... | |
int | getNumLines () const noexcept |
Returns the number of lines in the layout. More... | |
Line & | getLine (int index) const |
Returns one of the lines. More... | |
void | addLine (Line *) |
Adds a line to the layout. More... | |
void | ensureStorageAllocated (int numLinesNeeded) |
Pre-allocates space for the specified number of lines. More... | |
A Pre-formatted piece of text, which may contain multiple fonts and colours.
A TextLayout is created from an AttributedString, and once created can be quickly drawn into a Graphics context.
TextLayout::TextLayout | ( | ) |
Creates an empty layout.
Having created a TextLayout, you can populate it using createLayout() or createLayoutWithBalancedLineLengths().
TextLayout::TextLayout | ( | const TextLayout & | ) |
|
noexcept |
TextLayout::~TextLayout | ( | ) |
Destructor.
TextLayout& TextLayout::operator= | ( | const TextLayout & | ) |
|
noexcept |
void TextLayout::createLayout | ( | const AttributedString & | , |
float | maxWidth | ||
) |
Creates a layout from the given attributed string.
This will replace any data that is currently stored in the layout.
void TextLayout::createLayout | ( | const AttributedString & | , |
float | maxWidth, | ||
float | maxHeight | ||
) |
Creates a layout from the given attributed string, given some size constraints.
This will replace any data that is currently stored in the layout.
void TextLayout::createLayoutWithBalancedLineLengths | ( | const AttributedString & | , |
float | maxWidth | ||
) |
Creates a layout, attempting to choose a width which results in lines of a similar length.
This will be slower than the normal createLayout method, but produces a tidier result.
void TextLayout::createLayoutWithBalancedLineLengths | ( | const AttributedString & | , |
float | maxWidth, | ||
float | maxHeight | ||
) |
Creates a layout, attempting to choose a width which results in lines of a similar length.
This will be slower than the normal createLayout method, but produces a tidier result.
Draws the layout within the specified area.
The position of the text within the rectangle is controlled by the justification flags set in the original AttributedString that was used to create this layout.
|
noexcept |
Returns the maximum width of the content.
|
noexcept |
Returns the maximum height of the content.
|
noexcept |
Returns the number of lines in the layout.
References JUCE_LEAK_DETECTOR.
Line& TextLayout::getLine | ( | int | index | ) | const |
Returns one of the lines.
void TextLayout::addLine | ( | Line * | ) |
Adds a line to the layout.
The layout will take ownership of this line object and will delete it when it is no longer needed.
void TextLayout::ensureStorageAllocated | ( | int | numLinesNeeded | ) |
Pre-allocates space for the specified number of lines.