// Copyright (c) Wojciech Figat. All rights reserved. #pragma once #include "Engine/Core/Math/Vector2.h" // Font glyph metrics: // // xmin xmax // | | // |<-------- width -------->| // | | // | +-------------------------+----------------- ymax // | | ggggggggg ggggg | ^ ^ // | | g:::::::::ggg::::g | | | // | | g:::::::::::::::::g | | | // | | g::::::ggggg::::::gg | | | // | | g:::::g g:::::g | | | // offsetX -|-------->| g:::::g g:::::g | offsetY | // | | g:::::g g:::::g | | | // | | g::::::g g:::::g | | | // | | g:::::::ggggg:::::g | | | // | | g::::::::::::::::g | | height // | | gg::::::::::::::g | | | // baseline ---*---------|---- gggggggg::::::g-----*-------- | // / | | g:::::g | | // origin | | gggggg g:::::g | | // | | g:::::gg gg:::::g | | // | | g::::::ggg:::::::g | | // | | gg:::::::::::::g | | // | | ggg::::::ggg | | // | | gggggg | v // | +-------------------------+----------------- ymin // | | // |------------- advanceX ----------->| /// /// The cached font character entry (read for rendering and further processing). /// API_STRUCT(NoDefault) struct FLAXENGINE_API FontCharacterEntry { DECLARE_SCRIPTING_TYPE_MINIMAL(FontCharacterEntry); /// /// The character represented by this entry. /// API_FIELD() Char Character; /// /// True if entry is valid, otherwise false. /// API_FIELD() bool IsValid = false; /// /// The index to a specific texture in the font cache. /// API_FIELD() byte TextureIndex; /// /// The left bearing expressed in integer pixels. /// API_FIELD() int16 OffsetX; /// /// The top bearing expressed in integer pixels. /// API_FIELD() int16 OffsetY; /// /// The amount to advance in X before drawing the next character in a string. /// API_FIELD() int16 AdvanceX; /// /// The distance from baseline to glyph top most point. /// API_FIELD() int16 BearingY; /// /// The height in pixels of the glyph. /// API_FIELD() int16 Height; /// /// The start location of the character in the texture (in texture coordinates space). /// API_FIELD() Float2 UV; /// /// The size the character in the texture (in texture coordinates space). /// API_FIELD() Float2 UVSize; /// /// The slot in texture atlas, containing the pixel data of the glyph. /// API_FIELD() const struct FontTextureAtlasSlot* Slot; /// /// The owner font. /// API_FIELD() const class Font* Font; }; template<> struct TIsPODType { enum { Value = true }; };