title: C# modify console font, font size at runtime?
body: <p>I'm in the process of creating a <a href="https://upload.wikimedia.org/wikipedia/commons/0/00/Nethack_releasing_a_djinni.png" rel="nofollow noreferrer">rougelike</a> and to assure my game displays correctly I am wanting to change the console font and font size at runtime.</p>
  
  <p>I am very noob to programming and c# so I'm hoping this can be explained in a way I or anyone else can easily implement.</p>
  
  <p>This <a href="https://docs.microsoft.com/en-us/windows/console/console-font-infoex" rel="nofollow noreferrer">resource</a> list the full syntax of the CONSOLE_FONT_INFOEX structure:</p>
  
  <pre><code>typedef struct _CONSOLE_FONT_INFOEX {
    ULONG cbSize;
    DWORD nFont;
    COORD dwFontSize;
    UINT  FontFamily;
    UINT  FontWeight;
    WCHAR FaceName[LF_FACESIZE];
  } CONSOLE_FONT_INFOEX, *PCONSOLE_FONT_INFOEX;
  </code></pre>
  
  <p>Specifically I'm wanting to change the console font to NSimSum and font size to 32 at runtime.</p>
  
  <p>EDIT 1: Could I have it explained how to use the <a href="https://docs.microsoft.com/en-us/windows/console/setcurrentconsolefontex" rel="nofollow noreferrer">SetCurrentConsoleFontEx function</a> from <a href="https://stackoverflow.com/questions/1802600/changing-font-in-a-console-window-in-net">this</a> post. I don't understand what context the function needs to be in. I tried <code>Console.SetCurrentConsoleFontEx</code> but vs gave me no options.</p>
  
  <p>EDIT 2: <a href="http://www.cplusplus.com/forum/general/118967/" rel="nofollow noreferrer">this</a> forum post seems to detail a simple method of changing font size but is it specific to c++?</p>
  
  <pre><code>void setFontSize(int FontSize)
  {
      CONSOLE_FONT_INFOEX info = {0};
      info.cbSize       = sizeof(info);
      info.dwFontSize.Y = FontSize; // leave X as zero
      info.FontWeight   = FW_NORMAL;
      wcscpy(info.FaceName, L"Lucida Console");
      SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), NULL, &amp;info);
  }
  </code></pre>