UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ShapedTextCacheUtil Namespace Reference

Functions

SLATE_API FVector2D MeasureShapedText (const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InMeasureRange, const TCHAR *InText)
 
SLATE_API int32 FindCharacterIndexAtOffset (const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InTextRange, const TCHAR *InText, const int32 InHorizontalOffset)
 
SLATE_API int8 GetShapedGlyphKerning (const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const int32 InGlyphIndex, const TCHAR *InText)
 
SLATE_API FShapedGlyphSequenceRef GetShapedTextSubSequence (const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InTextRange, const TCHAR *InText, const TextBiDi::ETextDirection InTextDirection)
 

Detailed Description

Utility functions that can provide efficient caching of common operations

Function Documentation

◆ FindCharacterIndexAtOffset()

int32 ShapedTextCacheUtil::FindCharacterIndexAtOffset ( const FShapedTextCacheRef InShapedTextCache,
const FCachedShapedTextKey InRunKey,
const FTextRange InTextRange,
const TCHAR InText,
const int32  InHorizontalOffset 
)

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

Parameters
InShapedTextCacheThe shaped text cache to use
InRunKeyThe key identifying the cached shaped text for the run
InTextRangeThe range of text that should be extracted into its own shaped glyph sequence
InTextThe text to shape if we can't find the shaped text in the cache. InTextRange may specify a sub-section of the entire text
InHorizontalOffsetThe horizontal offset to get the character index for
Returns
The index of the character closest to the specified horizontal offset

◆ GetShapedGlyphKerning()

int8 ShapedTextCacheUtil::GetShapedGlyphKerning ( const FShapedTextCacheRef InShapedTextCache,
const FCachedShapedTextKey InRunKey,
const int32  InGlyphIndex,
const TCHAR InText 
)

Get the kerning between two shaped glyphs

Parameters
InShapedTextCacheThe shaped text cache to use
InRunKeyThe key identifying the cached shaped text for the run
InGlyphIndexThe index of the glyph to get the kerning for (will get it between the given glyph, and it's next glyph)
InTextThe text to shape if we can't find the shaped text in the cache. (InGlyphIndex, InGlyphIndex+1) will be the range used
Returns
The kerning

◆ GetShapedTextSubSequence()

FShapedGlyphSequenceRef ShapedTextCacheUtil::GetShapedTextSubSequence ( const FShapedTextCacheRef InShapedTextCache,
const FCachedShapedTextKey InRunKey,
const FTextRange InTextRange,
const TCHAR InText,
const TextBiDi::ETextDirection  InTextDirection 
)

Extract a sub-section of a run of text into its own shaped glyph sequence

Parameters
InShapedTextCacheThe shaped text cache to use
InRunKeyThe key identifying the cached shaped text for the run
InTextRangeThe range of text that should be extracted into its own shaped glyph sequence
InTextThe text to shape if we can't find the shaped text in the cache. InTextRange may specify a sub-section of the entire text
InTextDirectionThe text direction of all of the text to be shaped
Returns
The shaped text

◆ MeasureShapedText()

FVector2D ShapedTextCacheUtil::MeasureShapedText ( const FShapedTextCacheRef InShapedTextCache,
const FCachedShapedTextKey InRunKey,
const FTextRange InMeasureRange,
const TCHAR InText 
)

Measure a sub-section of a run of text

Parameters
InShapedTextCacheThe shaped text cache to use
InRunKeyThe key identifying the cached shaped text for the run
InMeasureRangeThe range of text that should be measured
InTextThe text to shape if we can't find the shaped text in the cache. InMeasureRange may specify a sub-section of the entire text
Returns
The measured size of the shaped text