Add multiline spacing and GetTextSize to Atom Font
This commit is contained in:
@@ -150,6 +150,7 @@ struct STextDrawContext
|
||||
Vec2 m_size;
|
||||
Vec2i m_requestSize;
|
||||
float m_widthScale;
|
||||
float m_lineSpacing;
|
||||
|
||||
float m_clipX;
|
||||
float m_clipY;
|
||||
@@ -180,6 +181,7 @@ struct STextDrawContext
|
||||
, m_size(16.0f, 16.0f)
|
||||
, m_requestSize(static_cast<int32>(m_size.x), static_cast<int32>(m_size.y))
|
||||
, m_widthScale(1.0f)
|
||||
, m_lineSpacing(0.f)
|
||||
, m_clipX(0)
|
||||
, m_clipY(0)
|
||||
, m_clipWidth(0)
|
||||
@@ -214,11 +216,13 @@ struct STextDrawContext
|
||||
void SetTransform(const Matrix34& transform) { m_transform = transform; }
|
||||
void SetBaseState(int baseState) { m_baseState = baseState; }
|
||||
void SetOverrideViewProjMatrices(bool overrideViewProjMatrices) { m_overrideViewProjMatrices = overrideViewProjMatrices; }
|
||||
void SetLineSpacing(float lineSpacing) { m_lineSpacing = lineSpacing; }
|
||||
|
||||
float GetCharWidth() const { return m_size.x; }
|
||||
float GetCharHeight() const { return m_size.y; }
|
||||
float GetCharWidthScale() const { return m_widthScale; }
|
||||
int GetFlags() const { return m_drawTextFlags; }
|
||||
float GetLineSpacing() const { return m_lineSpacing; }
|
||||
|
||||
bool IsColorOverridden() const { return m_colorOverride.a != 0; }
|
||||
};
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace AzFramework
|
||||
AZ::Vector3 m_position; //! world space position for 3d draws, screen space x,y,depth for 2d.
|
||||
AZ::Color m_color = AZ::Colors::White; //! Color to draw the text
|
||||
AZ::Vector2 m_scale = AZ::Vector2(1.0f); //! font scale
|
||||
float m_lineSpacing; //! Spacing between new lines, as a percentage of m_scale.
|
||||
TextHorizontalAlignment m_hAlign = TextHorizontalAlignment::Left; //! Horizontal text alignment
|
||||
TextVerticalAlignment m_vAlign = TextVerticalAlignment::Top; //! Vertical text alignment
|
||||
bool m_monospace = false; //! disable character proportional spacing
|
||||
@@ -67,6 +68,9 @@ namespace AzFramework
|
||||
virtual void DrawScreenAlignedText3d(
|
||||
const TextDrawParameters& params,
|
||||
const AZStd::string_view& string) = 0;
|
||||
virtual AZ::Vector2 GetTextSize(
|
||||
const TextDrawParameters& params,
|
||||
const AZStd::string_view& string) = 0;
|
||||
};
|
||||
|
||||
class FontQueryInterface
|
||||
|
||||
Reference in New Issue
Block a user