FTextLayout

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Slate

Header

/Engine/Source/Runtime/Slate/Public/Framework/Text/TextLayout.h

Include

#include "Framework/Text/TextLayout.h"

Syntax

class FTextLayout : public TSharedFromThis< FTextLayout >

Variables

Name Description

Protected variable

TAttribute< FSt...

 

DebugSourceInfo

Information given to use by our an external source (typically our owner widget) to help identify who owns this text layout in the case of an error

Protected variable

ETextLayoutDirt...

 

DirtyFlags

Whether parameters on the layout have changed which requires the view be updated.

Protected variable

TSharedRef< IBr...

 

GraphemeBreakIterator

The iterator to use to detect grapheme cluster boundaries

Protected variable

ETextJustify::T...

 

Justification

How the text should be aligned with the margin.

Protected variable

TSharedPtr< IBr...

 

LineBreakIterator

The iterator to use to detect appropriate soft-wrapping points for lines

Protected variable

float

 

LineHeightPercentage

The percentage to modify a line height by.

Protected variable

TArray< FLineMo...

 

LineModels

The models for the lines of text. A LineModel represents a single string with no manual breaks.

Protected variable

TArray< FLineVi...

 

LineViews

The views for the lines of text.

Protected variable

TSet< int32 >

 

LineViewsToJustify

The indices for all of the line views that require justification.

Protected variable

FMargin

 

Margin

The size of the margins to put about the text. This is an unscaled value.

Protected variable

float

 

Scale

The scale to draw the text at

Protected variable

FVector2D

 

ScrollOffset

The scroll offset of the text layout from the parent widget

Protected variable

TUniquePtr< Tex...

 

TextBiDiDetection

Unicode BiDi text detection

Protected variable

ETextFlowDirect...

 

TextFlowDirection

How should the text within this layout be flowed?

Protected variable

FTextLayoutSize

 

TextLayoutSize

The final size of the text layout on screen.

Protected variable

ETextShapingMet...

 

TextShapingMethod

The method used to shape the text within this layout

Protected variable

FVector2D

 

ViewSize

The size of the text layout that can actually be seen from the parent widget

Protected variable

TSharedRef< IBr...

 

WordBreakIterator

The iterator to use to detect word boundaries

Protected variable

ETextWrappingPo...

 

WrappingPolicy

The wrapping policy used by this text layout.

Protected variable

float

 

WrappingWidth

The width that the text should be wrap at. If 0 or negative no wrapping occurs.

Constructors

Name Description

Protected function

FTextLayout()

Destructors

Name Description

Public function Virtual

~FTextLayout()

Functions

Name Description

Public function

void

 

AddLine

(
    const FNewLineData& NewLine
)

Public function

void

 

AddLineHighlight

(
    const FTextLineHighlight& Highligh...
)

Adds a single line highlight to the existing set of highlights.

Public function

void

 

AddLines

(
    const TArray< FNewLineData >& NewL...
)

Public function

void

 

AddRunRenderer

(
    const FTextRunRenderer& Renderer
)

Adds a single run renderer to the existing set of renderers.

Protected function Virtual

void

 

BeginLayout()

Notifies all Runs that we are beginning to generate a new layout.

Protected function

void

 

BeginLineLayout

(
    FLineModel& LineModel
)

Notifies all Runs on the given line is beginning to have a new layout generated.

Protected function Const

void

 

CalculateLineTextDirection

(
    FLineModel& LineModel
)

Calculates the text direction for the given line based upon the current shaping method and document flow direction

Protected function Const

ETextJustify...

 

CalculateLineViewVisualJustification

(
    const FLineView& LineView
)

Calculates the visual justification for the given line view

Protected function

void

 

CalculateTextDirection()

Calculates the text direction for each line based upon the current shaping method and document flow direction When changing the shaping method, or document flow direction, all the lines need to be dirtied (see DirtyAllLineModels(ELineModelDirtyState::TextBaseDirection))

Public function

void

 

ClearLineHighlights()

Clears all line highlights

Public function

void

 

ClearLines()

Public function

void

 

ClearRunRenderers()

