Advertisement
tolikpunkoff

GlobalFontCollection

Mar 16th, 2018
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1.     public static class GlobalFontCollection
  2.     {
  3.         public static PrivateFontCollection PFCollection = new PrivateFontCollection();
  4.         private static Dictionary<string, int> FontsFiles = new Dictionary<string, int>();
  5.  
  6.         public static void AddFont(string FileName)
  7.         {
  8.             if (FontsFiles.ContainsKey(FileName)) return;
  9.  
  10.             PFCollection.AddFontFile(FileName);
  11.             FontsFiles.Add(FileName, PFCollection.Families.Length - 1);
  12.         }
  13.         public static int GetIndex(string FileName)
  14.         {
  15.             if (!FontsFiles.ContainsKey(FileName)) return -1;
  16.             return FontsFiles[FileName];
  17.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement