Author Topic: C# change font and font size at runtime  (Read 6642 times)

Trr1ppy

  • Newcomer
  • Posts: 1
  • Karma: +0/-0
    • View Profile
C# change font and font size at runtime
« on: October 30, 2017, 02:57:40 PM »
I'm in the process of creating a rougelike and to assure my game displays correctly I am wanting to change the console font and font size at runtime. Specifically font NSimSum and font size 32.
I am very new to programming and c# so I'm hoping this can be explained simply.

This page (https://docs.microsoft.com/en-us/windows/console/console-font-infoex) list the full syntax of the CONSOLE_FONT_INFOEX structure:

Code: [Select]
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;

But I have no idea how to implement this into my existing code.

Krice

  • (Banned)
  • Rogueliker
  • ***
  • Posts: 2316
  • Karma: +0/-2
    • View Profile
    • Email
Re: C# change font and font size at runtime
« Reply #1 on: October 31, 2017, 07:12:41 AM »
Try google search, Sherlock. I found something from third hit with "C# change console font". But I think it's actually not a good idea to change it manually. Just let it be the default and users can anyway change the font from window properties as usual.