Clears all run renderers

Protected function

void

 

ClearView()

Clears the current layouts view information.

Protected function Const

TSharedRef< ...

 

CreateDefaultTextRun

(
    const TSharedRef< FString >& NewTe...,
    const FTextRange& NewRange
)

Called to generate a new empty text run for this text layout

Protected function

void

 

CreateLineWrappingCache

(
    FLineModel& LineModel
)

Create the wrapping cache for the given line based upon the current scale

Protected function

void

 

CreateWrappingCache()

Create the wrapping cache for the current text based upon the current scale Each line keeps its own cached state, so needs to be cleared when changing the text within a line When changing the scale, all the lines need to be cleared (see DirtyAllLineModels(ELineModelDirtyState::WrappingInformation))

Protected function

void

 

DirtyAllLineModels

(
    const ELineModelDirtyState::Flags I...
)

Set the given dirty flags on all line models in this layout

Public function

void

 

DirtyLayout()

Public function

void

 

DirtyRunLayout

(
    const TSharedRef< const IRun >& Ru...
)

Protected function Virtual

void

 

EndLayout()

Notifies all Runs that the layout has finished generating.

Protected function

void

 

EndLineLayout

(
    FLineModel& LineModel
)

Notifies all Runs on the given line has finished having a new layout generated.

Protected function

void

 

FlushLineTextShapingCache

(
    FLineModel& LineModel
)

Flushes the text shaping cache for the given line

Protected function

void

 

FlushTextShapingCache()

Flushes the text shaping cache for each line

Public function Const

void

 

GetAsText

(
    FString& DisplayText,
    FTextOffsetLocations*const Out...
)

Public function Const

void

 

GetAsText

(
    FText& DisplayText,
    FTextOffsetLocations*const Out...
)

Public function Const

FVector2D

 

GetDrawSize()

Get the size of the text layout, including any lines which extend beyond the wrapping boundaries (eg, lines with lots of trailing whitespace, or lines with no break candidates)

Public function Const

FTextSelecti...

 

GetGraphemeAt

(
    const FTextLocation& Location
)

Public function Const

ETextJustify...

 

GetJustification()

Public function Const

int32

 

GetLineCount()

Public function Const

float

 

GetLineHeightPercentage()

Public function Const

const TArray...

 

GetLineModels()

Public function Const

int32

 

GetLineViewIndexForTextLocation

(
    const TArray< FTextLayout::FLineVie...,
    const FTextLocation& Location,
    const bool bPerformInclusiveBoundsC...
)

Public function Const

const TArray...

 

GetLineViews()

Public function Const

FVector2D

 

GetLocationAt

(
    const FTextLocation& Location,
    const bool bPerformInclusiveBoundsC...
)

Public function Const

FMargin

 

GetMargin()

Public function Const

float

 

GetScale()

Public function Const

void

 

GetSelectionAsText

(
    FString& DisplayText,
    const FTextSelection& Selection
)

Public function Const

FVector2D

 

GetSize()

Get the size of the text layout, including any lines which extend beyond the wrapping boundaries (eg, lines with lots of trailing whitespace, or lines with no break candidates)

Public function Const

ETextFlowDir...

 

GetTextFlowDirection()

Public function Const

FTextLocatio...

 

GetTextLocationAt

(
    const FLineView& LineView,
    const FVector2D& Relative,
    ETextHitPoint*const OutHitPoin...
)

Public function Const

FTextLocatio...

 

GetTextLocationAt

(
    const FVector2D& Relative,
    ETextHitPoint*const OutHitPoin...
)

Public function Const

void

 

GetTextOffsetLocations

(
    FTextOffsetLocations& OutTextOffse...
)

Constructs an array containing the mappings between the text that would be returned by GetAsText, and the internal FTextLocation points used within this text layout

Public function Const

ETextShaping...

 

GetTextShapingMethod()

Public function Const

ETextJustify...

 

GetVisualJustification()

Get the visual justification for this document (based on the visual justification used by the first line of text)

Public function Const

FTextSelecti...

 

GetWordAt

(
    const FTextLocation& Location
)

