FSlateFontCache

Font caching implementation Caches characters into textures as needed

Windows
MacOS
Linux

Inheritance Hierarchy

ISlateAtlasProvider

FSlateFontCache

References

Module

SlateCore

Header

/Engine/Source/Runtime/SlateCore/Public/Fonts/FontCache.h

Include

#include "Fonts/FontCache.h"

Syntax

class FSlateFontCache : public ISlateAtlasProvider

Remarks

Font caching implementation Caches characters into textures as needed

Constructors

Name Description

Public function

FSlateFontCache

(
    TSharedRef< ISlateFontAtlasFactory ...,
    ESlateTextureAtlasThreadId InOwning...
)

Constructor

Destructors

Name Description

Public function Virtual

~FSlateFontCache()

Functions

Name Description

Public function

bool

 

AddNewEntry

(
    const FCharacterRenderData InRender...,
    uint8& OutTextureIndex,
    uint16& OutGlyphX,
    uint16& OutGlyphY,
    uint16& OutGlyphWidth,
    uint16& OutGlyphHeight
)

Public function

bool

 

AddNewEntry

(
    const FShapedGlyphEntry& InShapedG...,
    const FFontOutlineSettings& InOutl...,
    FShapedGlyphFontAtlasData& OutAtla...
)

Add a new entries into a cache atlas

Public function Const

bool

 

CanLoadCodepoint

(
    const FFontData& InFontData,
    const UTF32CHAR InCodepoint,
    EFontFallback MaxFallbackLevel
)

Whether or not the specified character, within the specified font, can be loaded with the specified maximum font fallback level

Public function

bool

 

ConditionalFlushCache()

Flush the cache if needed

Public function

void

 

FlushCompositeFont

(
    const FCompositeFont& InCompositeF...
)

Flush the given composite font out of the cache

Public function

void

 

FlushData()

Clears just the cached font data, but leaves the atlases alone

Public function

void

 

FlushObject

(
    const UObject*const InObject
)

Flush the given object out of the cache

Public function Const

TArray< FStr...

 

GetAvailableFontSubFaces

(
    FFontFaceDataConstRef InMemory
)

Get the available sub-face data from the given font.

Public function Const

TArray< FStr...

 

GetAvailableFontSubFaces

(
    const FString& InFilename
)

Get the available sub-face data from the given font.

Public function Const

int16

 

GetBaseline

(
    const FSlateFontInfo& InFontInfo,
    float FontScale
)

Returns the baseline for the specified font.

Public function

FCharacterLi...

 

GetCharacterList

(
    const FSlateFontInfo& InFontInfo,
    float FontScale,
    const FFontOutlineSettings& InOutl...
)

Gets information for how to draw all non-shaped characters in the specified string.

Public function Const

const FFontD...

 

GetDefaultFontData

(
    const FSlateFontInfo& InFontInfo
)

Returns the font to use from the default typeface

Public function Const

const TSet< ...

 

GetFontAttributes

(
    const FFontData& InFontData
)

Returns the font attributes for the specified font.

Public function Const

uint32

 

GetFontDataAssetResidentMemory

(
    const UObject* FontDataAsset
)

Gets the allocated font face data for a font data asset

Public function Const

const FFontD...

 

GetFontDataForCodepoint

(
    const FSlateFontInfo& InFontInfo,
    const UTF32CHAR InCodepoint,
    float& OutScalingFactor
)

Returns the font to use from the typeface associated with the given codepoint

Public function

ISlateFontTe...

 

GetFontTexture

(
    uint32 Index
)

Get the texture resource for a font atlas at a given index

Public function Const

int8

 

GetKerning

(
    const FFontData& InFontData,
    const int32 InSize,
    TCHAR First,
    TCHAR Second,
    float Scale
)

Calculates the kerning amount for a pair of characters

Public function Const

uint16

 

GetMaxCharacterHeight

(
    const FSlateFontInfo& InFontInfo,
    float FontScale
)

Returns the height of the largest character in the font.

Public function

FShapedGlyph...

 

GetShapedGlyphFontAtlasData

(
    const FShapedGlyphEntry& InShapedG...,
    const FFontOutlineSettings& InOutl...
)

Get the atlas information for the given shaped glyph. This information will be cached if required

Public function Const

void

 

GetStrikeMetrics

(
    const FSlateFontInfo& InFontInfo,
    const float FontScale,
    int16& OutStrikeLinePos,
    int16& OutStrikeLineThickness
)

Get the strike metrics for the specified font.

Public function Const

void

 

GetUnderlineMetrics

(
    const FSlateFontInfo& InFontInfo,
    const float FontScale,
    int16& OutUnderlinePos,
    int16& OutUnderlineThickness
)

Get the underline metrics for the specified font.

Public function Const

bool

 

HasKerning

(
    const FFontData& InFontData
)

Public function

FOnReleaseFo...

 

OnReleaseResources()

Event called after releasing the rendering resources in ReleaseResources

Public function

void

 

ReleaseResources()

Releases rendering resources

Public function

void

 

RequestFlushCache

(
    const FString& FlushReason
)

Issues a request to clear all cached data from the cache

Public function Const

FShapedGlyph...

 

ShapeBidirectionalText

(
    const FString& InText,
    const FSlateFontInfo& InFontInfo,
    const float InFontScale,
    const TextBiDi::ETextDirection InBa...,
    const ETextShapingMethod InTextShap...
)

Performs text shaping on the given string using the given font info.

Public function Const

FShapedGlyph...

 

ShapeBidirectionalText

(
    const TCHAR* InText,
    const int32 InTextStart,
    const int32 InTextLen,
    const FSlateFontInfo& InFontInfo,
    const float InFontScale,
    const TextBiDi::ETextDirection InBa...,
    const ETextShapingMethod InTextShap...
)

Performs text shaping on the given string using the given font info.

Public function Const

FShapedGlyph...

 

ShapeUnidirectionalText

(
    const FString& InText,
    const FSlateFontInfo& InFontInfo,
    const float InFontScale,
    const TextBiDi::ETextDirection InTe...,
    const ETextShapingMethod InTextShap...
)

Performs text shaping on the given range of the string using the given font info.

Public function Const

FShapedGlyph...

 

ShapeUnidirectionalText

(
    const TCHAR* InText,
    const int32 InTextStart,
    const int32 InTextLen,
    const FSlateFontInfo& InFontInfo,
    const float InFontScale,
    const TextBiDi::ETextDirection InTe...,
    const ETextShapingMethod InTextShap...
)

Performs text shaping on the given range of the string using the given font info.

Public function

void

 

UpdateCache()

Updates the texture used for rendering

Overridden from ISlateAtlasProvider

Name Description

Public function Virtual Const

FSlateShader...

 

GetAtlasPageResource

(
    const int32 InIndex
)

Get the page resource for the given index (verify with GetNumAtlasPages)

Public function Virtual Const

FAtlasSlotIn...

 

GetAtlasSlotInfoAtPosition

(
    FIntPoint InPosition,
    int32 AtlasIndex
)

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

Public function Virtual Const

int32

 

GetNumAtlasPages()

ISlateAtlasProvider

Public function Virtual Const

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)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss