diff --git a/HellionChat/Ui/StyleEngine/TypeScaleMath.cs b/HellionChat/Ui/StyleEngine/TypeScaleMath.cs new file mode 100644 index 0000000..79a6fb4 --- /dev/null +++ b/HellionChat/Ui/StyleEngine/TypeScaleMath.cs @@ -0,0 +1,13 @@ +namespace HellionChat.Ui.StyleEngine; + +// TEST-MIRROR: Ui/TypeScaleMathTests.cs +// +// Rounds to quarter points rather than whole ones. The base size itself is +// 12.75pt, so whole-point rounding would move a role by more than the step +// between two adjacent base sizes -- the scale would quantise away the very +// difference it exists to express. +internal static class TypeScaleMath +{ + internal static float Resolve(float basePt, float factor, float minPt) => + MathF.Max(minPt, MathF.Round(basePt * factor * 4f) / 4f); +}