Skip to content

Commit

Permalink
fixes #1330
Browse files Browse the repository at this point in the history
  • Loading branch information
beto-rodriguez committed Oct 27, 2023
1 parent 085f35a commit fddf777
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,9 @@ private IEnumerable<string> 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();
Expand Down

0 comments on commit fddf777

Please sign in to comment.