Nexus.UI.FontSet.CreateFont C# (CSharp) Method

CreateFont() public method

Used to create the font with the style and size requested.
public CreateFont ( FontStyle p_fstStyle, float p_fltSize ) : Font
p_fstStyle FontStyle The style of font to create.
p_fltSize float The size of font to create.
return System.Drawing.Font
		public Font CreateFont(FontStyle p_fstStyle, float p_fltSize)
		{
			if (m_dicFamilyCache.ContainsKey(p_fstStyle))
				return new Font(m_dicFamilyCache[p_fstStyle], p_fltSize, p_fstStyle);

			Font fntFont = null;
			foreach (string strFontFamily in Families)
			{
				try
				{
					fntFont = FontManager.GetFont(strFontFamily, p_fltSize, p_fstStyle);
					if (fntFont == null)
						fntFont = new Font(strFontFamily, p_fltSize, p_fstStyle);
				}
				catch
				{
					//the font doesn't work for some reason - keep looking
				}
				if (fntFont != null)
				{
					m_dicFamilyCache[p_fstStyle] = fntFont.FontFamily;
					return fntFont;
				}
			}
			return null;
		}