diff options
author | Vsevolod Kukol <sevoku@microsoft.com> | 2016-12-09 11:02:37 +0300 |
---|---|---|
committer | Vsevolod Kukol <sevoku@microsoft.com> | 2016-12-09 11:14:14 +0300 |
commit | f9f35bfd3d8f09854cab487e55ca4d243a381ee0 (patch) | |
tree | d898a47a9c553309a5da87ad49f7475ee48b30d6 /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts | |
parent | a7d72db175d99e76dca4a2c919fcacbe32bab5d5 (diff) |
[Ide] Show Recent Templates in the New Project Dialog
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs | 23 |
1 files changed, 23 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 100c7cd3f6..065d73e1f6 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs @@ -232,6 +232,17 @@ namespace MonoDevelop.Ide.Fonts return font; } + public static FontDescription CopyModified (this FontDescription font, int absoluteResize, Pango.Weight? weight = null) + { + font = font.Copy (); + + ResizeAbsolute (font, absoluteResize); + + if (weight.HasValue) + font.Weight = weight.Value; + + return font; + } static void Scale (FontDescription font, double scale) { @@ -244,5 +255,17 @@ namespace MonoDevelop.Ide.Fonts font.Size = (int)(Pango.Scale.PangoScale * (int)(scale * size / Pango.Scale.PangoScale)); } } + + static void ResizeAbsolute (FontDescription font, int pt) + { + if (font.SizeIsAbsolute) { + font.AbsoluteSize = font.Size + pt; + } else { + var size = font.Size; + if (size == 0) + size = (int)((10 + pt) * Pango.Scale.PangoScale); + font.Size = (int)(Pango.Scale.PangoScale * (int)(pt + size / Pango.Scale.PangoScale)); + } + } } } |