title: Embedded font does not support style 'Regular' in Windows 7 but OK in Windows 10
body: <p>I use some embedded fonts in my .Net 4.5 software. Everything is OK when I run software on Windows 10 but when I tried to test the software on Windows 7 virtual machine, it threw this exception:</p>
  <blockquote>
  <p>Font 'B Koodak' does not support style 'Regular'.</p>
  </blockquote>
  <p>Here is how I load embedded fonts from resources:</p>
  <pre class="lang-cs prettyprint-override"><code>[System.Runtime.InteropServices.DllImport(&quot;gdi32.dll&quot;)]
  private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont,
      IntPtr pdv, [System.Runtime.InteropServices.In] ref uint pcFonts);
  
  public readonly PrivateFontCollection privateFontCollection = new PrivateFontCollection();
  
  public readonly FontFamily Samim;
  
  private readonly FontFamily IranNastaliq;
  
  private readonly FontFamily BKoodak;
  
  private readonly FontFamily BNazanin;
  
  public MainForm()
  {
      uint temp = 0;
      byte[][] fontData = new byte[][] { Properties.Resources.Samim, Properties.Resources.IranNastaliq_Web,
          Properties.Resources.BNazanin, Properties.Resources.BKoodak };
  
      for (int i = 0; i &lt; fontData.Length; i++)
      {
          IntPtr fontPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(fontData[i].Length);
          System.Runtime.InteropServices.Marshal.Copy(fontData[i], 0, fontPtr, fontData[i].Length);
          privateFontCollection.AddMemoryFont(fontPtr, fontData[i].Length);
          AddFontMemResourceEx(fontPtr, (uint)fontData[i].Length, IntPtr.Zero, ref temp);
          System.Runtime.InteropServices.Marshal.FreeCoTaskMem(fontPtr);
      }
  
      Samim = privateFontCollection.Families[3];
      IranNastaliq = privateFontCollection.Families[2];
      BNazanin = privateFontCollection.Families[1];
      BKoodak = privateFontCollection.Families[0];
  
  
      InitializeComponent();
  
      Application.CurrentCulture = new CultureInfo(&quot;fa-IR&quot;);
      
      // Other codes...
  }
  
  private void Draw(ref graphics)
  {
      Font font = new Font(BKoodak, 18);
      graphics.DrawString(&quot;سلام&quot;, font, new SolidBrush(Color.Black), 0, 0, new StringFormat());
  }
  </code></pre>
  <p>Why it is OK on Windows 10 but not Windows 7? How should I fix it?</p>
  <hr />
  <p><strong>EDIT</strong>:<br />
  I found this font only supports bold and outline mode. In Microsoft Word, there is no difference between bold and regular styles of this font.<br />
  So I changed <code>Font font = new Font(BKoodak, 18);</code> to <code>Font font = new Font(BKoodak, 18, FontStyle.Bold);</code> and now it works on Windows 7.</p>
  <p>Now the question is: Why did regular style work OK in Windows 10 despite this font doesn't support regular style?</p>