2 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
4 // Permission is hereby granted, free of charge, to any person obtaining
5 // a copy of this software and associated documentation files (the
6 // "Software"), to deal in the Software without restriction, including
7 // without limitation the rights to use, copy, modify, merge, publish,
8 // distribute, sublicense, and/or sell copies of the Software, and to
9 // permit persons to whom the Software is furnished to do so, subject to
10 // the following conditions:
12 // The above copyright notice and this permission notice shall be
13 // included in all copies or substantial portions of the Software.
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 // Jordi Mas i Hernandez <jordimash@gmail.com>
32 using System.Runtime.Serialization;
33 using System.Runtime.InteropServices;
34 using System.ComponentModel;
36 namespace System.Drawing
38 public sealed class SystemFonts
\r
40 private static Font caption = null;
41 private static Font defaultfnt = null;
\r
42 private static Font dialog = null;
\r
43 private static Font icon = null;
\r
44 private static Font menu = null;
\r
45 private static Font message = null;
\r
46 private static Font smallcaption = null;
\r
47 private static Font status = null;
59 public static Font GetFontByName (string name)
61 if (name == "CaptionFont")
64 if (name == "DefaultFont")
67 if (name == "DialogFont")
70 if (name == "IconTitleFont")
73 if (name == "MenuFont")
76 if (name == "MessageBoxFont")
77 return MessageBoxFont;
79 if (name == "SmallCaptionFont")
80 return SmallCaptionFont;
82 if (name == "StatusFont")
88 public static Font CaptionFont {
90 if (caption == null) {
91 caption = new Font ("Microsoft Sans Serif", 11);
92 caption.SysFontName = "CaptionFont";
98 public static Font DefaultFont {
100 if (defaultfnt == null) {
101 defaultfnt = new Font ("Microsoft Sans Serif", 8.25f);
102 defaultfnt.SysFontName = "DefaultFont";
108 public static Font DialogFont {
110 if (dialog == null) {
111 dialog = new Font ("Tahoma", 8);
112 dialog.SysFontName = "DialogFont";
118 public static Font IconTitleFont {
121 icon = new Font ("Microsoft Sans Serif", 11);
122 icon.SysFontName = "IconTitleFont";
128 public static Font MenuFont {
131 menu = new Font ("Microsoft Sans Serif", 11);
132 menu.SysFontName = "MenuFont";
138 public static Font MessageBoxFont {
140 if (message == null) {
141 message = new Font ("Microsoft Sans Serif", 11);
142 message.SysFontName = "MessageBoxFont";
148 public static Font SmallCaptionFont {
150 if (smallcaption == null) {
151 smallcaption = new Font ("Microsoft Sans Serif", 11);
152 smallcaption.SysFontName = "SmallCaptionFont";
158 public static Font StatusFont {
160 if (status == null) {
161 status = new Font ("Microsoft Sans Serif", 11);
162 status.SysFontName = "StatusFont";