UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSlateFontMeasure Class Referencefinal

#include <FontMeasure.h>

Public Member Functions

SLATECORE_API UE::Slate::FDeprecateVector2DResult Measure (FStringView Text, const FSlateFontInfo &InFontInfo, float FontScale=1.0f) const
 
SLATECORE_API UE::Slate::FDeprecateVector2DResult Measure (const FText &Text, const FSlateFontInfo &InFontInfo, float FontScale=1.0f) const
 
SLATECORE_API UE::Slate::FDeprecateVector2DResult Measure (FStringView Text, int32 StartIndex, int32 EndIndex, const FSlateFontInfo &InFontInfo, bool IncludeKerningWithPrecedingChar=true, float FontScale=1.0f) const
 
SLATECORE_API int32 FindLastWholeCharacterIndexBeforeOffset (FStringView Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindLastWholeCharacterIndexBeforeOffset (const FText &Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindLastWholeCharacterIndexBeforeOffset (FStringView Text, int32 StartIndex, int32 EndIndex, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, bool IncludeKerningWithPrecedingChar=true, float FontScale=1.0f) const
 
SLATECORE_API int32 FindFirstWholeCharacterIndexAfterOffset (FStringView Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindFirstWholeCharacterIndexAfterOffset (const FText &Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindFirstWholeCharacterIndexAfterOffset (FStringView Text, int32 StartIndex, int32 EndIndex, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, bool IncludeKerningWithPrecedingChar=true, float FontScale=1.0f) const
 
SLATECORE_API int32 FindCharacterIndexAtOffset (FStringView Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindCharacterIndexAtOffset (const FText &Text, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, float FontScale=1.0f) const
 
SLATECORE_API int32 FindCharacterIndexAtOffset (FStringView Text, int32 StartIndex, int32 EndIndex, const FSlateFontInfo &InFontInfo, const int32 HorizontalOffset, bool IncludeKerningWithPrecedingChar=true, float FontScale=1.0f) const
 
SLATECORE_API uint16 GetMaxCharacterHeight (const FSlateFontInfo &InFontInfo, float FontScale=1.0f) const
 
SLATECORE_API int8 GetKerning (const FSlateFontInfo &InFontInfo, float FontScale, TCHAR PreviousCharacter, TCHAR CurrentCharacter) const
 
SLATECORE_API int16 GetBaseline (const FSlateFontInfo &InFontInfo, float FontScale=1.0f) const
 
SLATECORE_API void FlushCache ()
 

Static Public Member Functions

static SLATECORE_API TSharedRef< FSlateFontMeasureCreate (const TSharedRef< class FSlateFontCache > &FontCache)
 

Member Function Documentation

◆ Create()

TSharedRef< FSlateFontMeasure > FSlateFontMeasure::Create ( const TSharedRef< class FSlateFontCache > &  FontCache)
static

◆ FindCharacterIndexAtOffset() [1/3]

int32 FSlateFontMeasure::FindCharacterIndexAtOffset ( const FText Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the character index at the specified position in pixels along the text horizontally

Parameters
TextThe text to measure
FontNameThe name of the font the text is drawn with
FontSizeThe size of the font
HorizontalOffsetOffset horizontally into the text, in pixels
FontScaleThe scale to apply to the font
Returns
The index of the character closest to the specified horizontal offset

◆ FindCharacterIndexAtOffset() [2/3]

int32 FSlateFontMeasure::FindCharacterIndexAtOffset ( FStringView  Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the character index at the specified position in pixels along the string horizontally

Parameters
TextThe string to measure
FontNameThe name of the font the string is drawn with
FontSizeThe size of the font
HorizontalOffsetOffset horizontally into the string, in pixels
FontScaleThe scale to apply to the font
Returns
The index of the character closest to the specified horizontal offset

◆ FindCharacterIndexAtOffset() [3/3]

int32 FSlateFontMeasure::FindCharacterIndexAtOffset ( FStringView  Text,
int32  StartIndex,
int32  EndIndex,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
bool  IncludeKerningWithPrecedingChar = true,
float  FontScale = 1.0f 
) const

Finds the character index at the specified position in pixels along the string horizontally

Parameters
TextThe string to measure
StartIndexThe inclusive index to start measuring the string at
EndIndexThe inclusive index to stop measuring the string at
FontNameThe name of the font the string is drawn with
FontSizeThe size of the font
HorizontalOffsetOffset horizontally into the string, in pixels
FontScaleThe scale to apply to the font
Returns
The index of the character closest to the specified horizontal offset

◆ FindFirstWholeCharacterIndexAfterOffset() [1/3]

int32 FSlateFontMeasure::FindFirstWholeCharacterIndexAfterOffset ( const FText Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the first whole character index after the specified position in pixels along the string horizontally

Parameters
StringThe string to measure
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the first whole character after the specified horizontal offset

◆ FindFirstWholeCharacterIndexAfterOffset() [2/3]

int32 FSlateFontMeasure::FindFirstWholeCharacterIndexAfterOffset ( FStringView  Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the first whole character index after the specified position in pixels along the string horizontally

Parameters
StringThe string to measure
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the first whole character after the specified horizontal offset

◆ FindFirstWholeCharacterIndexAfterOffset() [3/3]

int32 FSlateFontMeasure::FindFirstWholeCharacterIndexAfterOffset ( FStringView  Text,
int32  StartIndex,
int32  EndIndex,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
bool  IncludeKerningWithPrecedingChar = true,
float  FontScale = 1.0f 
) const

Finds the first whole character index after the specified position in pixels along the string horizontally

Parameters
StringThe string to measure
StartIndexThe inclusive index to start measuring the string at
EndIndexThe inclusive index to stop measuring the string at
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the first whole character after the specified horizontal offset

◆ FindLastWholeCharacterIndexBeforeOffset() [1/3]

int32 FSlateFontMeasure::FindLastWholeCharacterIndexBeforeOffset ( const FText Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the last whole character index before the specified position in pixels along the string horizontally

Parameters
StringThe string to measure
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the last whole character before the specified horizontal offset

◆ FindLastWholeCharacterIndexBeforeOffset() [2/3]

int32 FSlateFontMeasure::FindLastWholeCharacterIndexBeforeOffset ( FStringView  Text,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
float  FontScale = 1.0f 
) const

Finds the last whole character index before the specified position in pixels along the string horizontally

Parameters
StringThe string to measure
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the last whole character before the specified horizontal offset

◆ FindLastWholeCharacterIndexBeforeOffset() [3/3]

int32 FSlateFontMeasure::FindLastWholeCharacterIndexBeforeOffset ( FStringView  Text,
int32  StartIndex,
int32  EndIndex,
const FSlateFontInfo InFontInfo,
const int32  HorizontalOffset,
bool  IncludeKerningWithPrecedingChar = true,
float  FontScale = 1.0f 
) const

Finds the last whole character index before the specified position in pixels along the text horizontally

Parameters
TextThe text to measure
StartIndexThe inclusive index to start measuring the string at
EndIndexThe inclusive index to stop measuring the string at
InFontInfoInformation about the font used to draw the string
HorizontalOffsetOffset horizontally into the string, in pixels
Returns
The index of the last whole character before the specified horizontal offset

◆ FlushCache()

void FSlateFontMeasure::FlushCache ( )

◆ GetBaseline()

int16 FSlateFontMeasure::GetBaseline ( const FSlateFontInfo InFontInfo,
float  FontScale = 1.0f 
) const

Returns the baseline for the specified font.

Parameters
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
Returns
The offset from the bottom of the max character height to the baseline.

◆ GetKerning()

int8 FSlateFontMeasure::GetKerning ( const FSlateFontInfo InFontInfo,
float  FontScale,
TCHAR  PreviousCharacter,
TCHAR  CurrentCharacter 
) const

Returns the kerning value for the specified pair of characters.

Parameters
InFontInfoA descriptor of the font to get kerning for
FontScaleThe scale to apply to the font
PreviousCharacterThe character preceding the current character that you want to measure kerning for
CurrentCharacterThe current character to you to measure kerning for when precede by the specified PreviousCharacter
Returns
the kerning value used between the two specified characters

◆ GetMaxCharacterHeight()

uint16 FSlateFontMeasure::GetMaxCharacterHeight ( const FSlateFontInfo InFontInfo,
float  FontScale = 1.0f 
) const

Returns the height of the largest character in the font.

Parameters
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
Returns
The largest character height

◆ Measure() [1/3]

UE::Slate::FDeprecateVector2DResult FSlateFontMeasure::Measure ( const FText Text,
const FSlateFontInfo InFontInfo,
float  FontScale = 1.0f 
) const

Measures the width and height of a passed in text. The height is the maximum height of the largest character in the font/size pair

Parameters
TextThe text to measure
InFontInfoInformation about the font that the text is drawn with
FontScaleThe scale to apply to the font
Returns
The width and height of the text.

◆ Measure() [2/3]

UE::Slate::FDeprecateVector2DResult FSlateFontMeasure::Measure ( FStringView  Text,
const FSlateFontInfo InFontInfo,
float  FontScale = 1.0f 
) const

Measures the width and height of a passed in string. The height is the maximum height of the largest character in the font/size pair

Parameters
TextThe string to measure
InFontInfoInformation about the font that the string is drawn with
FontScaleThe scale to apply to the font
Returns
The width and height of the string.

◆ Measure() [3/3]

UE::Slate::FDeprecateVector2DResult FSlateFontMeasure::Measure ( FStringView  Text,
int32  StartIndex,
int32  EndIndex,
const FSlateFontInfo InFontInfo,
bool  IncludeKerningWithPrecedingChar = true,
float  FontScale = 1.0f 
) const

Measures the width and height of a passed in string. The height is the maximum height of the largest character in the font/size pair

Parameters
TextThe string to measure
StartIndexThe inclusive index to start measuring the string at
EndIndexThe inclusive index to stop measuring the string at
InFontInfoInformation about the font that the string is drawn with
FontScaleThe scale to apply to the font
Returns
The width and height of the string.

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