CoreComponents 3.0.0
A Modern C++ Toolkit
|
Richtext typeset sequence. More...
#include <cc/TextRun>
Public Member Functions | |
TextRun () | |
Create an empty text run. | |
TextRun (const String &text, const Font &font=Font{}) | |
Typeset text with font (text is interpreted as plain text) | |
TextRun & | append (const String &text, const Font &font=Font{}) |
Typeset text (plain text) with font. | |
TextRun & | appendHtml (const String &text, const Font &font=Font{}) |
Typeset text (HTML text) with font. | |
TextRun | wrap (double maxWidth, TextAlign textAlign=TextAlign::Left, double lineHeight=0, const TextWrapBehind &wrapBehind=textWrapBehindDefault) const |
Wrap this text run. | |
Point | advance () const |
Advance of this text run | |
double | firstLineHeight () const |
Height of the first line (in pixel) | |
Size | size () const |
Size of this text run | |
double | maxAscender () const |
Highest ascender. | |
double | minDescender () const |
Lowest descender. | |
int | lineCount () const |
Number of lines | |
int | byteCount () const |
Number of bytes | |
TextCursor | getTextCursor (int byteOffset=0) const |
Get a text cursor situated at byteOffset. | |
TextCursor | getNearestTextCursor (Point pointerPos) const |
Get a text cursor located closest to pointerPos. | |
TextCursor | getNearestTextCursorBelow (const TextCursor &cursor) const |
Get the nearest text cursor a line below the current line. | |
TextCursor | getNearestTextCursorAbove (const TextCursor &cursor) const |
Get the nearest text cursor a line above the current line. | |
TextCursor | getNearestLineStart (Point pointerPos) const |
Get a text cursor located at the line start closest to pointerPos. | |
TextCursor | getNearestTextCursorInLine (Point pointerPos) const |
Get a text cursor located closest to pointerPos within the same line. | |
Public Member Functions inherited from Object | |
Object ()=default | |
Create a null object. | |
operator bool () const | |
Check if this is a non-null object. | |
bool | isNull () const |
Check if this is a null object. | |
template<class T > | |
bool | is () const |
Check if this object is of type T. | |
template<class T > | |
T | as () const |
Cast this object to type T. | |
bool | isWeak () const |
Check if the underlying object reference is weak. | |
bool | operator== (const Object &other) const |
Equality operator. | |
std::strong_ordering | operator<=> (const Object &other) const |
Ordering operator. | |
long | useCount () const |
Reference count. | |
Static Public Member Functions | |
static TextRun | fromHtml (const String &text, const Font &font=Font{}) |
Typeset text with font (recognised HTML tags: u, b, i) | |
Protected Member Functions | |
TextRun (State *newState) | |
State & | me () |
const State & | me () const |
Protected Member Functions inherited from Object | |
template<class T > | |
T | weak () const |
template<class T > | |
void | initOnce () |
Create the object state when called the first time. | |
template<class T > | |
void | initOncePerThread () |
Create a distinct object state for each thread when called the first time in that thread. | |
Object (State *newState) | |
Initialize object with newState. | |
Object (State *state, Alias) | |
Object (State *state, Weak) | |
Object & | operator= (std::nullptr_t) |
Static Protected Member Functions | |
static String | replaceEntities (String text) |
Static Protected Member Functions inherited from Object | |
template<class T > | |
static T | alias (const State *state) |
Create an alias object for the given state. | |
template<class T > | |
static T | weak (const State *state) |
Additional Inherited Members | |
Protected Attributes inherited from Object | |
Handle< State > | me |
Internal object state | |
Richtext typeset sequence.
TextRun | ( | ) |
Create an empty text run.
Typeset text with font (text is interpreted as plain text)
Typeset text with font (recognised HTML tags: u, b, i)
Typeset text (plain text) with font.
Typeset text (HTML text) with font.
TextRun wrap | ( | double | maxWidth, |
TextAlign | textAlign = TextAlign::Left, | ||
double | lineHeight = 0, | ||
const TextWrapBehind & | wrapBehind = textWrapBehindDefault ) const |
Wrap this text run.
maxWidth | Maximum width of the wrapped text run |
textAlign | Alignment of the wrapped text |
lineHeight | Line height |
wrapBehind | Check if a text can be wrapped behind a certain text fragment. |
Point advance | ( | ) | const |
Advance of this text run
double firstLineHeight | ( | ) | const |
Height of the first line (in pixel)
Size size | ( | ) | const |
Size of this text run
double maxAscender | ( | ) | const |
Highest ascender.
double minDescender | ( | ) | const |
Lowest descender.
int lineCount | ( | ) | const |
Number of lines
int byteCount | ( | ) | const |
Number of bytes
TextCursor getTextCursor | ( | int | byteOffset = 0 | ) | const |
Get a text cursor situated at byteOffset.
TextCursor getNearestTextCursor | ( | Point | pointerPos | ) | const |
Get a text cursor located closest to pointerPos.
TextCursor getNearestTextCursorBelow | ( | const TextCursor & | cursor | ) | const |
Get the nearest text cursor a line below the current line.
TextCursor getNearestTextCursorAbove | ( | const TextCursor & | cursor | ) | const |
Get the nearest text cursor a line above the current line.
TextCursor getNearestLineStart | ( | Point | pointerPos | ) | const |
Get a text cursor located at the line start closest to pointerPos.
TextCursor getNearestTextCursorInLine | ( | Point | pointerPos | ) | const |
Get a text cursor located closest to pointerPos within the same line.