using System.Drawing;

namespace PinyinModel
{
	internal static class View
	{
        const int font_size_min = 11;
		private static Font default_font = null;
		
		public static Font GetFont()
		{
			if (default_font == null)
			{
				string [] fonts = {"MingLan", "MingLiU", "Simsun", "WenQuanYi Micro Hei", "WenQuanYi Zen Hei", SystemFonts.DefaultFont.Name};
				foreach (string font_name in fonts)
				{
					default_font = new Font(font_name, SystemFonts.DefaultFont.Size, SystemFonts.DefaultFont.Unit);
                    if (default_font.Name != SystemFonts.DefaultFont.Name && default_font.Name != FontFamily.GenericSansSerif.Name)
						break;
				}
                if (default_font.SizeInPoints < font_size_min)
                    default_font = new Font(default_font.Name, font_size_min, GraphicsUnit.Point);
				System.GC.Collect();
			}
			return default_font;
		}
	}
}

