diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2017-03-07 18:00:05 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2017-03-09 13:30:38 +0300 |
commit | cf5f778093cf1c6f5d4fef9b9496a906b2166d53 (patch) | |
tree | 9bc6c9442e18fa2c7f66d3c093e3709c3f9ccbd5 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts | |
parent | 4e3c7f87c341c7c40a7255356232a3d6e15076a0 (diff) |
[Ide] Add XwtPopup and XwtThemedPopup
The new popup windows will replace the
Gtk based PopoverWindow with a cross-toolkit
approach.
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs index 065d73e1f6..815c4360c5 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs @@ -267,5 +267,26 @@ namespace MonoDevelop.Ide.Fonts font.Size = (int)(Pango.Scale.PangoScale * (int)(pt + size / Pango.Scale.PangoScale)); } } + + public static FontDescription ToPangoFont (this Xwt.Drawing.Font font) + { + var backend = Xwt.Toolkit.GetBackend (font) as FontDescription; + if (backend != null) + return backend.Copy (); + return FontDescription.FromString (font.ToString ()); + } + + public static Xwt.Drawing.Font ToXwtFont (this FontDescription font) + { + return font.ToXwtFont (null); + } + + public static Xwt.Drawing.Font ToXwtFont (this FontDescription font, Xwt.Toolkit withToolkit) + { + var toolkit = withToolkit ?? Xwt.Toolkit.CurrentEngine; + Xwt.Drawing.Font xwtFont = null; + toolkit.Invoke (() => xwtFont = Xwt.Drawing.Font.FromName (font.ToString ())); + return xwtFont; + } } } |