UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PreprocessedFontGeometry.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"
6
7// Forward declaration of MSDFgen types
8namespace SlateMsdfgen
9{
10namespace msdfgen
11{
12class Shape;
13}
14typedef msdfgen::Shape FShape;
15}
16
17namespace UE
18{
19namespace Slate
20{
21
22class FPreprocessedFontGeometry;
23
26{
27
28public:
30
32 : Flags(0)
33 , ContourCount(0)
34 , ContourDataPtr(nullptr)
35 , CoordinateDataPtr(nullptr)
36 , ContourDataLength(0)
37 , CoordinateDataLength(0)
38 { }
39
47 );
48
51
54
57
58private:
60 uint8 Flags;
62 int32 ContourCount;
64 const uint8* ContourDataPtr;
66 const int16* CoordinateDataPtr;
68 int32 ContourDataLength;
70 int32 CoordinateDataLength;
71
72};
73
76{
77public:
78
80 static constexpr uint8 FLAG_REVERSE_WINDINGS = 0x01;
82 static constexpr uint8 FLAG_CONTOUR_WINDINGS = 0x02;
84 static constexpr uint8 FLAG_FULL_GEOMETRY = 0x04;
86 static constexpr uint8 FLAG_INVERSE_Y_AXIS = 0x10;
87
89 static constexpr uint8 FLAG_CONTOUR_END = 0x08;
90
95 {
96
97 public:
99
100 explicit FWindingFingerprint(const SlateMsdfgen::FShape& MsdfgenShape);
102
103 bool operator==(const FWindingFingerprint& Other) const;
104 bool operator!=(const FWindingFingerprint& Other) const;
105
108
109 private:
110 struct FContourFingerprint;
111
114
115 };
116
121 {
122
123 public:
124 explicit FGeometryFingerprint(const SlateMsdfgen::FShape& MsdfgenShape);
125
126 bool operator==(const FGeometryFingerprint& Other) const;
127 bool operator!=(const FGeometryFingerprint& Other) const;
128
129 private:
130 typedef TSet<TPair<int32, int32> > FContourVertices;
131
133 static bool OneWayMatch(const FGeometryFingerprint& A, const FGeometryFingerprint& B);
134
137
138 };
139
142 explicit FPreprocessedGlyphGeometry(const SlateMsdfgen::FShape& MsdfgenShape);
143
146
147private:
149 uint8 Flags;
151 int32 ContourCount;
152
166 TArray<uint8> ContourData;
167
175 TArray<int16> CoordinateData;
176
177};
178
198{
199public:
200
202 void AddGlyph(const int32 GlyphIndex, const FPreprocessedGlyphGeometryView& GlyphView);
203
210 FPreprocessedGlyphGeometryView ViewGlyph(const int32 GlyphIndex) const;
211
214 {
215 GlobalWindingReversal = InGlobalWindingReversal;
216 }
217
219 SIZE_T GetAllocatedSize() const;
220
222 SIZE_T GetDataSize() const;
223
226
227private:
228
230 struct FGlyphHeader
231 {
233 uint8 Flags;
235 int32 ContourCount;
237 int32 ContourDataStart;
239 int32 ContourDataLength;
241 int32 CoordinateDataStart;
243 int32 CoordinateDataLength;
244 };
245
246 friend FArchive& operator<<(FArchive& Ar, FGlyphHeader& GlyphHeader) {
247 return Ar
248 << GlyphHeader.Flags
249 << GlyphHeader.ContourCount
250 << GlyphHeader.ContourDataStart
251 << GlyphHeader.ContourDataLength
252 << GlyphHeader.CoordinateDataStart
253 << GlyphHeader.CoordinateDataLength;
254 }
255
257 bool GlobalWindingReversal = false;
261 TArray<uint8> ContourData;
263 TArray<int16> CoordinateData;
264
265};
266
267} // namespace Slate
268} // namespace UE
FPlatformTypes::int16 int16
A 16-bit signed integer.
Definition Platform.h:1123
FPlatformTypes::SIZE_T SIZE_T
An unsigned integer the same size as a pointer, the same as UPTRINT.
Definition Platform.h:1150
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
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition Archive.h:1208
Definition Array.h:670
Definition UnrealString.h.inl:34
Definition PreprocessedFontGeometry.h:198
FPreprocessedGlyphGeometryView ViewGlyph(const int32 GlyphIndex) const
Definition PreprocessedFontGeometry.cpp:449
friend FArchive & operator<<(FArchive &Ar, FGlyphHeader &GlyphHeader)
Definition PreprocessedFontGeometry.h:246
SIZE_T GetAllocatedSize() const
Definition PreprocessedFontGeometry.cpp:477
friend FArchive & operator<<(FArchive &Ar, FPreprocessedFontGeometry &FontGeometry)
Definition PreprocessedFontGeometry.cpp:487
SIZE_T GetDataSize() const
Definition PreprocessedFontGeometry.cpp:482
void SetGlobalWindingReversal(bool InGlobalWindingReversal)
Definition PreprocessedFontGeometry.h:213
void AddGlyph(const int32 GlyphIndex, const FPreprocessedGlyphGeometryView &GlyphView)
Definition PreprocessedFontGeometry.cpp:434
Definition PreprocessedFontGeometry.h:26
FPreprocessedGlyphGeometryView()
Definition PreprocessedFontGeometry.h:31
bool UpdateGeometry(SlateMsdfgen::FShape &OutMsdfgenShape) const
Definition PreprocessedFontGeometry.cpp:65
friend FPreprocessedFontGeometry
Definition PreprocessedFontGeometry.h:29
bool HasAllContoursReversedWindings() const
Definition PreprocessedFontGeometry.cpp:188
bool UpdateWindings(SlateMsdfgen::FShape &InOutMsdfgenShape) const
Definition PreprocessedFontGeometry.cpp:153
Definition PreprocessedFontGeometry.h:121
bool operator==(const FGeometryFingerprint &Other) const
Definition PreprocessedFontGeometry.cpp:289
bool operator!=(const FGeometryFingerprint &Other) const
Definition PreprocessedFontGeometry.cpp:294
Definition PreprocessedFontGeometry.h:95
bool operator==(const FWindingFingerprint &Other) const
Definition PreprocessedFontGeometry.cpp:216
static bool Diff(bool &OutAllDiff, TArray< uint8 > &OutDiffVector, const FWindingFingerprint &A, const FWindingFingerprint &B)
Definition PreprocessedFontGeometry.cpp:237
friend FPreprocessedGlyphGeometry
Definition PreprocessedFontGeometry.h:98
bool operator!=(const FWindingFingerprint &Other) const
Definition PreprocessedFontGeometry.cpp:232
Definition PreprocessedFontGeometry.h:76
static constexpr uint8 FLAG_INVERSE_Y_AXIS
Definition PreprocessedFontGeometry.h:86
static constexpr uint8 FLAG_REVERSE_WINDINGS
Definition PreprocessedFontGeometry.h:80
static constexpr uint8 FLAG_CONTOUR_WINDINGS
Definition PreprocessedFontGeometry.h:82
FPreprocessedGlyphGeometryView View() const
Definition PreprocessedFontGeometry.cpp:422
static constexpr uint8 FLAG_CONTOUR_END
Definition PreprocessedFontGeometry.h:89
static constexpr uint8 FLAG_FULL_GEOMETRY
Definition PreprocessedFontGeometry.h:84
FPreprocessedGlyphGeometry()
Definition PreprocessedFontGeometry.cpp:345
Definition PreprocessedFontGeometry.h:9
msdfgen::Shape FShape
Definition PreprocessedFontGeometry.h:14
Definition SScissorRectBox.cpp:10
Definition AdvancedWidgetsModule.cpp:13