i stg if smth goes wrong

This commit is contained in:
XTigerHyperX 2020-10-11 18:34:10 +01:00
parent 68d4636907
commit cc0b094ad2
3 changed files with 20 additions and 6 deletions

View File

@ -204,14 +204,16 @@ namespace FModel.Creator.Bases
break;
}
}
if (text.Any(char.IsDigit))
//only trigger the fix if The Last char is a digit
if (char.IsDigit(text[text.Length - 1]))
{
int s = text.Count(k => Char.IsDigit(k));
float numberwidth = paint.MeasureText(text.Substring(text.Length - s));
//Draw Number Separately
c.DrawShapedText(shaper, text.Substring(text.Length - s), x, 155, paint);
c.DrawShapedText(shaper, text.Substring(0, text.Length - s), x + 60, 155, paint);
c.DrawShapedText(shaper, text.Substring(0, text.Length - s), x + numberwidth, 155, paint);
}
else
{

View File

@ -96,18 +96,18 @@ namespace FModel.Creator.Bundles
break;
}
}
if (text.Any(char.IsDigit))
if (char.IsDigit(text[text.Length - 1]))
{
int s = text.Count(k => Char.IsDigit(k));
float numberwidth = paint.MeasureText(text.Substring(text.Length - s));
c.DrawShapedText(shaper, text.Substring(text.Length - s), x, 155, paint);
c.DrawShapedText(shaper, text.Substring(0, text.Length - s), x + 60, 155, paint);
c.DrawShapedText(shaper, text.Substring(0, text.Length - s), x + numberwidth, 155, paint);
}
else
{
//feels bad man
c.DrawShapedText(shaper, text, x, 155, paint);
}
}
else

View File

@ -2,6 +2,8 @@
using FModel.Creator.Texts;
using SkiaSharp;
using SkiaSharp.HarfBuzz;
using System;
using System.Linq;
namespace FModel.Creator.Bundles
{
@ -50,8 +52,18 @@ namespace FModel.Creator.Bundles
break;
}
}
if (char.IsDigit(q.Description[q.Description.Length - 1]))
{
int s = q.Description.Count(k => Char.IsDigit(k));
c.DrawShapedText(shaper, q.Description.Substring(q.Description.Length - s), 65, y + paint.TextSize + 11, paint);
c.DrawShapedText(shaper, q.Description, 65, y + paint.TextSize + 11, paint);
c.DrawShapedText(shaper, q.Description.Substring(0, q.Description.Length - s), 115, y + paint.TextSize + 11, paint);
}
else
{
c.DrawShapedText(shaper, q.Description, 65, y + paint.TextSize + 11, paint);
}
}
else
{