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 OnGetPreferredHeight(out int minimum_height, out int natural_height) { int line_height; using (Pango.FontMetrics metrics = PangoContext.GetMetrics( entry.StyleContext.GetFont(StateFlags.Normal), PangoContext.Language)) { line_height = ((metrics.Ascent + metrics.Descent) + 512) >> 10; // PANGO_PIXELS(d) } minimum_height = natural_height = (line_height + 2) * 2; }
RefactoringPreviewTooltipWindow(Ide.Editor.TextEditor editor, CodeAction codeAction) { this.editor = editor; this.documentContext = documentContext = editor.DocumentContext; this.codeAction = codeAction; TransientFor = IdeApp.Workbench.RootWindow; fontDescription = Pango.FontDescription.FromString(DefaultSourceEditorOptions.Instance.FontName); fontDescription.Size = (int)(fontDescription.Size * 0.8f); using (var metrics = PangoContext.GetMetrics(fontDescription, PangoContext.Language)) { lineHeight = (int)Math.Ceiling(0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale); } }
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; }
RefactoringPreviewTooltipWindow(Ide.Editor.TextEditor editor, CodeAction codeAction) { this.editor = editor; this.documentContext = documentContext = editor.DocumentContext; this.codeAction = codeAction; TransientFor = IdeApp.Workbench.RootWindow; var font = Xwt.Drawing.Font.FromName(DefaultSourceEditorOptions.Instance.FontName); if (font != null) { fontDescription = font.ToPangoFont(); fontDescription.Size = (int)(fontDescription.Size * 0.8f); } else { LoggingService.LogError("Error loading font : " + DefaultSourceEditorOptions.Instance.FontName); } using (var metrics = PangoContext.GetMetrics(fontDescription, PangoContext.Language)) { lineHeight = (int)Math.Ceiling(0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale); } }
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); }