Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/SixLabors.Fonts/TextLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1490,14 +1490,14 @@ VerticalOrientationType.Rotate or
if (textLine.TrySplitAt(breakAt, keepAll, out remaining))
{
processed = breakAt.PositionWrap;
textLines.Add(textLine.Finalize(options));
textLines.Add(textLine.Finalize());
textLine = remaining;
}
}
else if (textLine.TrySplitAt(wrappingLength, out remaining))
{
processed += textLine.Count;
textLines.Add(textLine.Finalize(options));
textLines.Add(textLine.Finalize());
textLine = remaining;
}
else
Expand Down Expand Up @@ -1529,7 +1529,7 @@ VerticalOrientationType.Rotate or
}

// Add the split part to the list and continue processing.
textLines.Add(textLine.Finalize(options));
textLines.Add(textLine.Finalize());
textLine = remaining;
}
else
Expand All @@ -1551,16 +1551,24 @@ VerticalOrientationType.Rotate or
break;
}

textLines.Add(textLine.Finalize(options));
textLines.Add(textLine.Finalize());
textLine = overflow;
}
}

textLines.Add(textLine.Finalize(options));
textLines.Add(textLine.Finalize());
break;
}
}

// Finally we justify each line except the last one
// The method itself determines the justification based on the options.
for (int i = 0; i < textLines.Count - 1; i++)
{
TextLine line = textLines[i];
line.Justify(options);
Comment thread
JimBobSquarePants marked this conversation as resolved.
Outdated
}
Comment thread
JimBobSquarePants marked this conversation as resolved.
Outdated
Comment thread
JimBobSquarePants marked this conversation as resolved.
Outdated

return new TextBox(textLines);
}

Expand Down Expand Up @@ -1933,14 +1941,11 @@ private void TrimTrailingWhitespace()
}
}

public TextLine Finalize(TextOptions options)
public TextLine Finalize()
{
this.TrimTrailingWhitespace();
this.BidiReOrder();
RecalculateLineMetrics(this);

this.Justify(options);
RecalculateLineMetrics(this);
return this;
}

Expand Down Expand Up @@ -1986,6 +1991,7 @@ public void Justify(TextOptions options)
}
}

RecalculateLineMetrics(this);
return;
Comment thread
JimBobSquarePants marked this conversation as resolved.
}

Expand Down Expand Up @@ -2014,6 +2020,8 @@ public void Justify(TextOptions options)
}
}
}

RecalculateLineMetrics(this);
}
Comment thread
JimBobSquarePants marked this conversation as resolved.

public void BidiReOrder()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading