Exemple #1
0
 private Font GetFont(string name, int height)
 {
     lock (fonts)
     {
         Font font;
         Tuple<string, int> key = Tuple.Create(name, height);
         if (fonts.TryGetValue(key, out font)) return font;
         font = new Font(device, new FontDescription
         {
             MipLevels = 1,
             Height = height,
             FaceName = name,
             OutputPrecision = FontPrecision.Default,
             Quality = FontQuality.ClearType
         });
         font.PreloadText(name);
         fonts.Add(key, font);
         return font;
     }
 }