Skip to content

Commit

Permalink
Consider text margin while measuring it
Browse files Browse the repository at this point in the history
  • Loading branch information
FrayxRulez committed Oct 29, 2020
1 parent c50f7d2 commit c7faabf
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Unigram/Unigram/Controls/Messages/MessageBubblePanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ private Rect ContentEnd(Vector2 size)
}

var text = Children[0] as RichTextBlock;
var width = size.X - (float)text.Margin.Left - (float)text.Margin.Right;

using (CanvasTextFormat format = new CanvasTextFormat { FontFamily = "Assets\\Emoji\\apple.ttf#Segoe UI Emoji", FontSize = (float)text.FontSize })
using (CanvasTextLayout textLayout = new CanvasTextLayout(CanvasDevice.GetSharedDevice(), caption.Text, format, size.X, size.Y))
using (CanvasTextLayout textLayout = new CanvasTextLayout(CanvasDevice.GetSharedDevice(), caption.Text, format, width, size.Y))
{
foreach (var entity in caption.Entities)
{
Expand Down

0 comments on commit c7faabf

Please sign in to comment.