43 template <
typename Iterator>
44 class DereferencingIterator
49 using pointer = value_type*;
50 using reference = value_type&;
53 explicit DereferencingIterator (Iterator in) : iterator (std::move (in)) {}
55 DereferencingIterator& operator+= (difference_type distance)
61 friend DereferencingIterator operator+ (DereferencingIterator i, difference_type d) {
return i += d; }
62 friend DereferencingIterator operator+ (difference_type d, DereferencingIterator i) {
return i += d; }
64 DereferencingIterator& operator-= (difference_type distance)
70 friend DereferencingIterator operator- (DereferencingIterator i, difference_type d) {
return i -= d; }
72 friend difference_type operator- (DereferencingIterator a, DereferencingIterator b) {
return a.iterator - b.iterator; }
74 reference operator[] (difference_type d)
const {
return *iterator[d]; }
76 friend bool operator< (DereferencingIterator a, DereferencingIterator b) {
return a.iterator < b.iterator; }
77 friend bool operator<= (DereferencingIterator a, DereferencingIterator b) {
return a.iterator <= b.iterator; }
78 friend bool operator> (DereferencingIterator a, DereferencingIterator b) {
return a.iterator > b.iterator; }
79 friend bool operator>= (DereferencingIterator a, DereferencingIterator b) {
return a.iterator >= b.iterator; }
80 friend bool operator== (DereferencingIterator a, DereferencingIterator b) {
return a.iterator == b.iterator; }
81 friend bool operator!= (DereferencingIterator a, DereferencingIterator b) {
return a.iterator != b.iterator; }
83 DereferencingIterator& operator++() { ++iterator;
return *
this; }
84 DereferencingIterator& operator--() { --iterator;
return *
this; }
85 DereferencingIterator operator++ (
int)
const { DereferencingIterator copy (*
this); ++(*this);
return copy; }
86 DereferencingIterator operator-- (
int)
const { DereferencingIterator copy (*
this); --(*this);
return copy; }
88 reference operator* ()
const {
return **iterator; }
89 pointer operator->()
const {
return *iterator; }
118 void createLayout (
const AttributedString&,
float maxWidth,
float maxHeight);
126 void createLayoutWithBalancedLineLengths (
const AttributedString&,
float maxWidth);
134 void createLayoutWithBalancedLineLengths (
const AttributedString&,
float maxWidth,
float maxHeight);
190 float ascent,
float descent,
float leading,
int numRunsToPreallocate);
196 Line& operator= (
Line&&)
noexcept =
default;
198 ~Line()
noexcept =
default;
209 void swap (
Line& other)
noexcept;
215 float ascent = 0.0f, descent = 0.0f, leading = 0.0f;
232 Line& getLine (
int index)
const noexcept;
239 void ensureStorageAllocated (
int numLinesNeeded);
241 using iterator = DereferencingIterator< Line* const*>;
242 using const_iterator = DereferencingIterator<const Line* const*>;
245 iterator
begin() {
return iterator (lines.begin()); }
246 const_iterator begin()
const {
return const_iterator (lines.begin()); }
247 const_iterator cbegin()
const {
return const_iterator (lines.begin()); }
250 iterator
end() {
return iterator (lines.end()); }
251 const_iterator end()
const {
return const_iterator (lines.end()); }
252 const_iterator cend()
const {
return const_iterator (lines.end()); }
257 void recalculateSize();
260 OwnedArray<Line> lines;
262 Justification justification;
264 void createStandardLayout (
const AttributedString&);
265 bool createNativeLayout (
const AttributedString&);
Point< float > anchor
The glyph's anchor point - this is relative to the line's origin.
int glyphCode
The code number of this glyph.
A line containing a sequence of glyph-runs.
Range< int > stringRange
The character range that this line represents in the original string that was used to create it.
Point< float > lineOrigin
The line's baseline origin.
OwnedArray< Run > runs
The glyph-runs in this line.
A sequence of glyphs with a common font and colour.
Range< int > stringRange
The character range that this run represents in the original string that was used to create it.
A Pre-formatted piece of text, which may contain multiple fonts and colours.
iterator begin()
Returns an iterator over the lines of content.
int getNumLines() const noexcept
Returns the number of lines in the layout.
float getWidth() const noexcept
Returns the maximum width of the content.
iterator end()
Returns an iterator over the lines of content.
float getHeight() const noexcept
Returns the maximum height of the content.