![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <FontCache.h>
Inheritance diagram for FSlateFontCache:Font caching implementation Caches characters into textures as needed
| FSlateFontCache::FSlateFontCache | ( | TSharedRef< ISlateFontAtlasFactory > | InFontAtlasFactory, |
| ESlateTextureAtlasThreadId | InOwningThread | ||
| ) |
Constructor
| InTextureSize | The size of the atlas texture |
| InFontAlas | Platform specific font atlas resource |
|
virtual |
| bool FSlateFontCache::CanLoadCodepoint | ( | const FFontData & | InFontData, |
| const UTF32CHAR | InCodepoint, | ||
| EFontFallback | MaxFallbackLevel = EFontFallback::FF_NoFallback |
||
| ) | const |
Whether or not the specified character, within the specified font, can be loaded with the specified maximum font fallback level
| InFontData | Information about the font to load |
| InCodepoint | The codepoint being loaded |
| MaxFallbackLevel | The maximum fallback level to try for the font |
| bool FSlateFontCache::ConditionalFlushCache | ( | ) |
Flush the cache if needed
| void FSlateFontCache::FlushCompositeFont | ( | const FCompositeFont & | InCompositeFont | ) |
Flush the given composite font out of the cache
| void FSlateFontCache::FlushData | ( | ) |
Clears just the cached font data, but leaves the atlases alone
Flush the given object out of the cache
|
overridevirtual |
Get the page resource for the given index (verify with GetNumAtlasPages)
Implements ISlateAtlasProvider.
| TArray< FString > FSlateFontCache::GetAvailableFontSubFaces | ( | const FString & | InFilename | ) | const |
| TArray< FString > FSlateFontCache::GetAvailableFontSubFaces | ( | FFontFaceDataConstRef | InMemory | ) | const |
Get the available sub-face data from the given font. Typically there will only be one face unless this is a TTC/OTC font. The index of the returned entry can be passed as InFaceIndex to the FFreeTypeFace constructor.
| int16 FSlateFontCache::GetBaseline | ( | const FSlateFontInfo & | InFontInfo, |
| float | FontScale | ||
| ) | const |
Returns the baseline for the specified font.
| InFontInfo | A descriptor of the font to get character size for |
| FontScale | The scale to apply to the font |
| FCharacterList & FSlateFontCache::GetCharacterList | ( | const FSlateFontInfo & | InFontInfo, |
| float | FontScale, | ||
| const FFontOutlineSettings & | InOutlineSettings = FFontOutlineSettings::NoOutline |
||
| ) |
Gets information for how to draw all non-shaped characters in the specified string. Caches characters as they are found
| InFontInfo | Information about the font that the string is drawn with |
| FontScale | The scale to apply to the font |
| OutCharacterEntries | Populated array of character entries. Indices of characters in Text match indices in this array |
| const FFontData & FSlateFontCache::GetDefaultFontData | ( | const FSlateFontInfo & | InFontInfo | ) | const |
Returns the font to use from the default typeface
| InFontInfo | A descriptor of the font to get the default typeface for |
Returns the font attributes for the specified font.
| InFontData | The font to get attributes for |
Gets the allocated font face data for a font data asset
| const FFontData & FSlateFontCache::GetFontDataForCodepoint | ( | const FSlateFontInfo & | InFontInfo, |
| const UTF32CHAR | InCodepoint, | ||
| float & | OutScalingFactor | ||
| ) | const |
Returns the font to use from the typeface associated with the given codepoint
| InFontInfo | A descriptor of the font to get the typeface for |
| InCodepoint | The codepoint to get the typeface associated with |
| OutScalingFactor | The scaling factor applied to characters rendered with the given font |
|
inline |
Get the texture resource for a font atlas at a given index
| Index | The index of the texture |
| int8 FSlateFontCache::GetKerning | ( | const FFontData & | InFontData, |
| const float | InSize, | ||
| TCHAR | First, | ||
| TCHAR | Second, | ||
| float | Scale | ||
| ) | const |
Calculates the kerning amount for a pair of characters
| InFontData | The font that used to draw the string with the first and second characters |
| InSize | The size of the font to draw |
| First | The first character in the pair |
| Second | The second character in the pair |
| uint16 FSlateFontCache::GetMaxCharacterHeight | ( | const FSlateFontInfo & | InFontInfo, |
| float | FontScale | ||
| ) | const |
Returns the height of the largest character in the font.
| InFontInfo | A descriptor of the font to get character size for |
| FontScale | The scale to apply to the font |
|
overridevirtual |
Implements ISlateAtlasProvider.
| FShapedGlyphSequenceRef FSlateFontCache::GetOverflowEllipsisText | ( | const FSlateFontInfo & | InFontInfo, |
| const float | InFontScale | ||
| ) |
Gets the overflow glyph sequence for a given font. The overflow sequence is used to replace characters that are clipped
| FSdfGlyphFontAtlasData FSlateFontCache::GetSdfGlyphFontAtlasData | ( | const FShapedGlyphEntry & | InShapedGlyph, |
| const FFontOutlineSettings & | InOutlineSettings | ||
| ) |
Get the atlas information and the scaled metrics of a given shaped sdf glyph. This information will be cached if required.
| FShapedGlyphFontAtlasData FSlateFontCache::GetShapedGlyphFontAtlasData | ( | const FShapedGlyphEntry & | InShapedGlyph, |
| const FFontOutlineSettings & | InOutlineSettings | ||
| ) |
Get the atlas information for the given shaped glyph. This information will be cached if required
| void FSlateFontCache::GetStrikeMetrics | ( | const FSlateFontInfo & | InFontInfo, |
| const float | FontScale, | ||
| int16 & | OutStrikeLinePos, | ||
| int16 & | OutStrikeLineThickness | ||
| ) | const |
Get the strike metrics for the specified font.
| InFontInfo | A descriptor of the font to get character size for |
| FontScale | The scale to apply to the font |
| OutStrikeLinePos | The offset from the baseline to the center of the strike bar |
| OutStrikeLineThickness | The thickness of the strike bar |
| void FSlateFontCache::GetUnderlineMetrics | ( | const FSlateFontInfo & | InFontInfo, |
| const float | FontScale, | ||
| int16 & | OutUnderlinePos, | ||
| int16 & | OutUnderlineThickness | ||
| ) | const |
Get the underline metrics for the specified font.
| InFontInfo | A descriptor of the font to get character size for |
| FontScale | The scale to apply to the font |
| OutUnderlinePos | The offset from the baseline to the center of the underline bar |
| OutUnderlineThickness | The thickness of the underline bar |
| bool FSlateFontCache::HasLoadedFontForCodepoint | ( | const FSlateFontInfo & | InFontInfo, |
| const UTF32CHAR | InCodepoint | ||
| ) | const |
Returns true if the font to use from the typeface associated with the given codepoint is already loaded
| InFontInfo | A descriptor of the font to get the typeface for |
| InCodepoint | The codepoint to get the typeface associated with |
Does the page resources for the given index only contain alpha information? This affects how the atlas visualizer will sample them (verify with GetNumAtlasPages)
Implements ISlateAtlasProvider.
|
inline |
Event called after releasing the rendering resources in ReleaseResources
| void FSlateFontCache::ReleaseResources | ( | ) |
Releases rendering resources
|
virtual |
Issues a request to clear all cached data from the cache
Implements FSlateFlushableAtlasCache.
| FShapedGlyphSequenceRef FSlateFontCache::ShapeBidirectionalText | ( | const FString & | InText, |
| const FSlateFontInfo & | InFontInfo, | ||
| const float | InFontScale, | ||
| const TextBiDi::ETextDirection | InBaseDirection, | ||
| const ETextShapingMethod | InTextShapingMethod | ||
| ) | const |
Performs text shaping on the given string using the given font info. Returns you the shaped text sequence to use for text rendering via FSlateDrawElement::MakeShapedText. When using the version which takes a start point and length, the text outside of the given range won't be shaped, but will provide context information to allow the shaping to function correctly. ShapeBidirectionalText is used when you have text that may contain a mixture of LTR and RTL text runs.
| InText | The string to shape |
| InTextStart | The start position of the text to shape |
| InTextLen | The length of the text to shape |
| InFontInfo | Information about the font that the string is drawn with |
| InFontScale | The scale to apply to the font |
| InBaseDirection | The overall reading direction of the text (see TextBiDi::ComputeBaseDirection). This will affect where some characters (such as brackets and quotes) are placed within the resultant shaped text |
| InTextShapingMethod | The text shaping method to use |
| FShapedGlyphSequenceRef FSlateFontCache::ShapeBidirectionalText | ( | const TCHAR * | InText, |
| const int32 | InTextStart, | ||
| const int32 | InTextLen, | ||
| const FSlateFontInfo & | InFontInfo, | ||
| const float | InFontScale, | ||
| const TextBiDi::ETextDirection | InBaseDirection, | ||
| const ETextShapingMethod | InTextShapingMethod | ||
| ) | const |
| FShapedGlyphSequenceRef FSlateFontCache::ShapeOverflowEllipsisText | ( | const FSlateFontInfo & | InFontInfo, |
| const float | InFontScale | ||
| ) |
Performs text shaping on the overflow glyph sequence for a given font. The overflow sequence is used to replace characters that are clipped
| FShapedGlyphSequenceRef FSlateFontCache::ShapeUnidirectionalText | ( | const FString & | InText, |
| const FSlateFontInfo & | InFontInfo, | ||
| const float | InFontScale, | ||
| const TextBiDi::ETextDirection | InTextDirection, | ||
| const ETextShapingMethod | InTextShapingMethod | ||
| ) | const |
Performs text shaping on the given range of the string using the given font info. Returns you the shaped text sequence to use for text rendering via FSlateDrawElement::MakeShapedText. When using the version which takes a start point and length, the text outside of the given range won't be shaped, but will provide context information to allow the shaping to function correctly. ShapeUnidirectionalText is used when you have text that all reads in the same direction (either LTR or RTL).
| InText | The string containing the sub-string to shape |
| InTextStart | The start position of the text to shape |
| InTextLen | The length of the text to shape |
| InFontInfo | Information about the font that the string is drawn with |
| InFontScale | The scale to apply to the font |
| InTextDirection | The reading direction of the text to shape (valid values are LeftToRight or RightToLeft) |
| InTextShapingMethod | The text shaping method to use |
| FShapedGlyphSequenceRef FSlateFontCache::ShapeUnidirectionalText | ( | const TCHAR * | InText, |
| const int32 | InTextStart, | ||
| const int32 | InTextLen, | ||
| const FSlateFontInfo & | InFontInfo, | ||
| const float | InFontScale, | ||
| const TextBiDi::ETextDirection | InTextDirection, | ||
| const ETextShapingMethod | InTextShapingMethod | ||
| ) | const |
| void FSlateFontCache::UpdateCache | ( | ) |
Updates the texture used for rendering