UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ShapedTextCache.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
9
10class FSlateFontCache;
11
14{
15public:
23
24 inline bool operator==(const FCachedShapedTextKey& Other) const
25 {
26 return TextRange == Other.TextRange
27 && Scale == Other.Scale
28 && TextContext == Other.TextContext
29 && FontInfo.IsIdenticalTo(Other.FontInfo);
30 }
31
32 inline bool operator!=(const FCachedShapedTextKey& Other) const
33 {
34 return !(*this == Other);
35 }
36
37 friend inline uint32 GetTypeHash(const FCachedShapedTextKey& Key)
38 {
39 uint32 KeyHash = 0;
40 KeyHash = HashCombine(KeyHash, GetTypeHash(Key.TextRange));
41 KeyHash = HashCombine(KeyHash, GetTypeHash(Key.Scale));
42 KeyHash = HashCombine(KeyHash, GetTypeHash(Key.TextContext));
43 KeyHash = HashCombine(KeyHash, GetTypeHash(Key.FontInfo));
44 return KeyHash;
45 }
46
48 float Scale;
51};
52
55{
56public:
62
71
85
97
105
109 SLATE_API void Clear();
110
115 {
116 return FontCachePtr.Pin();
117 }
118
119private:
120 // Private token only allows members or friends to call MakeShared
121 struct FPrivateToken { explicit FPrivateToken() = default; };
122
123public:
126 : FontCachePtr(InFontCache)
127 {
128 }
129
130private:
132 TWeakPtr<FSlateFontCache> FontCachePtr;
133
136};
137
FPlatformTypes::int8 int8
An 8-bit signed integer.
Definition Platform.h:1121
FPlatformTypes::TCHAR TCHAR
Either ANSICHAR or WIDECHAR, depending on whether the platform supports wide characters or the requir...
Definition Platform.h:1135
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
constexpr uint32 HashCombine(uint32 A, uint32 C)
Definition TypeHash.h:36
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition ShapedTextCache.h:55
SLATE_API void Clear()
Definition ShapedTextCache.cpp:112
FShapedTextCache(FPrivateToken, const TSharedRef< FSlateFontCache > &InFontCache)
Definition ShapedTextCache.h:125
SLATE_API FShapedGlyphSequencePtr FindShapedText(const FCachedShapedTextKey &InKey) const
Definition ShapedTextCache.cpp:9
static FShapedTextCacheRef Create(const TSharedRef< FSlateFontCache > &InFontCache)
Definition ShapedTextCache.h:58
SLATE_API FShapedGlyphSequenceRef FindOrAddShapedText(const FCachedShapedTextKey &InKey, const TCHAR *InText)
Definition ShapedTextCache.cpp:71
TSharedPtr< FSlateFontCache > GetFontCache() const
Definition ShapedTextCache.h:114
SLATE_API FShapedGlyphSequenceRef FindOrAddOverflowEllipsisText(const float InScale, const FShapedTextContext &InTextContext, const FSlateFontInfo &InFontInfo)
Definition ShapedTextCache.cpp:95
SLATE_API FShapedGlyphSequenceRef AddShapedText(const FCachedShapedTextKey &InKey, const TCHAR *InText)
Definition ShapedTextCache.cpp:21
Definition FontCache.h:756
Definition UnrealString.h.inl:34
Definition SharedPointer.h:1295
UE_FORCEINLINE_HINT TSharedPtr< ObjectType, Mode > Pin() const &
Definition SharedPointer.h:1512
Definition ShapedTextCache.h:140
SLATE_API FShapedGlyphSequenceRef GetShapedTextSubSequence(const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InTextRange, const TCHAR *InText, const TextBiDi::ETextDirection InTextDirection)
Definition ShapedTextCache.cpp:238
SLATE_API int8 GetShapedGlyphKerning(const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const int32 InGlyphIndex, const TCHAR *InText)
Definition ShapedTextCache.cpp:219
SLATE_API FVector2D MeasureShapedText(const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InMeasureRange, const TCHAR *InText)
Definition ShapedTextCache.cpp:118
SLATE_API int32 FindCharacterIndexAtOffset(const FShapedTextCacheRef &InShapedTextCache, const FCachedShapedTextKey &InRunKey, const FTextRange &InTextRange, const TCHAR *InText, const int32 InHorizontalOffset)
Definition ShapedTextCache.cpp:138
ETextDirection
Definition Text.h:1413
Definition ShapedTextCache.h:14
bool operator!=(const FCachedShapedTextKey &Other) const
Definition ShapedTextCache.h:32
FTextRange TextRange
Definition ShapedTextCache.h:47
friend uint32 GetTypeHash(const FCachedShapedTextKey &Key)
Definition ShapedTextCache.h:37
FSlateFontInfo FontInfo
Definition ShapedTextCache.h:50
float Scale
Definition ShapedTextCache.h:48
FShapedTextContext TextContext
Definition ShapedTextCache.h:49
FCachedShapedTextKey(const FTextRange &InTextRange, const float InScale, const FShapedTextContext &InTextContext, const FSlateFontInfo &InFontInfo)
Definition ShapedTextCache.h:16
bool operator==(const FCachedShapedTextKey &Other) const
Definition ShapedTextCache.h:24
Definition IRun.h:50
Definition SlateFontInfo.h:147
bool IsIdenticalTo(const FSlateFontInfo &Other) const
Definition SlateFontInfo.h:292
Definition UnrealString.h:234