DrawString implementation
[mono.git] / mcs / class / System.Drawing / System.Drawing / FontFamily.cs
1 //
2 // System.Drawing.FontFamily.cs
3 //
4 // Author:
5 //   Dennis Hayes (dennish@Raytek.com)
6 //   Alexandre Pigolkine (pigolkine@gmx.de)
7 //
8 // (C) 2002/2003 Ximian, Inc
9 //
10 using System;
11 using System.Drawing.Text;
12
13 namespace System.Drawing {
14         /// <summary>
15         /// Summary description for FontFamily.
16         /// </summary>
17         public class FontFamily : MarshalByRefObject, IDisposable {
18                 internal IFontFamily implementation_;
19                 internal static IFontFamilyFactory factory_ = Factories.GetFontFamilyFactory();
20                 
21                 static FontFamily genericMonospace;
22                 static FontFamily genericSansSerif;
23                 static FontFamily genericSerif;
24
25                 string name;
26                 
27                 public FontFamily(GenericFontFamilies genericFamily) {
28                         implementation_ = factory_.FontFamily(genericFamily);
29                 }
30                 
31                 public FontFamily(string familyName) {
32                         name = familyName;
33                         implementation_ = factory_.FontFamily(familyName);
34                 }
35                 
36                 public FontFamily(string familyName, FontCollection collection) {
37                         name = familyName;
38                         implementation_ = factory_.FontFamily(familyName, collection);
39                 }
40                 
41                 public string Name {
42                         get {
43                                 return name;
44                         }
45                 }
46                 
47                 public static FontFamily GenericMonospace {
48                         get {
49                                 if( genericMonospace == null) {
50                                         genericMonospace = new FontFamily(GenericFontFamilies.Monospace);
51                                 }
52                                 return genericMonospace;
53                         }
54                 }
55                 
56                 public static FontFamily GenericSansSerif {
57                         get {
58                                 if( genericSansSerif == null) {
59                                         genericSansSerif = new FontFamily(GenericFontFamilies.SansSerif);
60                                 }
61                                 return genericSansSerif;
62                         }
63                 }
64                 
65                 public static FontFamily GenericSerif {
66                         get {
67                                 if( genericSerif == null) {
68                                         genericSerif = new FontFamily(GenericFontFamilies.Serif);
69                                 }
70                                 return genericSerif;
71                         }
72                 }
73                 
74                 public int GetCellAscent (FontStyle style) {
75                         return implementation_.GetCellAscent(style);
76                 }
77                 
78                 public int GetCellDescent (FontStyle style) {
79                         return implementation_.GetCellDescent(style);
80                 }
81                 
82                 public int GetEmHeight (FontStyle style) {
83                         return implementation_.GetEmHeight(style);
84                 }
85                 
86                 public int GetLineSpacing (FontStyle style) {
87                         return implementation_.GetLineSpacing(style);
88                 }
89                 
90                 public bool IsStyleAvailable (FontStyle style){
91                         return implementation_.IsStyleAvailable(style);
92                 }
93                 
94                 public void Dispose() {
95                         implementation_.Dispose();
96                 }
97         }
98 }