Change a console program's text font and size

I'd love to make my program change the cmd's font size to 12x16 on startup (from the default 8x12), to make the window bigger, the text more readable, and the contents nicer to the eye.

This can be done manually by the user, by right-clicking and going to properties, once the program is already started. However, telling the user to do so takes time away from using the program itself, which I do not like. I want it to be automatic.

Previously I learned to set the cmd window's lenght and height in characters on a fixed amount, which helps to output information to the user in a more professional and ordered way (when mixed together with SetConsoleCursorPosition). I wanted to take it a step even further.


I am not interested in WinAPI itself yet, as I have no need for the use of a mouse or complex graphics for my relatively simple programs.

Thank you.
Last edited on
Unfortunately you may not have a choice but to use the WinAPI for consoles, as every built in console (like cmd.exe for windows) is operating system specific. You ought to look at this page:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682073(v=vs.85).aspx

and also look at these functions in particular:
SetConsoleWindowInfo
SetCurrentConsoleFontEx

As well as the CONSOLE_FONT_INFOEX structure.

I believe the whole situation around this is rather painless.
store the return value of GetConsoleWindowInfo and change what you need from it's return value, then SetConsoleWindowInfo.
GetCurrentConsoleFontEx then SetCurrentConsoleFontEx.
Helpful. Thank you!
Topic archived. No new replies allowed.