Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly handle overhang with RTL FlowDirection #13631

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 5 additions & 4 deletions src/Avalonia.Base/Media/TextFormatting/TextLineImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,8 +1299,6 @@ private TextLineMetrics CreateLineMetrics()
}
}

var overhangAfter = Math.Max(0, bounds.Bottom - height);

var width = widthIncludingWhitespace;

for (var i = _textRuns.Length - 1; i >= 0; i--)
Expand All @@ -1327,9 +1325,10 @@ private TextLineMetrics CreateLineMetrics()
}
}

var start = GetParagraphOffsetX(width, widthIncludingWhitespace);
//The width of overhanging pixels ath the bottom
var overhangAfter = Math.Max(0, bounds.Bottom - height);
//The width of overhanging pixels at the origin
var overhangLeading = Math.Max(0, start - bounds.Left);
var overhangLeading = bounds.Left;
//The width of overhanging pixels at the end
var overhangTrailing = Math.Max(0, bounds.Width - widthIncludingWhitespace);
var hasOverflowed = width > _paragraphWidth;
Expand All @@ -1339,6 +1338,8 @@ private TextLineMetrics CreateLineMetrics()
height = lineHeight;
}

var start = GetParagraphOffsetX(width, widthIncludingWhitespace);

return new TextLineMetrics
{
HasOverflowed = hasOverflowed,
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