ConteD

Change font size in c++ [Windows]

Feb 2nd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     system("mode con:cols=80 lines=100");
  9.     CONSOLE_FONT_INFOEX prompt;
  10.     prompt.cbSize = sizeof(prompt);
  11.     prompt.nFont = 0;
  12.     prompt.dwFontSize.X = 0;                   // Width of each character in the font
  13.     prompt.dwFontSize.Y = 15;                  // Height
  14.     prompt.FontFamily = FF_DONTCARE;
  15.     prompt.FontWeight = FW_NORMAL;
  16.     std::wcscpy(prompt.FaceName, L"Consolas"); // Choose your font
  17.     SetCurrentConsoleFontEx(GetStdHandle(STD_OUTPUT_HANDLE), FALSE, &prompt);
  18.    
  19.     cout<<"test";
  20. }
Advertisement
Add Comment
Please, Sign In to add comment