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

#include <CanvasItem.h>

+ Inheritance diagram for FCanvasTextItemBase:

Classes

struct  FTextEffect
 

Public Member Functions

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

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

virtual bool HasValidText () const =0
 
virtual ESimpleElementBlendMode GetTextBlendMode (const bool bHasShadow) const =0
 
virtual FVector2D GetTextSize (float DPIScale) const =0
 
virtual void DrawStringInternal (FCanvas *InCanvas, const FVector2D &DrawPos, const FLinearColor &DrawColor, TArrayView< FTextEffect > Offsets)=0
 

Protected Attributes

FCanvasTileItem TileItem
 
FBatchedElementsBatchedElements
 
- Protected Attributes inherited from FCanvasItem
FLinearColor Color
 

Constructor & Destructor Documentation

◆ FCanvasTextItemBase()

FCanvasTextItemBase::FCanvasTextItemBase ( const FVector2D InPosition,
const FLinearColor InColor 
)

◆ ~FCanvasTextItemBase()

FCanvasTextItemBase::~FCanvasTextItemBase ( )
virtualdefault

Member Function Documentation

◆ DisableShadow()

void FCanvasTextItemBase::DisableShadow ( )
inline

Disable the shadow

◆ Draw() [1/4]

void FCanvasTextItemBase::Draw ( FCanvas InCanvas)
overridevirtual

Draw the item at the given coordinates.

Parameters
InCanvasCanvas on which to draw

Implements FCanvasItem.

◆ Draw() [2/4]

virtual void FCanvasItem::Draw ( FCanvas InCanvas)
virtual

Implements FCanvasItem.

◆ Draw() [3/4]

virtual void FCanvasItem::Draw ( FCanvas InCanvas,
const FVector2D InPosition 
)
inlinevirtual

Draw this item (this will affect the items position for future draw calls that do no specify a position)

Parameters
InCanvasCanvas on which to draw
InPositionDraw position - this will not preserve the items position

Reimplemented from FCanvasItem.

◆ Draw() [4/4]

virtual void FCanvasItem::Draw ( FCanvas InCanvas,
float  X,
float  Y 
)
inlinevirtual

Draw this item (this will affect the items position for future draw calls that do no specify a position)

Parameters
InCanvasCanvas on which to draw
XX Draw position
YY Draw position

Reimplemented from FCanvasItem.

◆ DrawStringInternal()

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

Internal string draw

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

Implemented in FCanvasSimpleTextItem, FCanvasTextItem, FCanvasTextStringViewItem, and FCanvasShapedTextItem.

◆ EnableShadow()

void FCanvasTextItemBase::EnableShadow ( const FLinearColor InColor,
const FVector2D InOffset = FVector2D( 1.0f, 1.0f ) 
)
inline

Set the shadow offset and color.

Parameters
InColorShadow color
InOffsetShadow offset. Defaults to 1,1. (Passing zero vector will disable the shadow)

◆ GetTextBlendMode()

virtual ESimpleElementBlendMode FCanvasTextItemBase::GetTextBlendMode ( const bool  bHasShadow) const
protectedpure virtual

Get the blend mode we should use to draw this text

Implemented in FCanvasSimpleTextItem, and FCanvasShapedTextItem.

◆ GetTextSize()

virtual FVector2D FCanvasTextItemBase::GetTextSize ( float  DPIScale) const
protectedpure virtual

Get the measured size of the text to draw

Implemented in FCanvasTextItem, FCanvasTextStringViewItem, FCanvasShapedTextItem, and FCanvasSimpleTextItem.

◆ HasValidText()

virtual bool FCanvasTextItemBase::HasValidText ( ) const
protectedpure virtual

Does this text item have valid text to draw?

Implemented in FCanvasTextItem, FCanvasTextStringViewItem, FCanvasShapedTextItem, and FCanvasSimpleTextItem.

◆ SetColor()

virtual void FCanvasTextItemBase::SetColor ( const FLinearColor InColor)
inlinefinaloverridevirtual

Reimplemented from FCanvasItem.

Member Data Documentation

◆ BatchedElements

FBatchedElements* FCanvasTextItemBase::BatchedElements
protected

These are used by the DrawStringInternal function.

◆ bCentreX

bool FCanvasTextItemBase::bCentreX

◆ bCentreY

bool FCanvasTextItemBase::bCentreY

◆ bDontCorrectStereoscopic

bool FCanvasTextItemBase::bDontCorrectStereoscopic

◆ bOutlined

bool FCanvasTextItemBase::bOutlined

◆ Depth

float FCanvasTextItemBase::Depth

◆ DrawnSize

FVector2D FCanvasTextItemBase::DrawnSize

◆ FontRenderInfo

FFontRenderInfo FCanvasTextItemBase::FontRenderInfo

◆ HorizSpacingAdjust

float FCanvasTextItemBase::HorizSpacingAdjust

◆ OutlineColor

FLinearColor FCanvasTextItemBase::OutlineColor

◆ Scale

FVector2D FCanvasTextItemBase::Scale

◆ ShadowColor

FLinearColor FCanvasTextItemBase::ShadowColor

◆ ShadowOffset

FVector2D FCanvasTextItemBase::ShadowOffset

◆ TileItem

FCanvasTileItem FCanvasTextItemBase::TileItem
protected

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