|
JUCE-7.0.12-0-g4f43011b96 JUCE-7.0.12-0-g4f43011b96
JUCE — C++ application framework with suport for VST, VST3, LV2 audio plug-ins
« « « Anklang Documentation |
A Pre-formatted piece of text, which may contain multiple fonts and colours. More...
#include "juce_TextLayout.h"
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 Types | |
| using | iterator = DereferencingIterator< Line *const * > |
| using | const_iterator = DereferencingIterator< const Line *const * > |
Public Member Functions | |
| TextLayout () | |
| Creates an empty layout. | |
| TextLayout (const TextLayout &) | |
| TextLayout & | operator= (const TextLayout &) |
| TextLayout (TextLayout &&) noexcept | |
| TextLayout & | operator= (TextLayout &&) noexcept |
| ~TextLayout () | |
| Destructor. | |
| void | createLayout (const AttributedString &, float maxWidth) |
| Creates a layout from the given attributed string. | |
| void | createLayout (const AttributedString &, float maxWidth, float maxHeight) |
| Creates a layout from the given attributed string, given some size constraints. | |
| void | createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth) |
| Creates a layout, attempting to choose a width which results in lines of a similar length. | |
| void | createLayoutWithBalancedLineLengths (const AttributedString &, float maxWidth, float maxHeight) |
| Creates a layout, attempting to choose a width which results in lines of a similar length. | |
| void | draw (Graphics &, Rectangle< float > area) const |
| Draws the layout within the specified area. | |
| float | getWidth () const noexcept |
| Returns the maximum width of the content. | |
| float | getHeight () const noexcept |
| Returns the maximum height of the content. | |
| int | getNumLines () const noexcept |
| Returns the number of lines in the layout. | |
| Line & | getLine (int index) const noexcept |
| Returns one of the lines. | |
| void | addLine (std::unique_ptr< Line >) |
| Adds a line to the layout. | |
| void | ensureStorageAllocated (int numLinesNeeded) |
| Pre-allocates space for the specified number of lines. | |
| iterator | begin () |
| Returns an iterator over the lines of content. | |
| const_iterator | begin () const |
| const_iterator | cbegin () const |
| iterator | end () |
| Returns an iterator over the lines of content. | |
| const_iterator | end () const |
| const_iterator | cend () const |
| void | recalculateSize () |
| If you modify the TextLayout after creating it, call this to compute the new dimensions of the content. | |
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.
@tags{Graphics}
Definition at line 40 of file juce_TextLayout.h.
Definition at line 242 of file juce_TextLayout.h.
Definition at line 241 of file juce_TextLayout.h.
| juce::TextLayout::TextLayout | ( | ) |
Creates an empty layout.
Having created a TextLayout, you can populate it using createLayout() or createLayoutWithBalancedLineLengths().
Definition at line 140 of file juce_TextLayout.cpp.
| juce::TextLayout::TextLayout | ( | const TextLayout & | other | ) |
Definition at line 145 of file juce_TextLayout.cpp.
|
noexcept |
Definition at line 152 of file juce_TextLayout.cpp.
| juce::TextLayout::~TextLayout | ( | ) |
Destructor.
Definition at line 178 of file juce_TextLayout.cpp.
| void juce::TextLayout::addLine | ( | std::unique_ptr< Line > | 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.
Definition at line 192 of file juce_TextLayout.cpp.
| iterator juce::TextLayout::begin | ( | ) |
Returns an iterator over the lines of content.
Definition at line 245 of file juce_TextLayout.h.
| const_iterator juce::TextLayout::begin | ( | ) | const |
Definition at line 246 of file juce_TextLayout.h.
| const_iterator juce::TextLayout::cbegin | ( | ) | const |
Definition at line 247 of file juce_TextLayout.h.
| const_iterator juce::TextLayout::cend | ( | ) | const |
Definition at line 252 of file juce_TextLayout.h.
| void juce::TextLayout::createLayout | ( | const AttributedString & | text, |
| float | maxWidth | ||
| ) |
Creates a layout from the given attributed string.
This will replace any data that is currently stored in the layout.
Definition at line 243 of file juce_TextLayout.cpp.
| void juce::TextLayout::createLayout | ( | const AttributedString & | text, |
| 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.
Definition at line 248 of file juce_TextLayout.cpp.
| void juce::TextLayout::createLayoutWithBalancedLineLengths | ( | const AttributedString & | text, |
| 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.
Definition at line 261 of file juce_TextLayout.cpp.
| void juce::TextLayout::createLayoutWithBalancedLineLengths | ( | const AttributedString & | text, |
| 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.
Definition at line 266 of file juce_TextLayout.cpp.
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.
Definition at line 197 of file juce_TextLayout.cpp.
| iterator juce::TextLayout::end | ( | ) |
Returns an iterator over the lines of content.
Definition at line 250 of file juce_TextLayout.h.
| const_iterator juce::TextLayout::end | ( | ) | const |
Definition at line 251 of file juce_TextLayout.h.
Pre-allocates space for the specified number of lines.
Definition at line 187 of file juce_TextLayout.cpp.
|
noexcept |
Returns the maximum height of the content.
Definition at line 226 of file juce_TextLayout.h.
|
noexcept |
Returns one of the lines.
Definition at line 182 of file juce_TextLayout.cpp.
|
noexcept |
Returns the number of lines in the layout.
Definition at line 229 of file juce_TextLayout.h.
|
noexcept |
Returns the maximum width of the content.
Definition at line 223 of file juce_TextLayout.h.
| TextLayout & juce::TextLayout::operator= | ( | const TextLayout & | other | ) |
Definition at line 168 of file juce_TextLayout.cpp.
|
noexcept |
Definition at line 159 of file juce_TextLayout.cpp.
| void juce::TextLayout::recalculateSize | ( | ) |
If you modify the TextLayout after creating it, call this to compute the new dimensions of the content.
Definition at line 577 of file juce_TextLayout.cpp.