Open 3D Engine AtomLyIntegration Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZ::FFont Class Reference

#include <FFont.h>

Inherits IFFont, AZStd::intrusive_refcount< AZStd::atomic_uint, FontDeleter >, and AzFramework::FontDrawInterface.

Classes

struct  FontEffect
 
struct  FontHintParams
 Simple struct used to communicate font hinting parameters to font renderer. More...
 
struct  FontRenderingPass
 
struct  FontShaderData
 

Public Types

enum class  SizeBehavior { Scale , Rerender }
 Determines how characters of different sizes should be handled during render. More...
 
enum class  HintStyle { Normal , Light }
 The hinting visual algorithm to be used (when hinting is enabled) More...
 
enum class  HintBehavior { Default , AutoHint , NoHinting }
 Chooses whether hinting info should be obtained from the font, turned off entirely, or automatically generated. More...
 
typedef std::vector< FontEffectFontEffects
 
typedef FontEffects::iterator FontEffectsIterator
 

Public Member Functions

int32_t AddRef () override
 
int32_t Release () override
 
bool Load (const char *fontFilePath, unsigned int width, unsigned int height, unsigned int widthNumSlots, unsigned int heightNumSlots, unsigned int flags, float sizeRatio) override
 
bool Load (const char *xmlFile) override
 
void Free () override
 
void DrawString (float x, float y, const char *str, const bool asciiMultiLine, const TextDrawContext &ctx) override
 
void DrawString (float x, float y, float z, const char *str, const bool asciiMultiLine, const TextDrawContext &ctx) override
 
Vec2 GetTextSize (const char *str, const bool asciiMultiLine, const TextDrawContext &ctx) override
 
size_t GetTextLength (const char *str, const bool asciiMultiLine) const override
 
void WrapText (AZStd::string &result, float maxWidth, const char *str, const TextDrawContext &ctx) override
 
void GetGradientTextureCoord (float &minU, float &minV, float &maxU, float &maxV) const override
 
unsigned int GetEffectId (const char *effectName) const override
 
unsigned int GetNumEffects () const override
 
const char * GetEffectName (unsigned int effectId) const override
 
Vec2 GetMaxEffectOffset (unsigned int effectId) const override
 
bool DoesEffectHaveTransparency (unsigned int effectId) const override
 
void AddCharsToFontTexture (const char *chars, int glyphSizeX=ICryFont::defaultGlyphSizeX, int glyphSizeY=ICryFont::defaultGlyphSizeY) override
 
Vec2 GetKerning (uint32_t leftGlyph, uint32_t rightGlyph, const TextDrawContext &ctx) const override
 
float GetAscender (const TextDrawContext &ctx) const override
 
float GetBaseline (const TextDrawContext &ctx) const override
 
float GetSizeRatio () const override
 
uint32_t GetNumQuadsForText (const char *str, const bool asciiMultiLine, const TextDrawContext &ctx) override
 
uint32_t WriteTextQuadsToBuffers (SVF_P2F_C4B_T2F_F4B *verts, uint16_t *indices, uint32_t maxQuads, float x, float y, float z, const char *str, const bool asciiMultiLine, const TextDrawContext &ctx) override
 
int GetFontTextureId () override
 
uint32_t GetFontTextureVersion () override
 
void DrawScreenAlignedText2d (const AzFramework::TextDrawParameters &params, AZStd::string_view text) override
 
void DrawScreenAlignedText3d (const AzFramework::TextDrawParameters &params, AZStd::string_view text) override
 
AZ::Vector2 GetTextSize (const AzFramework::TextDrawParameters &params, AZStd::string_view text) override
 
 FFont (AtomFont *atomFont, const char *fontName)
 
FontTextureGetFontTexture () const
 
const AZStd::string & GetName () const
 
FontEffectAddEffect (const char *effectName)
 
FontEffectGetDefaultEffect ()
 
AZ::Data::Instance< AZ::RPI::Image > GetFontImage ()
 

Detailed Description

FFont is the implementation of IFFont used to draw text with a particular font (e.g. Consolas Italic) FFont manages creation of a gpu texture to cache the font and generates draw commands that use that texture. FFont's are managed by AtomFont as either individual font instances or a font family that collects all the variations (italic, bold, bold italic, normal).

Member Enumeration Documentation

◆ HintBehavior

enum class AZ::FFont::HintBehavior
strong

Chooses whether hinting info should be obtained from the font, turned off entirely, or automatically generated.

Enumerator
Default 

Obtain hinting data from font itself.

AutoHint 

Procedurally derive hinting information from glyph.

NoHinting 

Disable hinting entirely.

◆ HintStyle

enum class AZ::FFont::HintStyle
strong

The hinting visual algorithm to be used (when hinting is enabled)

Enumerator
Normal 

Default hinting behavior provided by font renderer.

Light 

Produces fuzzier glyphs but more accurately tracks glyph shape.

◆ SizeBehavior

enum class AZ::FFont::SizeBehavior
strong

Determines how characters of different sizes should be handled during render.

Enumerator
Scale 

Default behavior; glyphs rendered at different sizes are rendered on scaled geometry.

Rerender 

Similar to Scale, but the glyph in the font texture is re-rendered to match the target size, as long as the size isn't greater than the maximum glyph/slot resolution as configured for the font texture in the font XML.


The documentation for this class was generated from the following file: