diff options
author | Lluis Sanchez <lluis@xamarin.com> | 2012-09-11 17:25:00 +0400 |
---|---|---|
committer | Lluis Sanchez <lluis@xamarin.com> | 2012-09-11 17:25:00 +0400 |
commit | 70906cfac69152c72d0c8dd8595d2f2e2816d8ff (patch) | |
tree | 33d04e46b5242ad5331534ffffe9e025a7b3d05e /main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts | |
parent | 47b8c3a8d42917a46b5e3278da449164a4553b55 (diff) |
[Ide] Moved pad font preferences to the fonts options panel
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts')
-rw-r--r-- | main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs | 31 |
1 files changed, 26 insertions, 5 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 a60620eb39..96bfb87e3e 100644 --- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs +++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Fonts/FontService.cs @@ -38,8 +38,9 @@ namespace MonoDevelop.Ide.Fonts static List<FontDescriptionCodon> fontDescriptions = new List<FontDescriptionCodon> (); static Dictionary<string, FontDescription> loadedFonts = new Dictionary<string, FontDescription> (); static Properties fontProperties; + static FontDescription defaultMonospaceFontDescription; - public static IEnumerable<FontDescriptionCodon> FontDescriptions { + internal static IEnumerable<FontDescriptionCodon> FontDescriptions { get { return fontDescriptions; } @@ -63,7 +64,15 @@ namespace MonoDevelop.Ide.Fonts } }); } - + + public static FontDescription DefaultMonospaceFontDescription { + get { + if (defaultMonospaceFontDescription == null) + defaultMonospaceFontDescription = LoadFont (DesktopService.DefaultMonospaceFont); + return defaultMonospaceFontDescription; + } + } + static FontDescription LoadFont (string name) { return Pango.FontDescription.FromString (FilterFontName (name)); @@ -95,15 +104,27 @@ namespace MonoDevelop.Ide.Fonts } return result; } - - public static FontDescription GetFontDescription (string name) + + /// <summary> + /// Gets the font description for the provided font id + /// </summary> + /// <returns> + /// The font description. + /// </returns> + /// <param name='name'> + /// Identifier of the font + /// </param> + /// <param name='createDefaultFont'> + /// If set to <c>false</c> and no custom font has been set, the method will return null. + /// </param> + public static FontDescription GetFontDescription (string name, bool createDefaultFont = true) { if (loadedFonts.ContainsKey (name)) return loadedFonts [name]; return loadedFonts [name] = LoadFont (GetUnderlyingFontName (name)); } - public static FontDescriptionCodon GetFont (string name) + internal static FontDescriptionCodon GetFont (string name) { foreach (var d in fontDescriptions) { if (d.Name == name) |