Font caching implementation Caches characters into textures as needed 更多...
#include <FontCache.h>
类 FSlateFontCache 继承关系图:Public 成员函数 | |
| bool | AddNewEntry (const FShapedGlyphEntry &InShapedGlyph, const FFontOutlineSettings &InOutlineSettings, FShapedGlyphFontAtlasData &OutAtlasData) |
| Add a new entries into a cache atlas 更多... | |
| bool | 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 更多... | |
| bool | ConditionalFlushCache () |
| Flush the cache if needed | |
| void | FlushCompositeFont (const FCompositeFont &InCompositeFont) |
| Flush the given composite font out of the cache | |
| void | FlushData () |
| Clears just the cached font data, but leaves the atlases alone | |
| void | FlushObject (const UObject *const InObject) |
| Flush the given object out of the cache | |
| FSlateFontCache (TSharedRef< ISlateFontAtlasFactory > InFontAtlasFactory, ESlateTextureAtlasThreadId InOwningThread) | |
| Constructor 更多... | |
| virtual FSlateShaderResource * | GetAtlasPageResource (const int32 InIndex) const override |
| Get the page resource for the given index (verify with GetNumAtlasPages) | |
| TArray< FString > | GetAvailableFontSubFaces (FFontFaceDataConstRef InMemory) const |
| Get the available sub-face data from the given font. 更多... | |
| int16 | GetBaseline (const FSlateFontInfo &InFontInfo, float FontScale) const |
| Returns the baseline for the specified font. 更多... | |
| class FCharacterList & | 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. 更多... | |
| const FFontData & | GetDefaultFontData (const FSlateFontInfo &InFontInfo) const |
| Returns the font to use from the default typeface 更多... | |
| const TSet< FName > & | GetFontAttributes (const FFontData &InFontData) const |
| Returns the font attributes for the specified font. 更多... | |
| uint32 | GetFontDataAssetResidentMemory (const UObject *FontDataAsset) const |
| Gets the allocated font face data for a font data asset | |
| const FFontData & | GetFontDataForCodepoint (const FSlateFontInfo &InFontInfo, const UTF32CHAR InCodepoint, float &OutScalingFactor) const |
| Returns the font to use from the typeface associated with the given codepoint 更多... | |
| ISlateFontTexture * | GetFontTexture (uint32 Index) |
| Get the texture resource for a font atlas at a given index 更多... | |
| int8 | GetKerning (const FFontData &InFontData, const int32 InSize, TCHAR First, TCHAR Second, float Scale) const |
| Calculates the kerning amount for a pair of characters 更多... | |
| uint16 | GetMaxCharacterHeight (const FSlateFontInfo &InFontInfo, float FontScale) const |
| Returns the height of the largest character in the font. 更多... | |
| virtual int32 | GetNumAtlasPages () const override |
| ISlateAtlasProvider | |
| FShapedGlyphFontAtlasData | GetShapedGlyphFontAtlasData (const FShapedGlyphEntry &InShapedGlyph, const FFontOutlineSettings &InOutlineSettings) |
| Get the atlas information for the given shaped glyph. 更多... | |
| void | GetStrikeMetrics (const FSlateFontInfo &InFontInfo, const float FontScale, int16 &OutStrikeLinePos, int16 &OutStrikeLineThickness) const |
| Get the strike metrics for the specified font. 更多... | |
| void | GetUnderlineMetrics (const FSlateFontInfo &InFontInfo, const float FontScale, int16 &OutUnderlinePos, int16 &OutUnderlineThickness) const |
| Get the underline metrics for the specified font. 更多... | |
| bool | HasKerning (const FFontData &InFontData) const |
| virtual bool | IsAtlasPageResourceAlphaOnly (const int32 InIndex) const override |
| Does the page resources for the given index only contain alpha information? This affects how the atlas visualizer will sample them (verify with GetNumAtlasPages) | |
| FOnReleaseFontResources & | OnReleaseResources () |
| Event called after releasing the rendering resources in ReleaseResources | |
| void | ReleaseResources () |
| Releases rendering resources | |
| void | RequestFlushCache (const FString &FlushReason) |
| Issues a request to clear all cached data from the cache | |
| FShapedGlyphSequenceRef | 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. 更多... | |
| FShapedGlyphSequenceRef | 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. 更多... | |
| void | UpdateCache () |
| Updates the texture used for rendering | |
Public 成员函数 继承自 ISlateAtlasProvider | |
| virtual class FSlateShaderResource * | GetAtlasPageResource (const int32 InIndex) const =0 |
| Get the page resource for the given index (verify with GetNumAtlasPages) | |
| virtual int32 | GetNumAtlasPages () const =0 |
| Get the number of atlas pages this atlas provider has available when calling GetAtlasPageResource | |
| virtual bool | IsAtlasPageResourceAlphaOnly (const int32 InIndex) const =0 |
| Does the page resources for the given index only contain alpha information? This affects how the atlas visualizer will sample them (verify with GetNumAtlasPages) | |
| virtual | ~ISlateAtlasProvider () |
| Virtual destructor | |
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 |
| bool FSlateFontCache::AddNewEntry | ( | const FShapedGlyphEntry & | InShapedGlyph, |
| const FFontOutlineSettings & | InOutlineSettings, | ||
| FShapedGlyphFontAtlasData & | OutAtlasData | ||
| ) |
Add a new entries into a cache atlas
| InFontInfo | Information about the font being used for the characters |
| Characters | The characters to cache |
| FontScale | The font scale to use |
| 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 |
| 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 |
| class 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 |
| 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 int32 | 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 |
| 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::HasKerning | ( | const FFontData & | InFontData | ) | const |
| 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::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 |