From fddf777f93eceb9cb7675b588a8d9cfa5e793046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberto=20Rodr=C3=ADguez?= Date: Fri, 27 Oct 2023 13:01:30 -0600 Subject: [PATCH] fixes #1330 --- .../Drawing/Geometries/LabelGeometry.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs index 350eef609..66769135d 100644 --- a/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs +++ b/src/skiasharp/LiveChartsCore.SkiaSharp/Drawing/Geometries/LabelGeometry.cs @@ -263,7 +263,9 @@ private IEnumerable GetLinesByMaxWidth(string source, SKPaint paint) _ = sb2.Append(word); _ = paint.MeasureText(sb2.ToString(), ref bounds); - if (bounds.Width > mw) + // if the line has already content and the new word exceeds the max width + // then we create a new line + if (sb.Length > 0 && bounds.Width > mw) { yield return sb.ToString(); _ = sb.Clear();