UCanvas::WrapString

Parses a single string into an array of strings that will fit inside the specified bounding region.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/Canvas.h

Include

#include "Engine/Canvas.h"

Source

/Engine/Source/Runtime/Engine/Private/UserInterface/Canvas.cpp

Syntax

static void WrapString
(
    FCanvasWordWrapper & Wrapper,
    FTextSizingParameters & Parameters,
    const float InCurX,
    const TCHAR *const pText,
    TArray< FWrappedStringElement > & out_Lines,
    FCanvasWordWrapper::FWrappedLineData *const OutWrappedLineData
)

Remarks

Parses a single string into an array of strings that will fit inside the specified bounding region.

Parameters

Parameter

Description

Parameters

Used for various purposes: DrawX: [in] specifies the pixel location of the start of the horizontal bounding region that should be used for wrapping. DrawY: [in] specifies the Y origin of the bounding region. This should normally be set to 0, as this will be used as the base value for DrawYL. [out] Will be set to the Y position (+YL) of the last line, i.e. the total height of all wrapped lines relative to the start of the bounding region DrawXL: [in] specifies the pixel location of the end of the horizontal bounding region that should be used for wrapping DrawYL: [in] specifies the height of the bounding region, in pixels. A input value of 0 indicates that the bounding region height should not be considered. Once the total height of lines reaches this value, the function returns and no further processing occurs. DrawFont: [in] specifies the font to use for retrieving the size of the characters in the string Scale: [in] specifies the amount of scaling to apply to the string

CurX

specifies the pixel location to begin the wrapping; usually equal to the X pos of the bounding region, unless wrapping is initiated in the middle of the bounding region (i.e. indentation)

pText

the text that should be wrapped

out_Lines

[out] will contain an array of strings which fit inside the bounding region specified. Does not clear the array first.

OutWrappedLineData

An optional array to fill with the indices from the source string marking the begin and end points of the wrapped lines

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