Rhino C++ API
8.13
|
A range of text with all the same attributes. More...
#include <opennurbs_textrun.h>
Public Types | |
enum | RunDirection : unsigned char { RunDirection::kLtR = 0, RunDirection::kRtL = 1 } |
enum | RunType : unsigned char { RunType::kNone = 0, RunType::kText = 1, RunType::kNewline = 2, RunType::kSoftreturn = 3, RunType::kParagraph = 4, RunType::kColumn = 5, RunType::kField = 6, RunType::kFieldValue = 7, RunType::kFontdef = 8, RunType::kHeader = 9, RunType::kFonttbl = 10, RunType::kColortbl = 11 } |
enum | Stacked : unsigned char { Stacked::kNone = 0, Stacked::kStacked = 1, Stacked::kTop = 2, Stacked::kBottom = 3 } |
Public Member Functions | |
ON_TextRun ()=default | |
ON_TextRun (const ON_TextRun &src) | |
~ON_TextRun () | |
const ON_2dVector & | Advance () const |
const ON_BoundingBox & | BoundingBox () const |
bbox is stored as ON_BoundingBox, but is always 2d. z=0 More... | |
ON_Color | Color () const |
const wchar_t * | DisplayString () const |
The display string is the TextString() with formulae evaluated. More... | |
RunDirection | FlowDirection () const |
const ON_Font * | Font () const |
void | Get2dCorners (ON_2dPoint corners[4]) const |
bool | GetGlyphContours (const ON_Font *text_font, bool bSingleStrokeFont, const ON_Xform &text_xform, ON_ClassArray< ON_ClassArray< ON_SimpleArray< ON_Curve * > > > &run_contours) const |
double | HeightScale (const ON_Font *font) const |
void | Init (const class ON_Font *managed_font, double height, double stackscale, ON_Color color, bool bold, bool italic, bool underlined, bool strikethrough, bool deletedisplay=true) |
bool | IsActiveManagedTextRun () const |
bool | IsColumn () const |
bool | IsManagedTextRun () const |
bool | IsNewline () const |
Stacked | IsStacked () const |
bool | IsText () const |
bool | IsValid () const |
const ON_2dVector & | Offset () const |
ON_TextRun & | operator= (const ON_TextRun &src) |
void | SetAdvance (ON_2dVector advance) |
void | SetBoundingBox (ON_2dPoint pmin, ON_2dPoint pmax) |
void | SetColor (ON_Color color) |
void | SetDisplayString (const wchar_t *str) |
Returns string in m_display_string, which may be the result of parsing text fields. More... | |
void | SetFont (const ON_Font *font) |
void | SetOffset (ON_2dVector offset) |
void | SetStacked (Stacked stacked) |
void | SetStackedOff () |
void | SetStackFractionHeight (double stackscale) |
void | SetTextHeight (double h) |
void | SetType (ON_TextRun::RunType) |
void | SetUnicodeString (size_t count, const ON__UINT32 *cp) |
double | StackHeightFraction () const |
double | TextHeight () const |
ON_SHA1_Hash | TextRunContentHash () const |
ON_SHA1_Hash | TextRunContentHash (bool bEvaluateFields) const |
const wchar_t * | TextString () const |
RunType | Type () const |
const ON__UINT32 * | UnicodeString () const |
int | WrapTextRun (int call_count, int start_char_offset, double width, double &y_offset, double ¤twidth, class ON_TextRunArray &newruns) const |
Wrap text to a specified width in model space. More... | |
Static Public Member Functions | |
static size_t | CodepointCount (const ON__UINT32 *cp) |
static double | DefaultStackFractionHeight () |
static ON_TextRun * | GetManagedTextRun () |
static ON_TextRun * | GetManagedTextRun (const ON_TextRun &src) |
static bool | ReturnManagedTextRun (ON_TextRun *managed_text_run) |
static ON_TextRun::RunDirection | RunDirectionFromUnsigned (unsigned int run_direction_as_unsigned) |
static ON_TextRun::RunType | RunTypeFromUnsigned (unsigned int run_type_as_unsigned) |
static ON_TextRun::Stacked | StackedFromUnsigned (unsigned int stacked_as_unsigned) |
Public Attributes | |
ON_2dVector | m_advance = ON_2dVector::ZeroVector |
(ECS) distance and direction from m_offset to start of next run More... | |
ON_Color | m_color = ON_Color::UnsetColor |
double | m_height_scale = -1.0 |
Font HeightOfI / text height - Converts from font units to model units or page units. More... | |
double | m_indent = 0.0 |
These apply to Paragraph type runs (m_type == rtParagraph) More... | |
double | m_left_margin = 0.0 |
left margin in formatting rect for this paragraph More... | |
int | m_line_index = -1 |
line position in ON_TextContent More... | |
const ON_Font * | m_managed_font = nullptr |
ON_2dVector | m_offset = ON_2dVector::ZeroVector |
(ECS) offset to lower left of bounding box from ON_TextContent plane origin More... | |
double | m_right_margin = 0.0 |
right margin in formatting rect for this paragraph More... | |
ON_StackedText * | m_stacked_text = nullptr |
pointers to runs for the top and bottom parts More... | |
double | m_stackscale = 0.7 |
fraction for scaling textheight in stacked text More... | |
Static Public Attributes | |
static const ON_TextRun | Empty |
Friends | |
class | ON_StackedText |
class | ON_TextBuilder |
A range of text with all the same attributes.
|
strong |
|
strong |
|
strong |
|
default |
ON_TextRun::~ON_TextRun | ( | ) |
ON_TextRun::ON_TextRun | ( | const ON_TextRun & | src | ) |
const ON_2dVector& ON_TextRun::Advance | ( | ) | const |
const ON_BoundingBox& ON_TextRun::BoundingBox | ( | ) | const |
bbox is stored as ON_BoundingBox, but is always 2d. z=0
|
static |
ON_Color ON_TextRun::Color | ( | ) | const |
|
static |
const wchar_t* ON_TextRun::DisplayString | ( | ) | const |
The display string is the TextString() with formulae evaluated.
RunDirection ON_TextRun::FlowDirection | ( | ) | const |
const ON_Font* ON_TextRun::Font | ( | ) | const |
void ON_TextRun::Get2dCorners | ( | ON_2dPoint | corners[4] | ) | const |
bool Write( ON_BinaryArchive& ) const; bool Read( ON_BinaryArchive& );
bool ON_TextRun::GetGlyphContours | ( | const ON_Font * | text_font, |
bool | bSingleStrokeFont, | ||
const ON_Xform & | text_xform, | ||
ON_ClassArray< ON_ClassArray< ON_SimpleArray< ON_Curve * > > > & | run_contours | ||
) | const |
|
static |
Description: ON_TextRun::NewTextRun() gets a text run from an efficiently managed pool. Returns: A pointer to a text run. (never nullptr).
|
static |
Description: ON_TextRun::NewTextRun() gets a text run from an efficiently managed pool and copies src Returns: A pointer to a text run. (never nullptr).
double ON_TextRun::HeightScale | ( | const ON_Font * | font | ) | const |
This returns the scale of m_height / HeightOfI. It doesn't take into account anything about annotation scaling This is the scale for converting ON_TextRun bounding boxes and offsets to basic model units
void ON_TextRun::Init | ( | const class ON_Font * | managed_font, |
double | height, | ||
double | stackscale, | ||
ON_Color | color, | ||
bool | bold, | ||
bool | italic, | ||
bool | underlined, | ||
bool | strikethrough, | ||
bool | deletedisplay = true |
||
) |
bool ON_TextRun::IsActiveManagedTextRun | ( | ) | const |
Returns: True if the memory for this ON_TextRun is managed and the text run is active. It was created by calling ON_TextRun::GetManagedTextRun() and should be deleted by calling ON_TextRun::ReturnManagedTextRun();
bool ON_TextRun::IsColumn | ( | ) | const |
bool ON_TextRun::IsManagedTextRun | ( | ) | const |
Returns: True if the memory for this ON_TextRun is managed. It was created by calling ON_TextRun::GetManagedTextRun(). If it is active, then is must be deleted by calling ON_TextRun::ReturnManagedTextRun();
bool ON_TextRun::IsNewline | ( | ) | const |
Stacked ON_TextRun::IsStacked | ( | ) | const |
bool ON_TextRun::IsText | ( | ) | const |
bool ON_TextRun::IsValid | ( | ) | const |
const ON_2dVector& ON_TextRun::Offset | ( | ) | const |
ON_TextRun& ON_TextRun::operator= | ( | const ON_TextRun & | src | ) |
|
static |
Description: Return a managed ON_TextRun.
|
static |
|
static |
void ON_TextRun::SetAdvance | ( | ON_2dVector | advance | ) |
void ON_TextRun::SetBoundingBox | ( | ON_2dPoint | pmin, |
ON_2dPoint | pmax | ||
) |
void ON_TextRun::SetColor | ( | ON_Color | color | ) |
void ON_TextRun::SetDisplayString | ( | const wchar_t * | str | ) |
Returns string in m_display_string, which may be the result of parsing text fields.
void ON_TextRun::SetFont | ( | const ON_Font * | font | ) |
void ON_TextRun::SetOffset | ( | ON_2dVector | offset | ) |
void ON_TextRun::SetStacked | ( | Stacked | stacked | ) |
void ON_TextRun::SetStackedOff | ( | ) |
void ON_TextRun::SetStackFractionHeight | ( | double | stackscale | ) |
void ON_TextRun::SetTextHeight | ( | double | h | ) |
void ON_TextRun::SetType | ( | ON_TextRun::RunType | ) |
void ON_TextRun::SetUnicodeString | ( | size_t | count, |
const ON__UINT32 * | cp | ||
) |
|
static |
double ON_TextRun::StackHeightFraction | ( | ) | const |
double ON_TextRun::TextHeight | ( | ) | const |
Set or get the WCS model unit height of the text not including any annotation scaling
ON_SHA1_Hash ON_TextRun::TextRunContentHash | ( | ) | const |
ON_SHA1_Hash ON_TextRun::TextRunContentHash | ( | bool | bEvaluateFields | ) | const |
const wchar_t* ON_TextRun::TextString | ( | ) | const |
Returns the string in m_text_string, which is a wchar_t version of the basic text for this run, and may contain unevaluated field formulae
RunType ON_TextRun::Type | ( | ) | const |
const ON__UINT32* ON_TextRun::UnicodeString | ( | ) | const |
int ON_TextRun::WrapTextRun | ( | int | call_count, |
int | start_char_offset, | ||
double | width, | ||
double & | y_offset, | ||
double & | currentwidth, | ||
class ON_TextRunArray & | newruns | ||
) | const |
Wrap text to a specified width in model space.
|
friend |
|
friend |
|
static |
ON_2dVector ON_TextRun::m_advance = ON_2dVector::ZeroVector |
(ECS) distance and direction from m_offset to start of next run
ON_Color ON_TextRun::m_color = ON_Color::UnsetColor |
double ON_TextRun::m_height_scale = -1.0 |
Font HeightOfI / text height - Converts from font units to model units or page units.
double ON_TextRun::m_indent = 0.0 |
These apply to Paragraph type runs (m_type == rtParagraph)
indent and margins are in model units or page units First line indentation for this paragraph
double ON_TextRun::m_left_margin = 0.0 |
left margin in formatting rect for this paragraph
int ON_TextRun::m_line_index = -1 |
line position in ON_TextContent
const ON_Font* ON_TextRun::m_managed_font = nullptr |
Font used to draw, pick, or otherwise evaluate this ON_TextRun. This pointer is run-time only and must be set and point to a valid ON_Font for any font related operations to work.
ON_2dVector ON_TextRun::m_offset = ON_2dVector::ZeroVector |
(ECS) offset to lower left of bounding box from ON_TextContent plane origin
double ON_TextRun::m_right_margin = 0.0 |
right margin in formatting rect for this paragraph
ON_StackedText* ON_TextRun::m_stacked_text = nullptr |
pointers to runs for the top and bottom parts
double ON_TextRun::m_stackscale = 0.7 |
fraction for scaling textheight in stacked text