示例#1
0
 /**
  * try to find a font in the list that matches the contents
  * of the formating context
  */
 private IFontHandle FindFont(float height, bool italic, int weight, string fontName)
 {
     for (int i = 0; i < fonts.Count; i++)
     {
         WeakReference w = (WeakReference)fonts[i];
         if (w.IsAlive)
         {
             IFontHandle f = (IFontHandle)w.Target;
             if (f.Equals(height, italic, weight, fontName))
             {
                 return(f);
             }
         }
         else
         {
             // reference is dead, so get rid of it
             fonts.RemoveAt(i--);
         }
     }
     // no font was found
     return(null);
 }