title: .NET PrivateFontCollection - load fonts of different styles
body: <p>I'm trying to port an application from traditional ASP.NET to Azure and I'm running into a font issue. There's a component that renders images with text drawn on it in a particular non-standard font (Lets call the font "Water").</p>
  
  <p>Water exists as several different TTF files which each represent a different style. I have 12 different TTF files in total, covering styles such as "Water Black Italic", "Water Light", "Water Regular", "Water Ultralight" etc.</p>
  
  <p>On ASP.NET, it was a simple case of installing the fonts in the Windows dir and then from the code calling: </p>
  
  <pre><code>Font _fontMedium = new Font("Water Medium", iFontMedium, FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
  </code></pre>
  
  <p>However, on Azure, you can't install your own fonts. Therefore, in order to be able to draw these fonts on an image, I need to upload the font files as content with the application, and use the PrivateFontCollection class to load them individually.</p>
  
  <p>My current code is this:</p>
  
  <pre><code>        PrivateFontCollection fontcollection = new PrivateFontCollection();
          string fontpath = string.Concat(System.Web.HttpContext.Current.Request.PhysicalApplicationPath + "assets\\");
          fontcollection.AddFontFile(string.Concat(fontpath,"water-bold-webfont.ttf"));
          fontcollection.AddFontFile(string.Concat(fontpath, "water-ultralight-webfont.ttf"));
          fontcollection.AddFontFile(string.Concat(fontpath, "water-medium-webfont.ttf"));
          FontFamily[] privatefontfamilies = fontcollection.Families;
  
  
          Font _fontMedium = new Font("Water Medium", iFontMedium, FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
          Font _fontSmall = new Font("Water UltraLight", iFontSmall, System.Drawing.GraphicsUnit.Pixel);
          Font _fontMini = new Font("Water Bold", iFontMini, System.Drawing.GraphicsUnit.Pixel);
  </code></pre>
  
  <p>The problem I have is that after breaking after the font files have been added, there is only one Family in the fontcollection.Families collection: "Water".</p>
  
  <p>Similarly, after the font objects have been declared, the Family defaults to a Microsoft Sans-Serif. If I instead use:</p>
  
  <pre><code>Font _fontMedium = new Font("Water", iFontMedium, FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
  </code></pre>
  
  <p>The font loads with the "Water" family, but doesn't seem to give me the ability to select the style properly. My only options for the font style are those defined in the FontStyle enum, which don't cover all the font styles that I'm trying to load.</p>
  
  <p>In short, given a particular font and all of its available styles loaded in separate TTF files, how would you load them into a PrivateFontCollection and use them individually?</p>