engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 所有成员列表
FSlateFontCache类 参考

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::FSlateFontCache ( TSharedRef< ISlateFontAtlasFactory >  InFontAtlasFactory,
ESlateTextureAtlasThreadId  InOwningThread 
)

Constructor

参数
InTextureSizeThe size of the atlas texture
InFontAlasPlatform specific font atlas resource

成员函数说明

◆ AddNewEntry()

bool FSlateFontCache::AddNewEntry ( const FShapedGlyphEntry &  InShapedGlyph,
const FFontOutlineSettings &  InOutlineSettings,
FShapedGlyphFontAtlasData &  OutAtlasData 
)

Add a new entries into a cache atlas

参数
InFontInfoInformation about the font being used for the characters
CharactersThe characters to cache
FontScaleThe font scale to use
返回
true if the characters could be cached. false if the cache is full

◆ CanLoadCodepoint()

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

参数
InFontDataInformation about the font to load
InCodepointThe codepoint being loaded
MaxFallbackLevelThe maximum fallback level to try for the font
返回
Whether or not the character can be loaded

◆ GetAvailableFontSubFaces()

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.

◆ GetBaseline()

int16 FSlateFontCache::GetBaseline ( const FSlateFontInfo &  InFontInfo,
float  FontScale 
) const

Returns the baseline for the specified font.

参数
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
返回
The offset from the bottom of the max character height to the baseline.

◆ GetCharacterList()

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

参数
InFontInfoInformation about the font that the string is drawn with
FontScaleThe scale to apply to the font
OutCharacterEntriesPopulated array of character entries. Indices of characters in Text match indices in this array

◆ GetDefaultFontData()

const FFontData & FSlateFontCache::GetDefaultFontData ( const FSlateFontInfo &  InFontInfo) const

Returns the font to use from the default typeface

参数
InFontInfoA descriptor of the font to get the default typeface for
返回
The raw font data

◆ GetFontAttributes()

const TSet< FName > & FSlateFontCache::GetFontAttributes ( const FFontData &  InFontData) const

Returns the font attributes for the specified font.

参数
InFontDataThe font to get attributes for
返回
The font attributes for the specified font.

◆ GetFontDataForCodepoint()

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

参数
InFontInfoA descriptor of the font to get the typeface for
InCodepointThe codepoint to get the typeface associated with
OutScalingFactorThe scaling factor applied to characters rendered with the given font
返回
The raw font data

◆ GetFontTexture()

ISlateFontTexture * FSlateFontCache::GetFontTexture ( uint32  Index)
inline

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

参数
IndexThe index of the texture
返回
Handle to the texture resource

◆ GetKerning()

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

参数
InFontDataThe font that used to draw the string with the first and second characters
InSizeThe size of the font to draw
FirstThe first character in the pair
SecondThe second character in the pair
返回
The kerning amount, 0 if no kerning

◆ GetMaxCharacterHeight()

uint16 FSlateFontCache::GetMaxCharacterHeight ( const FSlateFontInfo &  InFontInfo,
float  FontScale 
) const

Returns the height of the largest character in the font.

参数
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
返回
The largest character height

◆ GetShapedGlyphFontAtlasData()

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

◆ GetStrikeMetrics()

void FSlateFontCache::GetStrikeMetrics ( const FSlateFontInfo &  InFontInfo,
const float  FontScale,
int16 &  OutStrikeLinePos,
int16 &  OutStrikeLineThickness 
) const

Get the strike metrics for the specified font.

参数
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
OutStrikeLinePosThe offset from the baseline to the center of the strike bar
OutStrikeLineThicknessThe thickness of the strike bar

◆ GetUnderlineMetrics()

void FSlateFontCache::GetUnderlineMetrics ( const FSlateFontInfo &  InFontInfo,
const float  FontScale,
int16 &  OutUnderlinePos,
int16 &  OutUnderlineThickness 
) const

Get the underline metrics for the specified font.

参数
InFontInfoA descriptor of the font to get character size for
FontScaleThe scale to apply to the font
OutUnderlinePosThe offset from the baseline to the center of the underline bar
OutUnderlineThicknessThe thickness of the underline bar

◆ HasKerning()

bool FSlateFontCache::HasKerning ( const FFontData &  InFontData) const
返回
Whether or not the font used has kerning information

◆ ShapeBidirectionalText()

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.

参数
InTextThe string to shape
InTextStartThe start position of the text to shape
InTextLenThe length of the text to shape
InFontInfoInformation about the font that the string is drawn with
InFontScaleThe scale to apply to the font
InBaseDirectionThe 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
InTextShapingMethodThe text shaping method to use

◆ ShapeUnidirectionalText()

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).

参数
InTextThe string containing the sub-string to shape
InTextStartThe start position of the text to shape
InTextLenThe length of the text to shape
InFontInfoInformation about the font that the string is drawn with
InFontScaleThe scale to apply to the font
InTextDirectionThe reading direction of the text to shape (valid values are LeftToRight or RightToLeft)
InTextShapingMethodThe text shaping method to use

该类的文档由以下文件生成: