public override void Arrange() { if (!EnsureLayout ()) { return; } UpdateLayout (GetText (), RenderSize.Width, RenderSize.Height, true); int text_width, text_height; layout.GetPixelSize (out text_width, out text_height); Rect new_alloc = new Rect ( Math.Round ((RenderSize.Width - text_width) * HorizontalAlignment), Math.Round ((RenderSize.Height - text_height) * VerticalAlignment), text_width, text_height); if (text_alloc.IsEmpty) { InvalidateRender (text_alloc); } else { invalidation_rect = text_alloc; invalidation_rect.Union (new_alloc); // Some padding, likely because of the pen size for // showing the actual text layout in the render pass invalidation_rect.X -= 2; invalidation_rect.Y -= 2; invalidation_rect.Width += 4; invalidation_rect.Height += 4; InvalidateRender (invalidation_rect); } text_alloc = new_alloc; }
public override void Arrange() { if (!EnsureLayout ()) { return; } int layout_width = TextWrap == TextWrap.None ? -1 : (int)(Pango.Scale.PangoScale * ContentAllocation.Width); if (layout.Width != layout_width) { layout.Width = layout_width; } int text_width, text_height; layout.GetPixelSize (out text_width, out text_height); Rect new_alloc = new Rect ( Math.Round ((RenderSize.Width - text_width) * HorizontalAlignment), Math.Round ((RenderSize.Height - text_height) * VerticalAlignment), text_width, text_height); if (text_alloc.IsEmpty) { InvalidateRender (text_alloc); } else { invalidation_rect = text_alloc; invalidation_rect.Union (new_alloc); // Some padding, likely because of the pen size for // showing the actual text layout in the render pass invalidation_rect.X -= 2; invalidation_rect.Y -= 2; invalidation_rect.Width += 4; invalidation_rect.Height += 4; InvalidateRender (invalidation_rect); } text_alloc = new_alloc; }