UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FCanvasSimpleTextItem Class Referenceabstract

#include <CanvasItem.h>

+ Inheritance diagram for FCanvasSimpleTextItem:

Public Member Functions

 FCanvasSimpleTextItem (const FVector2D &InPosition, const UFont *InFont, const FLinearColor &InColor)
 
 FCanvasSimpleTextItem (const FVector2D &InPosition, const FSlateFontInfo &InFontInfo, const FLinearColor &InColor)
 
virtual ~FCanvasSimpleTextItem () override=default
 
- Public Member Functions inherited from FCanvasTextItemBase
ENGINE_API FCanvasTextItemBase (const FVector2D &InPosition, const FLinearColor &InColor)
 
virtual ENGINE_API ~FCanvasTextItemBase ()
 
void EnableShadow (const FLinearColor &InColor, const FVector2D &InOffset=FVector2D(1.0f, 1.0f))
 
void DisableShadow ()
 
virtual ENGINE_API void Draw (FCanvas *InCanvas) override
 
virtual void SetColor (const FLinearColor &InColor) override final
 
virtual void Draw (FCanvas *InCanvas)=0
 
virtual void Draw (FCanvas *InCanvas, const FVector2D &InPosition)
 
virtual void Draw (FCanvas *InCanvas, float X, float Y)
 
- Public Member Functions inherited from FCanvasItem
 FCanvasItem (const FVector2D &InPosition)
 
virtual ~FCanvasItem ()
 

Public Attributes

const UFontFont
 
TOptional< FSlateFontInfoSlateFontInfo
 
- Public Attributes inherited from FCanvasTextItemBase
float HorizSpacingAdjust
 
float Depth
 
FFontRenderInfo FontRenderInfo
 
FLinearColor ShadowColor
 
FVector2D ShadowOffset
 
FVector2D DrawnSize
 
bool bCentreX
 
bool bCentreY
 
bool bOutlined
 
FLinearColor OutlineColor
 
bool bDontCorrectStereoscopic
 
FVector2D Scale
 
- Public Attributes inherited from FCanvasItem
FVector2D Position
 
uint32 StereoDepth
 
ESimpleElementBlendMode BlendMode
 
bool bFreezeTime
 
FBatchedElementParametersBatchedElementParameters
 

Protected Member Functions

ENGINE_API EFontCacheType GetFontCacheType () const
 
virtual bool HasValidText () const override=0
 
virtual ENGINE_API ESimpleElementBlendMode GetTextBlendMode (const bool bHasShadow) const override
 
virtual FVector2D GetTextSize (float DPIScale) const override=0
 
virtual void DrawStringInternal (FCanvas *InCanvas, const FVector2D &DrawPos, const FLinearColor &DrawColor, TArrayView< FTextEffect > Offsets) override=0
 
ENGINE_API FVector2D GetTextSizeInternal (FStringView Text, float DPIScale) const
 
ENGINE_API void DrawStringInternal (FCanvas *InCanvas, FStringView Text, const FVector2D &DrawPos, const FLinearColor &DrawColor, TArrayView< FTextEffect > TextEffects)
 
ENGINE_API void DrawStringInternal_OfflineCache (FCanvas *InCanvas, FStringView Text, const FVector2D &DrawPos, const FLinearColor &DrawColor, TArrayView< FTextEffect > TextEffects)
 
ENGINE_API void DrawStringInternal_RuntimeCache (FCanvas *InCanvas, FStringView Text, const FVector2D &DrawPos, const FLinearColor &DrawColor, TArrayView< FTextEffect > TextEffects)
 

Additional Inherited Members

- Protected Attributes inherited from FCanvasTextItemBase
FCanvasTileItem TileItem
 
FBatchedElementsBatchedElements
 
- Protected Attributes inherited from FCanvasItem
FLinearColor Color
 

Constructor & Destructor Documentation

◆ FCanvasSimpleTextItem() [1/2]

FCanvasSimpleTextItem::FCanvasSimpleTextItem ( const FVector2D InPosition,
const UFont InFont,
const FLinearColor InColor 
)
inline

Constructor.

Parameters
InPositionDraw position.
InFontFont to draw with.
InColorColor to draw the text with.

◆ FCanvasSimpleTextItem() [2/2]

FCanvasSimpleTextItem::FCanvasSimpleTextItem ( const FVector2D InPosition,
const FSlateFontInfo InFontInfo,
const FLinearColor InColor 
)
inline

Constructor.

Parameters
InPositionDraw position.
InFontInfoFont info to draw with.
InColorColor to draw the text with.

◆ ~FCanvasSimpleTextItem()

virtual FCanvasSimpleTextItem::~FCanvasSimpleTextItem ( )
overridevirtualdefault

Member Function Documentation

◆ DrawStringInternal() [1/2]

virtual void FCanvasSimpleTextItem::DrawStringInternal ( FCanvas InCanvas,
const FVector2D DrawPos,
const FLinearColor DrawColor,
TArrayView< FTextEffect Offsets 
)
overrideprotectedpure virtual

Internal string draw

In a method to make it simpler to do effects like shadow, outline

Implements FCanvasTextItemBase.

Implemented in FCanvasTextItem, and FCanvasTextStringViewItem.

◆ DrawStringInternal() [2/2]

void FCanvasSimpleTextItem::DrawStringInternal ( FCanvas InCanvas,
FStringView  Text,
const FVector2D DrawPos,
const FLinearColor DrawColor,
TArrayView< FTextEffect TextEffects 
)
protected

◆ DrawStringInternal_OfflineCache()

void FCanvasSimpleTextItem::DrawStringInternal_OfflineCache ( FCanvas InCanvas,
FStringView  Text,
const FVector2D DrawPos,
const FLinearColor DrawColor,
TArrayView< FTextEffect TextEffects 
)
protected

Internal string draw

In a method to make it simpler to do effects like shadow, outline

◆ DrawStringInternal_RuntimeCache()

void FCanvasSimpleTextItem::DrawStringInternal_RuntimeCache ( FCanvas InCanvas,
FStringView  Text,
const FVector2D DrawPos,
const FLinearColor DrawColor,
TArrayView< FTextEffect TextEffects 
)
protected

◆ GetFontCacheType()

EFontCacheType FCanvasSimpleTextItem::GetFontCacheType ( ) const
protected

Get the type of font cache the UFont is using

◆ GetTextBlendMode()

ESimpleElementBlendMode FCanvasSimpleTextItem::GetTextBlendMode ( const bool  bHasShadow) const
overrideprotectedvirtual

Get the blend mode we should use to draw this text

Implements FCanvasTextItemBase.

◆ GetTextSize()

virtual FVector2D FCanvasSimpleTextItem::GetTextSize ( float  DPIScale) const
overrideprotectedpure virtual

Get the measured size of the text to draw

Implements FCanvasTextItemBase.

Implemented in FCanvasTextItem, and FCanvasTextStringViewItem.

◆ GetTextSizeInternal()

FVector2D FCanvasSimpleTextItem::GetTextSizeInternal ( FStringView  Text,
float  DPIScale 
) const
protected

◆ HasValidText()

bool FCanvasSimpleTextItem::HasValidText ( ) const
overrideprotectedpure virtual

Does this text item have valid text to draw?

Implements FCanvasTextItemBase.

Implemented in FCanvasTextItem, and FCanvasTextStringViewItem.

Member Data Documentation

◆ Font

const UFont* FCanvasSimpleTextItem::Font

◆ SlateFontInfo

TOptional<FSlateFontInfo> FCanvasSimpleTextItem::SlateFontInfo

Font info to draw the text with.


The documentation for this class was generated from the following files: