1
0
Fork 0
mirror of https://github.com/Ellpeck/MLEM.git synced 2024-06-16 10:44:32 +02:00

fixed DrawString in generic font ignoring text scale for alignment

This commit is contained in:
Ell 2021-03-12 20:47:57 +01:00
parent 0ddb4afc3f
commit 37609ade76

View file

@ -83,13 +83,13 @@ namespace MLEM.Font {
switch (align) { switch (align) {
case TextAlign.Center: case TextAlign.Center:
case TextAlign.CenterBothAxes: case TextAlign.CenterBothAxes:
var (w, h) = this.MeasureString(text); var (w, h) = this.MeasureString(text) * scale;
position.X -= w / 2; position.X -= w / 2;
if (align == TextAlign.CenterBothAxes) if (align == TextAlign.CenterBothAxes)
position.Y -= h / 2; position.Y -= h / 2;
break; break;
case TextAlign.Right: case TextAlign.Right:
position.X -= this.MeasureString(text).X; position.X -= this.MeasureString(text).X * scale.X;
break; break;
} }
this.DrawString(batch, text, position, color, rotation, origin, scale, effects, layerDepth); this.DrawString(batch, text, position, color, rotation, origin, scale, effects, layerDepth);