Public function Const

FVector2D

 

GetWrappedDrawSize()

Get the size of the text layout after the text has been wrapped, and including the first piece of trailing whitespace for any given soft-wrapped line

Public function Const

FVector2D

 

GetWrappedSize()

Get the size of the text layout after the text has been wrapped, and including the first piece of trailing whitespace for any given soft-wrapped line

Public function Const

ETextWrappin...

 

GetWrappingPolicy()

Public function Const

float

 

GetWrappingWidth()

Public function

bool

 

InsertAt

(
    const FTextLocation& Location,
    TSharedRef< IRun > InRun,
    const bool bAlwaysKeepRightRun
)

Public function

bool

 

InsertAt

(
    const FTextLocation& Location,
    TCHAR Character
)

Public function

bool

 

InsertAt

(
    const FTextLocation& Location,
    const FString& Text
)

Public function Const

bool

 

IsEmpty()

Public function Const

bool

 

IsLayoutDirty()

Public function

bool

 

JoinLineWithNextLine

(
    int32 LineIndex
)

Public function

bool

 

RemoveAt

(
    const FTextLocation& Location,
    int32 Count
)

Public function

bool

 

RemoveLine

(
    int32 LineIndex
)

Public function

void

 

RemoveLineHighlight

(
    const FTextLineHighlight& Highligh...
)

Removes a single line highlight to the existing set of highlights.

Public function

void

 

RemoveRunRenderer

(
    const FTextRunRenderer& Renderer
)

Removes a single run renderer to the existing set of renderers.

Public function

void

 

SetDebugSourceInfo

(
    const TAttribute< FString >& InDeb...
)

Set the information used to help identify who owns this text layout in the case of an error

Public function

void

 

SetJustification

(
    ETextJustify::Type Value
)

Public function

void

 

SetLineBreakIterator

(
    TSharedPtr< IBreakIterator > InLine...
)

Set the iterator to use to detect appropriate soft-wrapping points for lines (or null to go back to using the default)

Public function

void

 

SetLineHeightPercentage

(
    float Value
)

Public function

void

 

SetLineHighlights

(
    const TArray< FTextLineHighlight > ...
)

Replaces the current set of line highlights with the provided highlights.

Public function

void

 

SetMargin

(
    const FMargin& InMargin
)

Public function

void

 

SetRunRenderers

(
    const TArray< FTextRunRenderer >& ...
)

Replaces the current set of run renderers with the provided renderers.

Public function

void

 

SetScale

(
    float Value
)

Public function

void

 

SetTextFlowDirection

(
    const ETextFlowDirection InTextFlow...
)

Public function

void

 

SetTextShapingMethod

(
    const ETextShapingMethod InTextShap...
)

Public function

void

 

SetVisibleRegion

(
    const FVector2D& InViewSize,
    const FVector2D& InScrollOffset
)

Public function

void

 

SetWrappingPolicy

(
    ETextWrappingPolicy Value
)

Public function

void

 

SetWrappingWidth

(
    float Value
)

Public function

bool

 

SplitLineAt

(
    const FTextLocation& Location
)

Public function Virtual

void

 

UpdateHighlights()

Public function Virtual

void

 

UpdateIfNeeded()

Updates the TextLayout's if any changes have occurred since the last update.

Public function Virtual

void

 

UpdateLayout()

Classes

Name

Description

Public struct

ELineModelDirtyState

Protected struct

ETextLayoutDirtyState

Public struct

FBlockDefinition

Public struct

FBreakCandidate

Public struct

FLineModel

Public struct

FLineView

Public struct

FLineViewHighlight

Public struct

FNewLineData

Public class

FRunModel

Protected struct

FTextLayoutSize

Public struct

FTextOffsetLocations

A mapping between the offsets into the text as a flat string (with line-breaks), and the internal lines used within a text layout

Deprecated Functions

Name Description

Public function

void

 

AddLine

(
    const TSharedRef< FString >& Text,
    const TArray< TSharedRef< IRun > > ...
)

Please use the version of AddLine that takes an FNewLineData parameter.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss