|
Rhino C++ API
9.0
|
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, RunType::kTab = 12, RunType::kListBegin = 13, RunType::kListEnd = 14, RunType::kListItemBegin = 15, RunType::kListItemEnd = 16 } |
| 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 |
| bool | ApplyKerning () 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 |
| bool | GetListItemPrefixString (wchar_t *buf, size_t buf_count) const |
| double | HeightScale (const ON_Font *font) const |
| double | HeightScaleFactor () 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 | IsListDepthRelevant () const |
| bool | IsListOrdered () const |
| bool | IsManagedTextRun () const |
| bool | IsNewline () const |
| Stacked | IsStacked () const |
| bool | IsSubscript () const |
| bool | IsSuperscript () const |
| bool | IsText () const |
| bool | IsValid () const |
| double | LineSpaceScale () const |
| int | ListDepth () const |
| int | ListItemNumber () const |
| double | MeasureListItemPrefixWidth () const |
| const ON_2dVector & | Offset () const |
| ON_TextRun & | operator= (const ON_TextRun &src) |
| void | SetAdvance (ON_2dVector advance) |
| void | SetApplyKerning (bool applyKerning) |
| 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 | SetHeightScaleFactor (double factor) |
| void | SetIsListOrdered (bool ordered) |
| void | SetLineSpaceScale (double scale) |
| void | SetListDepth (int list_depth) |
| void | SetListItemNumber (int itemNumber) |
| void | SetOffset (ON_2dVector offset) |
| void | SetStacked (Stacked stacked) |
| void | SetStackedOff () |
| void | SetStackFractionHeight (double stackscale) |
| void | SetSubscript () |
| void | SetSuperscript () |
| 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 |
| bool | TextStringContains (const wchar_t *sub_str) 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... | |
| bool | m_apply_kerning = false |
| 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... | |
| unsigned char | m_reserved_char3 = 0 |
| 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 |
| bool ON_TextRun::ApplyKerning | ( | ) | 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 |
| bool ON_TextRun::GetListItemPrefixString | ( | wchar_t * | buf, |
| size_t | buf_count | ||
| ) | const |
For kListItemBegin runs, builds the bullet/number prefix string that is rendered ahead of the item text (e.g. L"1.", L"10.", L"a.", L"ii.", L"•"). buf must be non-null with buf_count >= 32. Writes an empty string and returns false if this run is not a kListItemBegin.
|
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
| double ON_TextRun::HeightScaleFactor | ( | ) | const |
Per-run multiplier that survives ON_TextContent::Internal_SetRunTextHeight. Used so symmetric tolerance text can render at the dim style's ToleranceHeightScale (the "Text height scale:" tolerance setting) while sharing the same baseline as the rest of the dim text. Default 1.0.
| 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::IsListDepthRelevant | ( | ) | const |
| bool ON_TextRun::IsListOrdered | ( | ) | 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::IsSubscript | ( | ) | const |
| bool ON_TextRun::IsSuperscript | ( | ) | const |
| bool ON_TextRun::IsText | ( | ) | const |
| bool ON_TextRun::IsValid | ( | ) | const |
| double ON_TextRun::LineSpaceScale | ( | ) | const |
| int ON_TextRun::ListDepth | ( | ) | const |
| int ON_TextRun::ListItemNumber | ( | ) | const |
| double ON_TextRun::MeasureListItemPrefixWidth | ( | ) | const |
For kListItemBegin runs, returns the rendered width of the prefix in model units, computed from the run's font and TextHeight. Returns 0.0 if the run is not a kListItemBegin, has no font, or has no usable font metrics. MeasureTextRunArray uses this so the prefix does not overlap the item text when wider than the default 1.6*TextHeight clearance (monospaced fonts, multi-digit ordered list items, etc.).
| 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::SetApplyKerning | ( | bool | applyKerning | ) |
| 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::SetHeightScaleFactor | ( | double | factor | ) |
| void ON_TextRun::SetIsListOrdered | ( | bool | ordered | ) |
| void ON_TextRun::SetLineSpaceScale | ( | double | scale | ) |
| void ON_TextRun::SetListDepth | ( | int | list_depth | ) |
| void ON_TextRun::SetListItemNumber | ( | int | itemNumber | ) |
| 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::SetSubscript | ( | ) |
| void ON_TextRun::SetSuperscript | ( | ) |
| 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
| bool ON_TextRun::TextStringContains | ( | const wchar_t * | sub_str | ) | const |
| 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
| bool ON_TextRun::m_apply_kerning = false |
| 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
| unsigned char ON_TextRun::m_reserved_char3 = 0 |
| 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
1.8.17