Navigation
Unreal Engine C++ API Reference > Runtime > Engine > Engine
Inheritance Hierarchy
References
Module | Engine |
Header | /Engine/Source/Runtime/Engine/Classes/Engine/Font.h |
Include | #include "Engine/Font.h" |
Syntax
class UFont :
public UObject,
public IFontProviderInterface
Remarks
A font object, for use by Slate, UMG, and Canvas.
A font can either be:
- Runtime cached - The font contains a series of TTF files that combine to form a composite font. The glyphs are cached on demand when required at runtime.
- Offline cached - The font contains a series of textures containing pre-baked cached glyphs and their associated texture coordinates.
Variables
Type | Name | Description | |
---|---|---|---|
![]() |
float | Ascent | |
![]() |
TArray< struct FFontCharacter > | Characters | List of characters in the font. |
![]() |
TMap< uint16, uint16 > | CharRemap | When IsRemapped is true, this array maps unicode values to entries in the Characters array |
![]() |
FCompositeFont | CompositeFont | Embedded composite font data |
![]() |
float | Descent | |
![]() |
float | EmScale | Font metrics. |
![]() |
EFontCacheType | FontCacheType | What kind of font caching should we use? This controls which options we see |
![]() |
FFontImportOptionsData | ImportOptions | Options used when importing this font |
![]() |
int32 | IsRemapped | True if font is 'remapped'. |
![]() |
int32 | Kerning | Default horizontal spacing between characters when rendering text with this font |
![]() |
float | Leading | |
![]() |
FName | LegacyFontName | The default font name to use for legacy Canvas APIs that don't specify a font name |
![]() |
int32 | LegacyFontSize | The default size of the font used for legacy Canvas APIs that don't specify a font size |
![]() |
TArray< int32 > | MaxCharHeight | The maximum height of a character in this font. |
![]() |
int32 | NumCharacters | Number of characters in the font, not including multiple instances of the same character (for multi-fonts). |
![]() |
float | ScalingFactor | Scale to apply to the font. |
![]() |
TArray< TObjectPtr< class UTexture2D > > | Textures | NOTE: Do not expose this to the editor as it has nasty crash potential. |
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
UFont
(
const FObjectInitializer& ObjectInitializer |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | Caches the character count and maximum character height for this font (as well as sub-fonts, in the multi-font case) | |
![]() ![]() |
int16 | GetCharHorizontalOffset
(
TCHAR InCh |
Gets the horizontal distance from the origin to the left most border of the given character |
![]() ![]() |
int8 | GetCharKerning
(
TCHAR First, |
Gets the kerning value for a pair of characters |
![]() ![]() |
void | GetCharSize
(
TCHAR InCh, |
Calculate the width and height of a single character using this font's default size and scale. |
![]() |
float | Get the scaling factor | |
![]() ![]() |
FSlateFontInfo | Get the info needed to use this UFont with Slate, using the fallback data for legacy Canvas APIs | |
![]() ![]() |
float | Returns the maximum height for any character in this font using this font's default size and scale. | |
![]() ![]() |
void | GetStringHeightAndWidth
(
const FString& InString, |
Determines the height and width for the passed in string. |
![]() ![]() |
void | GetStringHeightAndWidth
(
const TCHAR* Text, |
Determines the height and width for the passed in string. |
![]() ![]() |
int32 | GetStringHeightSize
(
const TCHAR* Text |
Calculate the height of the string using this font's default size and scale. |
![]() ![]() |
int32 | GetStringSize
(
const TCHAR* Text |
Calculate the width of the string using this font's default size and scale. |
![]() ![]() |
TCHAR | RemapChar
(
TCHAR CharCode |
|
![]() |
void | SetFontScalingFactor
(
float InScalingFactor |
Set the scaling factor |
Overridden from UObject
Type | Name | Description | |
---|---|---|---|
![]() ![]() |
void | BeginDestroy () |
Called before destroying the object. |
![]() ![]() |
void | GetResourceSizeEx
(
FResourceSizeEx& CumulativeResourceSize |
Returns the size of the object/ resource for display to artists/ LDs in the Editor. |
![]() ![]() |
void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. |
![]() ![]() |
void | Handles reading, writing, and reference collecting using FArchive. |
Overridden from IFontProviderInterface
Type | Name | Description | |
---|---|---|---|
![]() ![]() ![]() |
const FCompositeFont * | IFontProviderInterface |
Constants
Name | Description |
---|---|
NULLCHARACTER | This is the character that RemapChar will return if the specified character doesn't exist in the font |