Navigation
API > API/Runtime > API/Runtime/SlateCore
Font caching implementation Caches characters into textures as needed
| Name | FSlateFontCache |
| Type | class |
| Header File | /Engine/Source/Runtime/SlateCore/Public/Fonts/FontCache.h |
| Include Path | #include "Fonts/FontCache.h" |
Syntax
class FSlateFontCache :
public ISlateAtlasProvider ,
public FSlateFlushableAtlasCache
Inheritance Hierarchy
- FSlateFlushableAtlasCache → FSlateFontCache
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSlateFontCache
(
TSharedRef< ISlateFontAtlasFactory > InFontAtlasFactory, |
Constructor | Fonts/FontCache.h | |
FSlateFontCache
(
const FSlateFontCache& |
Non-copyable. | Fonts/FontCache.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual ~FSlateFontCache() |
Fonts/FontCache.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AllFontTextures | TArray< TSharedRef< ISlateFontTexture > > | Array of all font textures - both atlased and non-atlased | Fonts/FontCache.h | |
| bFlushRequested | volatile bool | Whether or not we have a pending request to flush the cache when it is safe to do so | Fonts/FontCache.h | |
| ColorFontAtlasIndices | TArray< uint8 > | Array of color font atlas indices for use with AllFontTextures (cast the element to FSlateFontAtlas) | Fonts/FontCache.h | |
| CompositeFontCache | TUniquePtr< FCompositeFontCache > | High-level composite font cache (owned by this font cache) | Fonts/FontCache.h | |
| EllipsisText | FText | Overflow text string to use to replace clipped characters | Fonts/FontCache.h | |
| FCharacterList | friend | Fonts/FontCache.h | ||
| FontAtlasFactory | TSharedRef< ISlateFontAtlasFactory > | Factory for creating new font atlases | Fonts/FontCache.h | |
| FontObjectsToFlush | TArray< const UObject * > | Array of UFont objects that the font cache has been requested to flush. | Fonts/FontCache.h | |
| FontObjectsToFlushCS | FCriticalSection | Critical section preventing concurrent access to FontObjectsToFlush | Fonts/FontCache.h | |
| FontRenderer | TUniquePtr< FSlateFontRenderer > | FreeType font renderer (owned by this font cache) | Fonts/FontCache.h | |
| FontToCharacterListCache | TMap< FSlateFontKey, TUniquePtr< FCharacterList >, FDefaultSetAllocator, FSlateFontKeyFuncs< TUniquePtr< FCharacterList > > > | Mapping Font keys to cached data | Fonts/FontCache.h | |
| FTCacheDirectory | TUniquePtr< FFreeTypeCacheDirectory > | FreeType low-level cache directory (owned by this font cache) | Fonts/FontCache.h | |
| FTLibrary | TUniquePtr< FFreeTypeLibrary > | FreeType library instance (owned by this font cache) | Fonts/FontCache.h | |
| GrayscaleFontAtlasIndices | TArray< uint8 > | Array of grayscale font atlas indices for use with AllFontTextures (cast the element to FSlateFontAtlas) | Fonts/FontCache.h | |
| MsdfFontAtlasIndices | TArray< uint8 > | Array of multi-channel distance field font atlas indices for use with AllFontTextures (cast the element to FSlateFontAtlas) | Fonts/FontCache.h | |
| NonAtlasedTextureIndices | TArray< uint8 > | Array of any non-atlased font texture indices for use with AllFontTextures | Fonts/FontCache.h | |
| OnReleaseResourcesDelegate | FOnReleaseFontResources | Called after releasing the rendering resources in ReleaseResources | Fonts/FontCache.h | |
| OwningThread | ESlateTextureAtlasThreadId | Fonts/FontCache.h | ||
| SdfGenerator | TUniquePtr< FSlateSdfGenerator > | Sdf Rasterizer for Freetype fonts | Fonts/FontCache.h | |
| SdfGlyphToAtlasData | TMap< FSdfGlyphEntryKey, TSharedRef< FSdfGlyphFontAtlasData > > | Mapping signed distance field glyphs to their cached atlas data | Fonts/FontCache.h | |
| SdfTaskToAtlasData | TMap< FSdfGlyphTaskKey, TSharedRef< FSdfGlyphFontAtlasData > > | Mapping unfinished signed distance field tasks to their cached atlas data | Fonts/FontCache.h | |
| ShapedGlyphToAtlasData | TMap< FShapedGlyphEntryKey, TSharedRef< FShapedGlyphFontAtlasData > > | Mapping shaped glyphs to their cached atlas data | Fonts/FontCache.h | |
| TextShaper | TUniquePtr< FSlateTextShaper > | HarfBuzz text shaper (owned by this font cache) | Fonts/FontCache.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CanLoadCodepoint
(
const FFontData& InFontData, |
Whether or not the specified character, within the specified font, can be loaded with the specified maximum font fallback level | Fonts/FontCache.h | |
bool ConditionalFlushCache() |
Flush the cache if needed | Fonts/FontCache.h | |
void FlushCompositeFont
(
const FCompositeFont& InCompositeFont |
Flush the given composite font out of the cache | Fonts/FontCache.h | |
void FlushData() |
Clears just the cached font data, but leaves the atlases alone | Fonts/FontCache.h | |
void FlushObject
(
const UObject*const InObject |
Flush the given object out of the cache | Fonts/FontCache.h | |
TArray< FString > GetAvailableFontSubFaces
(
FFontFaceDataConstRef InMemory |
Get the available sub-face data from the given font. | Fonts/FontCache.h | |
TArray< FString > GetAvailableFontSubFaces
(
const FString& InFilename |
Fonts/FontCache.h | ||
int16 GetBaseline
(
const FSlateFontInfo& InFontInfo, |
Returns the baseline for the specified font. | Fonts/FontCache.h | |
FCharacterList & GetCharacterList
(
const FSlateFontInfo& InFontInfo, |
Gets information for how to draw all non-shaped characters in the specified string. | Fonts/FontCache.h | |
const FFontData & GetDefaultFontData
(
const FSlateFontInfo& InFontInfo |
Returns the font to use from the default typeface | Fonts/FontCache.h | |
| Returns the font attributes for the specified font. | Fonts/FontCache.h | ||
SIZE_T GetFontDataAssetResidentMemory
(
const UObject* FontDataAsset |
Gets the allocated font face data for a font data asset | Fonts/FontCache.h | |
const FFontData & GetFontDataForCodepoint
(
const FSlateFontInfo& InFontInfo, |
Returns the font to use from the typeface associated with the given codepoint | Fonts/FontCache.h | |
ISlateFontTexture * GetFontTexture
(
uint32 Index |
Get the texture resource for a font atlas at a given index | Fonts/FontCache.h | |
int8 GetKerning
(
const FFontData& InFontData, |
Calculates the kerning amount for a pair of characters | Fonts/FontCache.h | |
uint16 GetMaxCharacterHeight
(
const FSlateFontInfo& InFontInfo, |
Returns the height of the largest character in the font. | Fonts/FontCache.h | |
FShapedGlyphSequenceRef GetOverflowEllipsisText
(
const FSlateFontInfo& InFontInfo, |
Gets the overflow glyph sequence for a given font. | Fonts/FontCache.h | |
FSdfGlyphFontAtlasData GetSdfGlyphFontAtlasData
(
const FShapedGlyphEntry& InShapedGlyph, |
Get the atlas information and the scaled metrics of a given shaped sdf glyph. | Fonts/FontCache.h | |
FShapedGlyphFontAtlasData GetShapedGlyphFontAtlasData
(
const FShapedGlyphEntry& InShapedGlyph, |
Get the atlas information for the given shaped glyph. This information will be cached if required | Fonts/FontCache.h | |
void GetStrikeMetrics
(
const FSlateFontInfo& InFontInfo, |
Get the strike metrics for the specified font. | Fonts/FontCache.h | |
void GetUnderlineMetrics
(
const FSlateFontInfo& InFontInfo, |
Get the underline metrics for the specified font. | Fonts/FontCache.h | |
bool HasKerning
(
const FFontData& InFontData |
Fonts/FontCache.h | ||
bool HasLoadedFontForCodepoint
(
const FSlateFontInfo& InFontInfo, |
Returns true if the font to use from the typeface associated with the given codepoint is already loaded | Fonts/FontCache.h | |
FOnReleaseFontResources & OnReleaseResources() |
Event called after releasing the rendering resources in ReleaseResources | Fonts/FontCache.h | |
void ReleaseResources() |
Releases rendering resources | Fonts/FontCache.h | |
FShapedGlyphSequenceRef ShapeBidirectionalText
(
const FString& InText, |
Performs text shaping on the given string using the given font info. | Fonts/FontCache.h | |
FShapedGlyphSequenceRef ShapeBidirectionalText
(
const TCHAR* InText, |
Fonts/FontCache.h | ||
FShapedGlyphSequenceRef ShapeOverflowEllipsisText
(
const FSlateFontInfo& InFontInfo, |
Performs text shaping on the overflow glyph sequence for a given font. | Fonts/FontCache.h | |
FShapedGlyphSequenceRef ShapeUnidirectionalText
(
const FString& InText, |
Performs text shaping on the given range of the string using the given font info. | Fonts/FontCache.h | |
FShapedGlyphSequenceRef ShapeUnidirectionalText
(
const TCHAR* InText, |
Fonts/FontCache.h | ||
void UpdateCache() |
Updates the texture used for rendering | Fonts/FontCache.h |
Overridden from ISlateAtlasProvider
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual FSlateShaderResource * GetAtlasPageResource
(
const int32 InIndex |
Get the page resource for the given index (verify with GetNumAtlasPages) | Fonts/FontCache.h | |
virtual FAtlasSlotInfo GetAtlasSlotInfoAtPosition
(
FIntPoint InPosition, |
Finds a currently occupied slot at a position specified in atlas coordinates where 0,0 is the top left and the size of the atlas is bottom right | Fonts/FontCache.h | |
virtual int32 GetNumAtlasPages() |
ISlateAtlasProvider | Fonts/FontCache.h | |
virtual bool IsAtlasPageResourceAlphaOnly
(
const int32 InIndex |
Does the page resources for the given index only contain alpha information? This affects how the atlas visualizer will sample them (verify with GetNumAtlasPages) | Fonts/FontCache.h |
Overridden from FSlateFlushableAtlasCache
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void RequestFlushCache
(
const FString& FlushReason |
Issues a request to clear all cached data from the cache | Fonts/FontCache.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FSlateFontCache & operator=
(
const FSlateFontCache& |
Fonts/FontCache.h |