diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f834c2..4377e54 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -50,6 +50,7 @@ Fixes ### MLEM.Extended Improvements - Updated to FontStashSharp 1.3.0's API +- Expose character and line spacing in GenericStashFont ### MLEM.Data Fixes diff --git a/MLEM.Extended/Font/GenericStashFont.cs b/MLEM.Extended/Font/GenericStashFont.cs index f9a5b74..961e13e 100644 --- a/MLEM.Extended/Font/GenericStashFont.cs +++ b/MLEM.Extended/Font/GenericStashFont.cs @@ -11,6 +11,7 @@ namespace MLEM.Extended.Font { /// The that is being wrapped by this generic font /// public readonly SpriteFontBase Font; + /// public override GenericFont Bold { get; } /// @@ -18,6 +19,15 @@ namespace MLEM.Extended.Font { /// public override float LineHeight => this.Font.LineHeight; + /// + /// The character spacing that will be passed to the underlying . + /// + public float CharacterSpacing { get; set; } + /// + /// The line spacing that will be passed to the underlying . + /// + public float LineSpacing { get; set; } + /// /// Creates a new generic font using . /// Optionally, a bold and italic version of the font can be supplied. @@ -33,12 +43,12 @@ namespace MLEM.Extended.Font { /// protected override float MeasureCharacter(int codePoint) { - return this.Font.MeasureString(CodePointSource.ToString(codePoint)).X; + return this.Font.MeasureString(CodePointSource.ToString(codePoint), null, this.CharacterSpacing, this.LineSpacing).X; } /// protected override void DrawCharacter(SpriteBatch batch, int codePoint, string character, Vector2 position, Color color, float rotation, Vector2 scale, SpriteEffects effects, float layerDepth) { - this.Font.DrawText(batch, character, position, color, rotation, Vector2.Zero, scale, layerDepth); + this.Font.DrawText(batch, character, position, color, rotation, Vector2.Zero, scale, layerDepth, this.CharacterSpacing, this.LineSpacing); } }