2 using System
.Collections
;
3 using System
.Collections
.Generic
;
4 using System
.Collections
.ObjectModel
;
5 using System
.Reflection
;
7 using System
.Windows
.Media
;
11 public class FontPropertyLists
13 static Collection
<FontFamily
> fontFaces
;
14 static Collection
<FontStyle
> fontStyles
;
15 static Collection
<FontWeight
> fontWeights
;
16 static Collection
<double> fontSizes
;
19 /// Return a collection of avaliable font styles
21 public static ICollection
<FontFamily
> FontFaces
25 if (fontFaces
== null) fontFaces
= new Collection
<FontFamily
>();
26 foreach (FontFamily fontFamily
in Fonts
.SystemFontFamilies
)
28 fontFaces
.Add(fontFamily
);
35 /// Return a collection of avaliable font styles
37 public static ICollection FontStyles
41 if (fontStyles
== null)
43 fontStyles
= new Collection
<FontStyle
>();
44 fontStyles
.Add(System
.Windows
.FontStyles
.Normal
);
45 fontStyles
.Add(System
.Windows
.FontStyles
.Oblique
);
46 fontStyles
.Add(System
.Windows
.FontStyles
.Italic
);
53 /// Return a collection of avaliable FontWeight
55 public static ICollection FontWeights
59 if (fontWeights
== null)
61 fontWeights
= new Collection
<FontWeight
>();
62 fontWeights
.Add(System
.Windows
.FontWeights
.Thin
);
63 fontWeights
.Add(System
.Windows
.FontWeights
.Light
);
64 fontWeights
.Add(System
.Windows
.FontWeights
.Regular
);
65 fontWeights
.Add(System
.Windows
.FontWeights
.Normal
);
66 fontWeights
.Add(System
.Windows
.FontWeights
.Medium
);
67 fontWeights
.Add(System
.Windows
.FontWeights
.Heavy
);
68 fontWeights
.Add(System
.Windows
.FontWeights
.SemiBold
);
69 fontWeights
.Add(System
.Windows
.FontWeights
.DemiBold
);
70 fontWeights
.Add(System
.Windows
.FontWeights
.Bold
);
71 fontWeights
.Add(System
.Windows
.FontWeights
.Black
);
72 fontWeights
.Add(System
.Windows
.FontWeights
.ExtraLight
);
73 fontWeights
.Add(System
.Windows
.FontWeights
.ExtraBold
);
74 fontWeights
.Add(System
.Windows
.FontWeights
.ExtraBlack
);
75 fontWeights
.Add(System
.Windows
.FontWeights
.UltraLight
);
76 fontWeights
.Add(System
.Windows
.FontWeights
.UltraBold
);
77 fontWeights
.Add(System
.Windows
.FontWeights
.UltraBlack
);
84 /// Return a collection of font sizes.
86 public static Collection
<double> FontSizes
90 if (fontSizes
== null)
92 fontSizes
= new Collection
<double>();
93 for (double i
= 8; i
<= 40; i
++) fontSizes
.Add(i
);
99 public static bool CanParseFontStyle(string fontStyleName
)
103 FontStyleConverter converter
= new FontStyleConverter();
104 converter
.ConvertFromString(fontStyleName
);
112 public static FontStyle
ParseFontStyle(string fontStyleName
)
114 FontStyleConverter converter
= new FontStyleConverter();
115 return (FontStyle
)converter
.ConvertFromString(fontStyleName
);
117 public static bool CanParseFontWeight(string fontWeightName
)
121 FontWeightConverter converter
= new FontWeightConverter();
122 converter
.ConvertFromString(fontWeightName
);
130 public static FontWeight
ParseFontWeight(string fontWeightName
)
132 FontWeightConverter converter
= new FontWeightConverter();
133 return (FontWeight
)converter
.ConvertFromString(fontWeightName
);