private void OnTextViewSizeRequested(object o, SizeRequestedArgs args) { Pango.FontMetrics metrics = PangoContext.GetMetrics(entry.Style.FontDescription, PangoContext.Language); int line_height = ((int)(metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d) metrics.Dispose(); HeightRequest = (line_height + 2) * 2; }
protected override void OnSizeRequested(ref Gtk.Requisition requisition) { EnsureStyle(); Pango.FontMetrics metrics = PangoContext.GetMetrics(Style.FontDescription, PangoContext.Language); renderer.Size = ((int)(metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d) metrics.Dispose(); if (HasFrame) { renderer.Xpad = Style.Xthickness + (interior_focus ? focus_width : 0) + 2; renderer.Ypad = Style.Ythickness + (interior_focus ? focus_width : 0) + 2; } else { renderer.Xpad = 0; renderer.Ypad = 0; } requisition.Width = renderer.Width; requisition.Height = renderer.Height; }
protected Requisition SizeRequested() { var requisition = new Requisition(); Pango.FontMetrics metrics = PangoContext.GetMetrics(StyleContext.GetFont(StateFlags), PangoContext.Language); renderer.Size = ((int)(metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d) metrics.Dispose(); if (HasFrame) { renderer.Xpad = MarginLeft + (interior_focus ? focus_width : 0) + 2; renderer.Ypad = MarginTop + (interior_focus ? focus_width : 0) + 2; } else { renderer.Xpad = 0; renderer.Ypad = 0; } requisition.Width = renderer.Width; requisition.Height = renderer.Height; return(requisition); }